From 1afbca031125ad14cbda3ef097ceadd2e3f04dac Mon Sep 17 00:00:00 2001 From: Xieyt Date: Mon, 15 Jul 2024 23:01:33 +0530 Subject: [PATCH 1/3] fix: not working in python3.10 --- frappe_manager/docker_wrapper/DockerClient.py | 2 -- frappe_manager/ssl_manager/letsencrypt_certificate.py | 5 ++--- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/frappe_manager/docker_wrapper/DockerClient.py b/frappe_manager/docker_wrapper/DockerClient.py index 2cc41b0..e72bcca 100644 --- a/frappe_manager/docker_wrapper/DockerClient.py +++ b/frappe_manager/docker_wrapper/DockerClient.py @@ -1,11 +1,9 @@ import json import shlex -from sys import exception from typing import Literal, Optional, List from pathlib import Path from frappe_manager.docker_wrapper.DockerCompose import DockerComposeWrapper -from frappe_manager.display_manager.DisplayManager import richprint from frappe_manager.docker_wrapper.DockerException import DockerException from frappe_manager.utils.docker import ( SubprocessOutput, diff --git a/frappe_manager/ssl_manager/letsencrypt_certificate.py b/frappe_manager/ssl_manager/letsencrypt_certificate.py index 88c8e49..db943c8 100644 --- a/frappe_manager/ssl_manager/letsencrypt_certificate.py +++ b/frappe_manager/ssl_manager/letsencrypt_certificate.py @@ -1,4 +1,4 @@ -from typing import Optional, List, Self +from typing import Optional, List from pydantic import EmailStr, Field, model_validator from frappe_manager.ssl_manager import LETSENCRYPT_PREFERRED_CHALLENGE from frappe_manager.ssl_manager.certificate import SSLCertificate @@ -14,13 +14,12 @@ class LetsencryptSSLCertificate(SSLCertificate): toml_exclude: Optional[set] = {'domain', 'alias_domains', 'toml_exclude'} @model_validator(mode="after") - def validate_credentials(self) -> Self: + def validate_credentials(self): if self.preferred_challenge == LETSENCRYPT_PREFERRED_CHALLENGE.dns01: if self.api_key or self.api_token: return self else: raise SSLDNSChallengeCredentailsNotFound() - return self def get_cloudflare_dns_credentials(self) -> str: From 63e58d655e9a3b9544208043930307ff7ef99748 Mon Sep 17 00:00:00 2001 From: Xieyt Date: Tue, 16 Jul 2024 00:00:06 +0530 Subject: [PATCH 2/3] fix: installation script --- scripts/install.sh | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/scripts/install.sh b/scripts/install.sh index 7d4cf40..15cc2bb 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -1,5 +1,9 @@ #!/bin/bash PS4='+\[\033[0;33m\](\[\033[0;36m\]${BASH_SOURCE##*/}:${LINENO}\[\033[0;33m\])\[\033[0m\] ' +LOGFILE="fm-install-$(date +"%Y%m%d_%H%M%S").log" + +# Enable debugging and redirect to a separate debug log file +exec {BASH_XTRACEFD}>>"$LOGFILE" set -xe @@ -41,11 +45,17 @@ info_red(){ isRoot() { if [ "$(id -u)" -eq 0 ]; then - info_red "You are running as root." - exit 69 + info_red "This script is being run as the root user. Frappe-Manager supports installation only as a non-root user. Please switch to a non-root user and re-run this script." + exit 1 fi } +install_fm(){ + info_blue "Installing frappe-manager..." + pip3 install --user --upgrade --break-system-packages. frappe-manager + info_green "$(bold 'fm' $(pip3 list | grep frappe-manager | awk '{print $2}')) installed." +} + has_docker_compose(){ declare desc="return 0 if we have docker compose command" if [[ "$(dockexr compose version 2>&1 || true)" = *"docker: 'compose' is not a docker command."* ]]; then @@ -215,9 +225,7 @@ install_python_and_frappe_ubuntu() { install_pyenv_python fi - info_blue "Installing frappe-manager..." - pip3 install --user --upgrade frappe-manager - info_green "$(bold 'fm' $(pip3 list | grep frappe-manager | awk '{print $2}')) installed." + install_fm } # Function to install Python and frappe-manager on macOS @@ -232,7 +240,7 @@ install_python_and_frappe_macos() { fi if ! type pip3 > /dev/null 2>&1; then - info_blue "Using $(yellow 'brew') for installing pip3..." + info_blue "Installing pip3" python -m ensurepip --upgrade info_green "Installed pip3" else @@ -243,9 +251,7 @@ install_python_and_frappe_macos() { install_pyenv_python fi - info_blue "Installing frappe-manager..." - pip3 install --user --upgrade frappe-manager - info_green "$(bold 'fm' $(pip3 list | grep frappe-manager | awk '{print $2}')) installed." + install_fm } handle_shell(){ From b89ca071b287213309681c6da9bd770ba6de23f5 Mon Sep 17 00:00:00 2001 From: Xieyt Date: Tue, 16 Jul 2024 00:21:56 +0530 Subject: [PATCH 3/3] fix: pip install --- scripts/install.sh | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/scripts/install.sh b/scripts/install.sh index 15cc2bb..0597015 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -2,9 +2,7 @@ PS4='+\[\033[0;33m\](\[\033[0;36m\]${BASH_SOURCE##*/}:${LINENO}\[\033[0;33m\])\[\033[0m\] ' LOGFILE="fm-install-$(date +"%Y%m%d_%H%M%S").log" -# Enable debugging and redirect to a separate debug log file exec {BASH_XTRACEFD}>>"$LOGFILE" - set -xe print_in_color() { @@ -52,12 +50,11 @@ isRoot() { install_fm(){ info_blue "Installing frappe-manager..." - pip3 install --user --upgrade --break-system-packages. frappe-manager + pip3 install --user --upgrade --break-system-packages frappe-manager info_green "$(bold 'fm' $(pip3 list | grep frappe-manager | awk '{print $2}')) installed." } has_docker_compose(){ - declare desc="return 0 if we have docker compose command" if [[ "$(dockexr compose version 2>&1 || true)" = *"docker: 'compose' is not a docker command."* ]]; then return 1 else @@ -66,7 +63,6 @@ has_docker_compose(){ } has_pyenv(){ - declare desc="return 0 if we have docker compose command" if [[ "$(pyenv --version 2>&1 || true)" = *"pyenv: command not found"* ]]; then return 1 else @@ -75,13 +71,13 @@ has_pyenv(){ } has_tty() { - declare desc="return 0 if we have a tty" if [[ "$(/usr/bin/tty || true)" == "not a tty" ]]; then return 1 else return 0 fi } + if has_tty; then if ! [[ "${INTERACTIVE:-}" ]]; then export DEBIAN_FRONTEND=noninteractive @@ -136,11 +132,8 @@ install_docker_ubuntu() { "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \ $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \ sudo tee /etc/apt/sources.list.d/docker.list > /dev/null - sudo DEBIAN_FRONTEND=noninteractive apt-get update - sudo DEBIAN_FRONTEND=noninteractive apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin - info_green "Docker Engine installed" fi