From 5ef2d476a40bc20ac38582a838273ebc5e2f5d5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Tosser?= Date: Sat, 7 Sep 2024 10:35:26 +0400 Subject: [PATCH 01/16] Implementing support for Alpine Linux --- bootstrap/helpers/constants.php | 1 + scripts/install.sh | 201 ++++++++++++++++++++------------ scripts/upgrade.sh | 3 +- 3 files changed, 127 insertions(+), 78 deletions(-) diff --git a/bootstrap/helpers/constants.php b/bootstrap/helpers/constants.php index f94c9bc20..1eeec8f94 100644 --- a/bootstrap/helpers/constants.php +++ b/bootstrap/helpers/constants.php @@ -46,6 +46,7 @@ const SUPPORTED_OS = [ 'centos fedora rhel ol rocky amzn almalinux', 'sles opensuse-leap opensuse-tumbleweed', 'arch', + 'alpine', ]; const SHARED_VARIABLE_TYPES = ['team', 'project', 'environment']; diff --git a/scripts/install.sh b/scripts/install.sh index d709efcd1..39da54e52 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -59,9 +59,9 @@ if [ $EUID != 0 ]; then fi case "$OS_TYPE" in -arch | ubuntu | debian | raspbian | centos | fedora | rhel | ol | rocky | sles | opensuse-leap | opensuse-tumbleweed | almalinux | amzn) ;; +arch | ubuntu | debian | raspbian | centos | fedora | rhel | ol | rocky | sles | opensuse-leap | opensuse-tumbleweed | almalinux | amzn | alpine) ;; *) - echo "This script only supports Debian, Redhat, Arch Linux, or SLES based operating systems for now." + echo "This script only supports Debian, Redhat, Arch Linux, Alpine Linux, or SLES based operating systems for now." exit ;; esac @@ -90,6 +90,11 @@ case "$OS_TYPE" in arch) pacman -Sy --noconfirm --needed curl wget git jq >/dev/null || true ;; +alpine) + sed -i '/^#.*\/community/s/^#//' /etc/apk/repositories + apk update >/dev/null + apk add curl wget git jq >/dev/null + ;; ubuntu | debian | raspbian) apt-get update -y >/dev/null apt-get install -y curl wget git jq >/dev/null @@ -172,70 +177,74 @@ if [ -x "$(command -v snap)" ]; then fi if ! [ -x "$(command -v docker)" ]; then - # Almalinux - if [ "$OS_TYPE" == 'almalinux' ]; then - dnf config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo - dnf install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin - if ! [ -x "$(command -v docker)" ]; then - echo "Docker could not be installed automatically. Please visit https://docs.docker.com/engine/install/ and install Docker manually to continue." - exit 1 - fi - systemctl start docker - systemctl enable docker - else - set +e - if ! [ -x "$(command -v docker)" ]; then - echo "Docker is not installed. Installing Docker." - # Arch Linux - if [ "$OS_TYPE" = "arch" ]; then - pacman -Sy docker docker-compose --noconfirm - systemctl enable docker.service + case "$OS_TYPE" in + "almalinux") + dnf config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo + dnf install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin + if ! [ -x "$(command -v docker)" ]; then + echo "Docker could not be installed automatically. Please visit https://docs.docker.com/engine/install/ and install Docker manually to continue." + exit 1 + fi + systemctl start docker + systemctl enable docker + ;; + "alpine") + apk add docker docker-cli-compose + rc-update add docker default + service docker start + if [ -x "$(command -v docker)" ]; then + echo "Docker installed successfully." + else + echo "Failed to install Docker with apk. Try to install it manually." + echo "Please visit https://wiki.alpinelinux.org/wiki/Docker for more information." + exit + fi + ;; + "arch") + pacman -Sy docker docker-compose --noconfirm + systemctl enable docker.service + if [ -x "$(command -v docker)" ]; then + echo "Docker installed successfully." + else + echo "Failed to install Docker with pacman. Try to install it manually." + echo "Please visit https://wiki.archlinux.org/title/docker for more information." + exit + fi + ;; + "amzn") + dnf install docker -y + DOCKER_CONFIG=${DOCKER_CONFIG:-/usr/local/lib/docker} + mkdir -p $DOCKER_CONFIG/cli-plugins + curl -L https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m) -o $DOCKER_CONFIG/cli-plugins/docker-compose + chmod +x $DOCKER_CONFIG/cli-plugins/docker-compose + systemctl start docker + systemctl enable docker + if [ -x "$(command -v docker)" ]; then + echo "Docker installed successfully." + else + echo "Failed to install Docker with dnf. Try to install it manually." + echo "Please visit https://www.cyberciti.biz/faq/how-to-install-docker-on-amazon-linux-2/ for more information." + exit + fi + ;; + *) + # Automated Docker installation + curl https://releases.rancher.com/install-docker/${DOCKER_VERSION}.sh | sh + if [ -x "$(command -v docker)" ]; then + echo "Docker installed successfully." + else + echo "Docker installation failed with Rancher script. Trying with official script." + curl https://get.docker.com | sh -s -- --version ${DOCKER_VERSION} if [ -x "$(command -v docker)" ]; then echo "Docker installed successfully." else - echo "Failed to install Docker with pacman. Try to install it manually." - echo "Please visit https://wiki.archlinux.org/title/docker for more information." - exit - fi - else - # Amazon Linux 2023 - if [ "$OS_TYPE" = "amzn" ]; then - dnf install docker -y - DOCKER_CONFIG=${DOCKER_CONFIG:-/usr/local/lib/docker} - mkdir -p $DOCKER_CONFIG/cli-plugins - curl -L https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m) -o $DOCKER_CONFIG/cli-plugins/docker-compose - chmod +x $DOCKER_CONFIG/cli-plugins/docker-compose - systemctl start docker - systemctl enable docker - if [ -x "$(command -v docker)" ]; then - echo "Docker installed successfully." - else - echo "Failed to install Docker with pacman. Try to install it manually." - echo "Please visit https://wiki.archlinux.org/title/docker for more information." - exit - fi - else - # Automated Docker installation - curl https://releases.rancher.com/install-docker/${DOCKER_VERSION}.sh | sh - if [ -x "$(command -v docker)" ]; then - echo "Docker installed successfully." - else - echo "Docker installation failed with Rancher script. Trying with official script." - curl https://get.docker.com | sh -s -- --version ${DOCKER_VERSION} - if [ -x "$(command -v docker)" ]; then - echo "Docker installed successfully." - else - echo "Docker installation failed with official script." - echo "Maybe your OS is not supported?" - echo "Please visit https://docs.docker.com/engine/install/ and install Docker manually to continue." - exit 1 - fi - fi + echo "Docker installation failed with official script." + echo "Maybe your OS is not supported?" + echo "Please visit https://docs.docker.com/engine/install/ and install Docker manually to continue." + exit 1 fi fi - fi - set -e - fi + esac fi echo -e "-------------" @@ -267,17 +276,50 @@ if ! jq -s '.[0] * .[1]' /etc/docker/daemon.json /etc/docker/daemon.json.coolify fi mv "$TEMP_FILE" /etc/docker/daemon.json +restart_docker_service() { + + # Check if systemctl is available + if command -v systemctl >/dev/null 2>&1; then + echo "Using systemctl to restart Docker..." + systemctl restart docker + + if [ $? -eq 0 ]; then + echo "Docker restarted successfully using systemctl." + else + echo "Failed to restart Docker using systemctl." + return 1 + fi + + # Check if service command is available + elif command -v service >/dev/null 2>&1; then + echo "Using service command to restart Docker..." + service docker restart + + if [ $? -eq 0 ]; then + echo "Docker restarted successfully using service." + else + echo "Failed to restart Docker using service." + return 1 + fi + + # If neither systemctl nor service is available + else + echo "Neither systemctl nor service command is available on this system." + return 1 + fi +} + if [ -s /etc/docker/daemon.json.original-"$DATE" ]; then DIFF=$(diff <(jq --sort-keys . /etc/docker/daemon.json) <(jq --sort-keys . /etc/docker/daemon.json.original-"$DATE")) if [ "$DIFF" != "" ]; then echo "Docker configuration updated, restart docker daemon..." - systemctl restart docker + restart_docker_service else echo "Docker configuration is up to date." fi else echo "Docker configuration updated, restart docker daemon..." - systemctl restart docker + restart_docker_service fi echo -e "-------------" @@ -296,28 +338,35 @@ curl -fsSL $CDN/.env.production -o /data/coolify/source/.env.production curl -fsSL $CDN/upgrade.sh -o /data/coolify/source/upgrade.sh # Copy .env.example if .env does not exist -if [ ! -f $ENV_FILE ]; then - cp /data/coolify/source/.env.production $ENV_FILE - # Generate a secure APP_ID and APP_KEY - sed -i "s|^APP_ID=.*|APP_ID=$(openssl rand -hex 16)|" "$ENV_FILE" - sed -i "s|^APP_KEY=.*|APP_KEY=base64:$(openssl rand -base64 32)|" "$ENV_FILE" +if [ -f $ENV_FILE ]; then + echo "File exists: $ENV_FILE" + cat $ENV_FILE + echo "Copying .env to .env-$DATE" + cp $ENV_FILE $ENV_FILE-$DATE +else + echo "File does not exist: $ENV_FILE" + echo "Copying .env.production to .env-$DATE" + cp /data/coolify/source/.env.production $ENV_FILE-$DATE + # Generate a secure APP_ID and APP_KEY + sed -i "s|^APP_ID=.*|APP_ID=$(openssl rand -hex 16)|" "$ENV_FILE-$DATE" + sed -i "s|^APP_KEY=.*|APP_KEY=base64:$(openssl rand -base64 32)|" "$ENV_FILE-$DATE" # Generate a secure Postgres DB username and password # Causes issues: database "random-user" does not exist - # sed -i "s|^DB_USERNAME=.*|DB_USERNAME=$(openssl rand -hex 16)|" "$ENV_FILE" - sed -i "s|^DB_PASSWORD=.*|DB_PASSWORD=$(openssl rand -base64 32)|" "$ENV_FILE" + # sed -i "s|^DB_USERNAME=.*|DB_USERNAME=$(openssl rand -hex 16)|" "$ENV_FILE-$DATE" + sed -i "s|^DB_PASSWORD=.*|DB_PASSWORD=$(openssl rand -base64 32)|" "$ENV_FILE-$DATE" # Generate a secure Redis password - sed -i "s|^REDIS_PASSWORD=.*|REDIS_PASSWORD=$(openssl rand -base64 32)|" "$ENV_FILE" + sed -i "s|^REDIS_PASSWORD=.*|REDIS_PASSWORD=$(openssl rand -base64 32)|" "$ENV_FILE-$DATE" # Generate secure Pusher credentials - sed -i "s|^PUSHER_APP_ID=.*|PUSHER_APP_ID=$(openssl rand -hex 32)|" "$ENV_FILE" - sed -i "s|^PUSHER_APP_KEY=.*|PUSHER_APP_KEY=$(openssl rand -hex 32)|" "$ENV_FILE" - sed -i "s|^PUSHER_APP_SECRET=.*|PUSHER_APP_SECRET=$(openssl rand -hex 32)|" "$ENV_FILE" + sed -i "s|^PUSHER_APP_ID=.*|PUSHER_APP_ID=$(openssl rand -hex 32)|" "$ENV_FILE-$DATE" + sed -i "s|^PUSHER_APP_KEY=.*|PUSHER_APP_KEY=$(openssl rand -hex 32)|" "$ENV_FILE-$DATE" + sed -i "s|^PUSHER_APP_SECRET=.*|PUSHER_APP_SECRET=$(openssl rand -hex 32)|" "$ENV_FILE-$DATE" fi # Merge .env and .env.production. New values will be added to .env -sort -u -t '=' -k 1,1 /data/coolify/source/.env /data/coolify/source/.env.production | sed '/^$/d' >/data/coolify/source/.env.temp && mv /data/coolify/source/.env.temp /data/coolify/source/.env +awk -F '=' '!seen[$1]++' "$ENV_FILE-$DATE" /data/coolify/source/.env.production > $ENV_FILE if [ "$AUTOUPDATE" = "false" ]; then if ! grep -q "AUTOUPDATE=" /data/coolify/source/.env; then @@ -350,7 +399,7 @@ if ! grep -qw "root@coolify" ~/.ssh/authorized_keys; then fi bash /data/coolify/source/upgrade.sh "${LATEST_VERSION:-latest}" "${LATEST_HELPER_VERSION:-latest}" - +rm -f $ENV_FILE-$DATE echo "Waiting for 20 seconds for Coolify to be ready..." sleep 20 diff --git a/scripts/upgrade.sh b/scripts/upgrade.sh index d46729443..a7844f413 100644 --- a/scripts/upgrade.sh +++ b/scripts/upgrade.sh @@ -11,8 +11,7 @@ curl -fsSL $CDN/docker-compose.prod.yml -o /data/coolify/source/docker-compose.p curl -fsSL $CDN/.env.production -o /data/coolify/source/.env.production # Merge .env and .env.production. New values will be added to .env -sort -u -t '=' -k 1,1 /data/coolify/source/.env /data/coolify/source/.env.production | sed '/^$/d' >/data/coolify/source/.env.temp && mv /data/coolify/source/.env.temp /data/coolify/source/.env - +awk -F '=' '!seen[$1]++' /data/coolify/source/.env /data/coolify/source/.env.production > /data/coolify/source/.env.tmp && mv /data/coolify/source/.env.tmp /data/coolify/source/.env # Check if PUSHER_APP_ID or PUSHER_APP_KEY or PUSHER_APP_SECRET is empty in /data/coolify/source/.env if grep -q "PUSHER_APP_ID=$" /data/coolify/source/.env; then sed -i "s|PUSHER_APP_ID=.*|PUSHER_APP_ID=$(openssl rand -hex 32)|g" /data/coolify/source/.env From 6b475cc1bf541631a1e75324cc47b400b4d51038 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Tosser?= Date: Sat, 7 Sep 2024 11:00:42 +0400 Subject: [PATCH 02/16] refactor: Improve handling of environment variable merging in upgrade script --- other/nightly/install.sh | 201 ++++++++++++++++++++++++--------------- other/nightly/upgrade.sh | 2 +- 2 files changed, 126 insertions(+), 77 deletions(-) diff --git a/other/nightly/install.sh b/other/nightly/install.sh index d87101141..23c2efc6f 100755 --- a/other/nightly/install.sh +++ b/other/nightly/install.sh @@ -59,9 +59,9 @@ if [ $EUID != 0 ]; then fi case "$OS_TYPE" in -arch | ubuntu | debian | raspbian | centos | fedora | rhel | ol | rocky | sles | opensuse-leap | opensuse-tumbleweed | almalinux | amzn) ;; +arch | ubuntu | debian | raspbian | centos | fedora | rhel | ol | rocky | sles | opensuse-leap | opensuse-tumbleweed | almalinux | amzn | alpine) ;; *) - echo "This script only supports Debian, Redhat, Arch Linux, or SLES based operating systems for now." + echo "This script only supports Debian, Redhat, Arch Linux, Alpine Linux, or SLES based operating systems for now." exit ;; esac @@ -90,6 +90,11 @@ case "$OS_TYPE" in arch) pacman -Sy --noconfirm --needed curl wget git jq >/dev/null || true ;; +alpine) + sed -i '/^#.*\/community/s/^#//' /etc/apk/repositories + apk update >/dev/null + apk add curl wget git jq >/dev/null + ;; ubuntu | debian | raspbian) apt-get update -y >/dev/null apt-get install -y curl wget git jq >/dev/null @@ -172,70 +177,74 @@ if [ -x "$(command -v snap)" ]; then fi if ! [ -x "$(command -v docker)" ]; then - # Almalinux - if [ "$OS_TYPE" == 'almalinux' ]; then - dnf config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo - dnf install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin - if ! [ -x "$(command -v docker)" ]; then - echo "Docker could not be installed automatically. Please visit https://docs.docker.com/engine/install/ and install Docker manually to continue." - exit 1 - fi - systemctl start docker - systemctl enable docker - else - set +e - if ! [ -x "$(command -v docker)" ]; then - echo "Docker is not installed. Installing Docker." - # Arch Linux - if [ "$OS_TYPE" = "arch" ]; then - pacman -Sy docker docker-compose --noconfirm - systemctl enable docker.service + case "$OS_TYPE" in + "almalinux") + dnf config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo + dnf install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin + if ! [ -x "$(command -v docker)" ]; then + echo "Docker could not be installed automatically. Please visit https://docs.docker.com/engine/install/ and install Docker manually to continue." + exit 1 + fi + systemctl start docker + systemctl enable docker + ;; + "alpine") + apk add docker docker-cli-compose + rc-update add docker default + service docker start + if [ -x "$(command -v docker)" ]; then + echo "Docker installed successfully." + else + echo "Failed to install Docker with apk. Try to install it manually." + echo "Please visit https://wiki.alpinelinux.org/wiki/Docker for more information." + exit + fi + ;; + "arch") + pacman -Sy docker docker-compose --noconfirm + systemctl enable docker.service + if [ -x "$(command -v docker)" ]; then + echo "Docker installed successfully." + else + echo "Failed to install Docker with pacman. Try to install it manually." + echo "Please visit https://wiki.archlinux.org/title/docker for more information." + exit + fi + ;; + "amzn") + dnf install docker -y + DOCKER_CONFIG=${DOCKER_CONFIG:-/usr/local/lib/docker} + mkdir -p $DOCKER_CONFIG/cli-plugins + curl -L https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m) -o $DOCKER_CONFIG/cli-plugins/docker-compose + chmod +x $DOCKER_CONFIG/cli-plugins/docker-compose + systemctl start docker + systemctl enable docker + if [ -x "$(command -v docker)" ]; then + echo "Docker installed successfully." + else + echo "Failed to install Docker with dnf. Try to install it manually." + echo "Please visit https://www.cyberciti.biz/faq/how-to-install-docker-on-amazon-linux-2/ for more information." + exit + fi + ;; + *) + # Automated Docker installation + curl https://releases.rancher.com/install-docker/${DOCKER_VERSION}.sh | sh + if [ -x "$(command -v docker)" ]; then + echo "Docker installed successfully." + else + echo "Docker installation failed with Rancher script. Trying with official script." + curl https://get.docker.com | sh -s -- --version ${DOCKER_VERSION} if [ -x "$(command -v docker)" ]; then echo "Docker installed successfully." else - echo "Failed to install Docker with pacman. Try to install it manually." - echo "Please visit https://wiki.archlinux.org/title/docker for more information." - exit - fi - else - # Amazon Linux 2023 - if [ "$OS_TYPE" = "amzn" ]; then - dnf install docker -y - DOCKER_CONFIG=${DOCKER_CONFIG:-/usr/local/lib/docker} - mkdir -p $DOCKER_CONFIG/cli-plugins - curl -L https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m) -o $DOCKER_CONFIG/cli-plugins/docker-compose - chmod +x $DOCKER_CONFIG/cli-plugins/docker-compose - systemctl start docker - systemctl enable docker - if [ -x "$(command -v docker)" ]; then - echo "Docker installed successfully." - else - echo "Failed to install Docker with pacman. Try to install it manually." - echo "Please visit https://wiki.archlinux.org/title/docker for more information." - exit - fi - else - # Automated Docker installation - curl https://releases.rancher.com/install-docker/${DOCKER_VERSION}.sh | sh - if [ -x "$(command -v docker)" ]; then - echo "Docker installed successfully." - else - echo "Docker installation failed with Rancher script. Trying with official script." - curl https://get.docker.com | sh -s -- --version ${DOCKER_VERSION} - if [ -x "$(command -v docker)" ]; then - echo "Docker installed successfully." - else - echo "Docker installation failed with official script." - echo "Maybe your OS is not supported?" - echo "Please visit https://docs.docker.com/engine/install/ and install Docker manually to continue." - exit 1 - fi - fi + echo "Docker installation failed with official script." + echo "Maybe your OS is not supported?" + echo "Please visit https://docs.docker.com/engine/install/ and install Docker manually to continue." + exit 1 fi fi - fi - set -e - fi + esac fi echo -e "-------------" @@ -267,17 +276,50 @@ if ! jq -s '.[0] * .[1]' /etc/docker/daemon.json /etc/docker/daemon.json.coolify fi mv "$TEMP_FILE" /etc/docker/daemon.json +restart_docker_service() { + + # Check if systemctl is available + if command -v systemctl >/dev/null 2>&1; then + echo "Using systemctl to restart Docker..." + systemctl restart docker + + if [ $? -eq 0 ]; then + echo "Docker restarted successfully using systemctl." + else + echo "Failed to restart Docker using systemctl." + return 1 + fi + + # Check if service command is available + elif command -v service >/dev/null 2>&1; then + echo "Using service command to restart Docker..." + service docker restart + + if [ $? -eq 0 ]; then + echo "Docker restarted successfully using service." + else + echo "Failed to restart Docker using service." + return 1 + fi + + # If neither systemctl nor service is available + else + echo "Neither systemctl nor service command is available on this system." + return 1 + fi +} + if [ -s /etc/docker/daemon.json.original-"$DATE" ]; then DIFF=$(diff <(jq --sort-keys . /etc/docker/daemon.json) <(jq --sort-keys . /etc/docker/daemon.json.original-"$DATE")) if [ "$DIFF" != "" ]; then echo "Docker configuration updated, restart docker daemon..." - systemctl restart docker + restart_docker_service else echo "Docker configuration is up to date." fi else echo "Docker configuration updated, restart docker daemon..." - systemctl restart docker + restart_docker_service fi echo -e "-------------" @@ -296,28 +338,35 @@ curl -fsSL $CDN/.env.production -o /data/coolify/source/.env.production curl -fsSL $CDN/upgrade.sh -o /data/coolify/source/upgrade.sh # Copy .env.example if .env does not exist -if [ ! -f $ENV_FILE ]; then - cp /data/coolify/source/.env.production $ENV_FILE - # Generate a secure APP_ID and APP_KEY - sed -i "s|^APP_ID=.*|APP_ID=$(openssl rand -hex 16)|" "$ENV_FILE" - sed -i "s|^APP_KEY=.*|APP_KEY=base64:$(openssl rand -base64 32)|" "$ENV_FILE" +if [ -f $ENV_FILE ]; then + echo "File exists: $ENV_FILE" + cat $ENV_FILE + echo "Copying .env to .env-$DATE" + cp $ENV_FILE $ENV_FILE-$DATE +else + echo "File does not exist: $ENV_FILE" + echo "Copying .env.production to .env-$DATE" + cp /data/coolify/source/.env.production $ENV_FILE-$DATE + # Generate a secure APP_ID and APP_KEY + sed -i "s|^APP_ID=.*|APP_ID=$(openssl rand -hex 16)|" "$ENV_FILE-$DATE" + sed -i "s|^APP_KEY=.*|APP_KEY=base64:$(openssl rand -base64 32)|" "$ENV_FILE-$DATE" # Generate a secure Postgres DB username and password # Causes issues: database "random-user" does not exist - # sed -i "s|^DB_USERNAME=.*|DB_USERNAME=$(openssl rand -hex 16)|" "$ENV_FILE" - sed -i "s|^DB_PASSWORD=.*|DB_PASSWORD=$(openssl rand -base64 32)|" "$ENV_FILE" + # sed -i "s|^DB_USERNAME=.*|DB_USERNAME=$(openssl rand -hex 16)|" "$ENV_FILE-$DATE" + sed -i "s|^DB_PASSWORD=.*|DB_PASSWORD=$(openssl rand -base64 32)|" "$ENV_FILE-$DATE" # Generate a secure Redis password - sed -i "s|^REDIS_PASSWORD=.*|REDIS_PASSWORD=$(openssl rand -base64 32)|" "$ENV_FILE" + sed -i "s|^REDIS_PASSWORD=.*|REDIS_PASSWORD=$(openssl rand -base64 32)|" "$ENV_FILE-$DATE" # Generate secure Pusher credentials - sed -i "s|^PUSHER_APP_ID=.*|PUSHER_APP_ID=$(openssl rand -hex 32)|" "$ENV_FILE" - sed -i "s|^PUSHER_APP_KEY=.*|PUSHER_APP_KEY=$(openssl rand -hex 32)|" "$ENV_FILE" - sed -i "s|^PUSHER_APP_SECRET=.*|PUSHER_APP_SECRET=$(openssl rand -hex 32)|" "$ENV_FILE" + sed -i "s|^PUSHER_APP_ID=.*|PUSHER_APP_ID=$(openssl rand -hex 32)|" "$ENV_FILE-$DATE" + sed -i "s|^PUSHER_APP_KEY=.*|PUSHER_APP_KEY=$(openssl rand -hex 32)|" "$ENV_FILE-$DATE" + sed -i "s|^PUSHER_APP_SECRET=.*|PUSHER_APP_SECRET=$(openssl rand -hex 32)|" "$ENV_FILE-$DATE" fi # Merge .env and .env.production. New values will be added to .env -sort -u -t '=' -k 1,1 /data/coolify/source/.env /data/coolify/source/.env.production | sed '/^$/d' >/data/coolify/source/.env.temp && mv /data/coolify/source/.env.temp /data/coolify/source/.env +awk -F '=' '!seen[$1]++' "$ENV_FILE-$DATE" /data/coolify/source/.env.production > $ENV_FILE if [ "$AUTOUPDATE" = "false" ]; then if ! grep -q "AUTOUPDATE=" /data/coolify/source/.env; then @@ -350,7 +399,7 @@ if ! grep -qw "root@coolify" ~/.ssh/authorized_keys; then fi bash /data/coolify/source/upgrade.sh "${LATEST_VERSION:-latest}" "${LATEST_HELPER_VERSION:-latest}" - +rm -f $ENV_FILE-$DATE echo "Waiting for 20 seconds for Coolify to be ready..." sleep 20 diff --git a/other/nightly/upgrade.sh b/other/nightly/upgrade.sh index bce82aaa5..45295a510 100644 --- a/other/nightly/upgrade.sh +++ b/other/nightly/upgrade.sh @@ -11,7 +11,7 @@ curl -fsSL $CDN/docker-compose.prod.yml -o /data/coolify/source/docker-compose.p curl -fsSL $CDN/.env.production -o /data/coolify/source/.env.production # Merge .env and .env.production. New values will be added to .env -sort -u -t '=' -k 1,1 /data/coolify/source/.env /data/coolify/source/.env.production | sed '/^$/d' >/data/coolify/source/.env.temp && mv /data/coolify/source/.env.temp /data/coolify/source/.env +awk -F '=' '!seen[$1]++' /data/coolify/source/.env /data/coolify/source/.env.production > /data/coolify/source/.env.tmp && mv /data/coolify/source/.env.tmp /data/coolify/source/.env # Check if PUSHER_APP_ID or PUSHER_APP_KEY or PUSHER_APP_SECRET is empty in /data/coolify/source/.env if grep -q "PUSHER_APP_ID=$" /data/coolify/source/.env; then From f3845ce30aaf6234c5daef0823ad389236efa0c7 Mon Sep 17 00:00:00 2001 From: peaklabs-dev <122374094+peaklabs-dev@users.noreply.github.com> Date: Tue, 10 Sep 2024 13:55:58 +0200 Subject: [PATCH 03/16] New onboarding error UI and advanced menu --- .../views/livewire/boarding/index.blade.php | 275 +++++++++--------- 1 file changed, 144 insertions(+), 131 deletions(-) diff --git a/resources/views/livewire/boarding/index.blade.php b/resources/views/livewire/boarding/index.blade.php index 2e5fa41c9..cd7ef4c86 100644 --- a/resources/views/livewire/boarding/index.blade.php +++ b/resources/views/livewire/boarding/index.blade.php @@ -1,20 +1,18 @@ @php use App\Enums\ProxyTypes; @endphp Onboarding | Coolify - -
-
- @if ($currentState === 'welcome') + +
+
+ @if ($currentState === 'welcome')

Welcome to Coolify

Let me help you set up the basics.
- Get + Get Started
- @elseif ($currentState === 'explanation') + @elseif ($currentState === 'explanation') Coolify is an all-in-one application to automate tasks on your servers, deploy application with @@ -28,12 +26,15 @@ -

You don't need to manage your servers anymore. +

+ You don't need to manage your servers anymore. Coolify does it for you.

-

All configurations are stored on your servers, so +

+ All configurations are stored on your servers, so everything works without a connection to Coolify (except integrations and automations).

-

You can get notified on your favourite platforms +

+ You can get notified on your favourite platforms (Discord, Telegram, Email, etc.) when something goes wrong, or an action is needed from your side.

@@ -42,70 +43,91 @@
- @elseif ($currentState === 'select-server-type') + @elseif ($currentState === 'select-server-type') - Do you want to deploy your resources to your - or to a ? + Do you want to deploy your resources to your + + or to a + ? - Localhost + Localhost - Remote Server + Remote Server + @if (!$serverReachable) - Localhost is not reachable with the following public key. -

- Please make sure you have the correct public key in your ~/.ssh/authorized_keys file for - user or skip the boarding process and add a new private key manually to Coolify and to the - server. -
- Check this documentation for further - help. - - Check again +
+

Server is not reachable

+

Please check the connection details below and correct them if they are incorrect.

+ +
+ +
+ +

+ Non-root user is experimental: + docs +

+
+
+ +
+

If the connection details are correct, please ensure:

+
    +
  • The correct public key is in your ~/.ssh/authorized_keys file for the specified user
  • +
  • Or skip the boarding process and manually add a new private key to Coolify and the server
  • +
+
+ +

+ For more help, check this documentation. +

+ + + + + Check again +
@endif

Servers are the main building blocks, as they will host your applications, databases, services, called resources. Any CPU intensive process will use the server's CPU where you are deploying your resources.

-

is the server where Coolify is running on. It is not +

+ is the server where Coolify is running on. It is not recommended to use one server for everything.

-

is a server reachable through SSH. It can be hosted +

+ is a server reachable through SSH. It can be hosted at home, or from any cloud provider.

- @elseif ($currentState === 'private-key') + @elseif ($currentState === 'private-key') Do you have your own SSH Private Key? - Yes + Yes - No (create one for me) + No (create one for me) @if (count($privateKeys) > 0) -
- - @foreach ($privateKeys as $privateKey) - - @endforeach - - Use this SSH Key -
+
+ + @foreach ($privateKeys as $privateKey) + + @endforeach + + Use this SSH Key +
@endif
@@ -117,7 +139,7 @@

- @elseif ($currentState === 'select-existing-server') + @elseif ($currentState === 'select-existing-server') There are already servers available for your Team. Do you want to use one of them? @@ -136,8 +158,8 @@
@foreach ($servers as $server) - + @endforeach Use this Server @@ -145,20 +167,18 @@
@if (!$serverReachable) - This server is not reachable with the following public key. -

- Please make sure you have the correct public key in your ~/.ssh/authorized_keys file for - user or skip the boarding process and add a new private key manually to Coolify and to the - server. -
- Check this documentation for further - help. - - Check - again - + This server is not reachable with the following public key. +

+ Please make sure you have the correct public key in your ~/.ssh/authorized_keys file for + user or skip the boarding process and add a new private key manually to Coolify and to the + server. +
+ Check this documentation for further + help. + + Check + again + @endif @@ -169,25 +189,22 @@

- @elseif ($currentState === 'create-private-key') + @elseif ($currentState === 'create-private-key') Please let me know your key details. - - - + + + @if ($privateKeyType === 'create') - - ACTION REQUIRED: Copy the 'Public Key' to your - server's - ~/.ssh/authorized_keys - file. + + ACTION REQUIRED: Copy the 'Public Key' to your + server's + ~/.ssh/authorized_keys + file. @endif Save @@ -200,7 +217,7 @@

- @elseif ($currentState === 'create-server') + @elseif ($currentState === 'create-server') Please let me know your server details. @@ -208,34 +225,33 @@
- - + +
- -
- -
Non-root user is experimental: docs. +
+
+ +
+ +
+ +
Non-root user is experimental: docs. +
- +
Continue - @elseif ($currentState === 'validate-server') + @elseif ($currentState === 'validate-server') I need to validate your server (connection, Docker Engine, etc) and configure if something is @@ -247,8 +263,7 @@ - + Let's do it! @@ -257,20 +272,19 @@

This will install the latest Docker Engine on your server, configure a few things to be able to run optimal.

Minimum Docker Engine version is: 22

To manually install Docker - Engine, check this + Engine, check this documentation.

- @elseif ($currentState === 'create-project') + @elseif ($currentState === 'create-project') @if (count($projects) > 0) - You already have some projects. Do you want to use one of them or should I create a new one - for - you? + You already have some projects. Do you want to use one of them or should I create a new one + for + you? @else - Let's create an initial project for you. You can change all the details later on. + Let's create an initial project for you. You can change all the details later on. @endif @@ -278,15 +292,15 @@ project!
@if (count($projects) > 0) -
- - @foreach ($projects as $project) - - @endforeach - - Use this Project -
+
+ + @foreach ($projects as $project) + + @endforeach + + Use this Project +
@endif
@@ -297,7 +311,7 @@ staging version of the same application, but grouped separately.

- @elseif ($currentState === 'create-resource') + @elseif ($currentState === 'create-resource') Let's go to the new resource page, where you can create your first resource. @@ -310,24 +324,23 @@

A resource could be an application, a database or a service (like WordPress).

- @endif -
-
-
-
Skip - onboarding
-
Restart - onboarding
+ @endif
- - -
- Feedback -
-
- -
-
-
-
+
+
+
Skip + onboarding
+
Restart + onboarding
+
+ + +
+ Feedback +
+
+ +
+
+ + From f70160a17c89b54af247aa76fe052a62b6b97f11 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Tue, 10 Sep 2024 14:52:47 +0200 Subject: [PATCH 04/16] chore: Update version numbers to 4.0.0-beta.333 --- config/sentry.php | 2 +- config/version.php | 2 +- versions.json | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/config/sentry.php b/config/sentry.php index a978caa5e..eb0a3a508 100644 --- a/config/sentry.php +++ b/config/sentry.php @@ -7,7 +7,7 @@ return [ // The release version of your application // Example with dynamic git hash: trim(exec('git --git-dir ' . base_path('.git') . ' log --pretty="%h" -n1 HEAD')) - 'release' => '4.0.0-beta.332', + 'release' => '4.0.0-beta.333', // When left empty or `null` the Laravel environment will be used 'environment' => config('app.env'), diff --git a/config/version.php b/config/version.php index cb4452172..c3c14e32b 100644 --- a/config/version.php +++ b/config/version.php @@ -1,3 +1,3 @@ Date: Tue, 10 Sep 2024 14:54:22 +0200 Subject: [PATCH 05/16] chore: Copy .env file to .env-{DATE} if it exists --- scripts/install.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/install.sh b/scripts/install.sh index 39da54e52..a4c3822d0 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -340,7 +340,6 @@ curl -fsSL $CDN/upgrade.sh -o /data/coolify/source/upgrade.sh # Copy .env.example if .env does not exist if [ -f $ENV_FILE ]; then echo "File exists: $ENV_FILE" - cat $ENV_FILE echo "Copying .env to .env-$DATE" cp $ENV_FILE $ENV_FILE-$DATE else From f718604ac4b9ea221e09fec3a98dc470782ec22c Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Tue, 10 Sep 2024 14:58:26 +0200 Subject: [PATCH 06/16] chore: Update .env file with new values --- scripts/install.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/install.sh b/scripts/install.sh index a4c3822d0..c7cfc0309 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -365,6 +365,7 @@ else fi # Merge .env and .env.production. New values will be added to .env +echo "Updating .env with new values (if necessary)..." awk -F '=' '!seen[$1]++' "$ENV_FILE-$DATE" /data/coolify/source/.env.production > $ENV_FILE if [ "$AUTOUPDATE" = "false" ]; then From 91c845732e24d1bb2e46b645c64030b38022c25b Mon Sep 17 00:00:00 2001 From: peaklabs-dev <122374094+peaklabs-dev@users.noreply.github.com> Date: Tue, 10 Sep 2024 16:55:34 +0200 Subject: [PATCH 07/16] fix set custom port or user during boarding --- app/Livewire/Boarding/Index.php | 42 ++++++++++++++++++- app/Models/Server.php | 11 ++++- .../views/livewire/boarding/index.blade.php | 10 ++--- 3 files changed, 55 insertions(+), 8 deletions(-) diff --git a/app/Livewire/Boarding/Index.php b/app/Livewire/Boarding/Index.php index 147a1ad6f..bb01160f4 100644 --- a/app/Livewire/Boarding/Index.php +++ b/app/Livewire/Boarding/Index.php @@ -73,6 +73,8 @@ class Index extends Component } $this->privateKeyName = generate_random_name(); $this->remoteServerName = generate_random_name(); + $this->remoteServerPort = $this->remoteServerPort; + $this->remoteServerUser = $this->remoteServerUser; if (isDev()) { $this->privateKey = '-----BEGIN OPENSSH PRIVATE KEY----- b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAMwAAAAtzc2gtZW @@ -173,6 +175,8 @@ uZx9iFkCELtxrh31QJ68AAAAEXNhaWxANzZmZjY2ZDJlMmRkAQIDBA== } $this->selectedExistingPrivateKey = $this->createdServer->privateKey->id; $this->serverPublicKey = $this->createdServer->privateKey->publicKey(); + $this->remoteServerPort = $this->createdServer->port; + $this->remoteServerUser = $this->createdServer->user; $this->currentState = 'validate-server'; } @@ -269,7 +273,7 @@ uZx9iFkCELtxrh31QJ68AAAAEXNhaWxANzZmZjY2ZDJlMmRkAQIDBA== public function validateServer() { try { - config()->set('coolify.mux_enabled', false); + config()->set('coolify.mux_enabled', true); // EC2 does not have `uptime` command, lol instant_remote_process(['ls /'], $this->createdServer, true); @@ -277,9 +281,13 @@ uZx9iFkCELtxrh31QJ68AAAAEXNhaWxANzZmZjY2ZDJlMmRkAQIDBA== $this->createdServer->settings()->update([ 'is_reachable' => true, ]); + $this->serverReachable = true; } catch (\Throwable $e) { $this->serverReachable = false; - $this->createdServer->delete(); + $this->createdServer->settings()->update([ + 'is_reachable' => false, + ]); + return handleError(error: $e, livewire: $this); } @@ -296,6 +304,9 @@ uZx9iFkCELtxrh31QJ68AAAAEXNhaWxANzZmZjY2ZDJlMmRkAQIDBA== ]); $this->getProxyType(); } catch (\Throwable $e) { + $this->createdServer->settings()->update([ + 'is_usable' => false, + ]); return handleError(error: $e, livewire: $this); } } @@ -349,6 +360,33 @@ uZx9iFkCELtxrh31QJ68AAAAEXNhaWxANzZmZjY2ZDJlMmRkAQIDBA== ); } + public function saveAndValidateServer() + { + $this->validate([ + 'remoteServerPort' => 'required|integer|min:1|max:65535', + 'remoteServerUser' => 'required|string', + ]); + + if (!$this->createdServer) { + $this->createdServer = Server::create([ + 'name' => $this->remoteServerName ?? 'New Server', + 'ip' => $this->remoteServerHost, + 'port' => $this->remoteServerPort, + 'user' => $this->remoteServerUser, + 'team_id' => currentTeam()->id, + 'timezone' => 'UTC', + ]); + } else { + $this->createdServer->update([ + 'port' => $this->remoteServerPort, + 'user' => $this->remoteServerUser, + 'timezone' => 'UTC', + ]); + } + + $this->validateServer(); + } + private function createNewPrivateKey() { $this->privateKeyName = generate_random_name(); diff --git a/app/Models/Server.php b/app/Models/Server.php index c72c7cc95..d30cdc9d6 100644 --- a/app/Models/Server.php +++ b/app/Models/Server.php @@ -112,6 +112,11 @@ class Server extends BaseModel 'proxy', ]; + protected $fillable = [ + 'port', + 'user', + ]; + protected $guarded = []; public static function isReachable() @@ -143,7 +148,11 @@ class Server extends BaseModel public function settings() { - return $this->hasOne(ServerSetting::class); + return $this->hasOne(ServerSetting::class)->withDefault([ + 'force_disabled' => false, + 'is_reachable' => false, + 'is_usable' => false, + ]); } public function setupDefault404Redirect() diff --git a/resources/views/livewire/boarding/index.blade.php b/resources/views/livewire/boarding/index.blade.php index cd7ef4c86..4b1da05da 100644 --- a/resources/views/livewire/boarding/index.blade.php +++ b/resources/views/livewire/boarding/index.blade.php @@ -64,9 +64,9 @@

Please check the connection details below and correct them if they are incorrect.

- +
- +

Non-root user is experimental: docs @@ -88,7 +88,7 @@ - + Check again

@@ -236,9 +236,9 @@ Advanced Settings
- +
- +
Non-root user is experimental: docs.
From d74cfd09ceabdc5faca82e959c989ebe1fe79223 Mon Sep 17 00:00:00 2001 From: peaklabs-dev <122374094+peaklabs-dev@users.noreply.github.com> Date: Tue, 10 Sep 2024 17:18:00 +0200 Subject: [PATCH 08/16] Fixes --- app/Livewire/Boarding/Index.php | 31 ++++----- .../views/livewire/boarding/index.blade.php | 67 ++++++++++++------- 2 files changed, 56 insertions(+), 42 deletions(-) diff --git a/app/Livewire/Boarding/Index.php b/app/Livewire/Boarding/Index.php index bb01160f4..9503da499 100644 --- a/app/Livewire/Boarding/Index.php +++ b/app/Livewire/Boarding/Index.php @@ -156,6 +156,7 @@ uZx9iFkCELtxrh31QJ68AAAAEXNhaWxANzZmZjY2ZDJlMmRkAQIDBA== $this->servers = Server::ownedByCurrentTeam(['name'])->where('id', '!=', 0)->get(); if ($this->servers->count() > 0) { $this->selectedExistingServer = $this->servers->first()->id; + $this->updateServerDetails(); $this->currentState = 'select-existing-server'; return; @@ -175,11 +176,18 @@ uZx9iFkCELtxrh31QJ68AAAAEXNhaWxANzZmZjY2ZDJlMmRkAQIDBA== } $this->selectedExistingPrivateKey = $this->createdServer->privateKey->id; $this->serverPublicKey = $this->createdServer->privateKey->publicKey(); - $this->remoteServerPort = $this->createdServer->port; - $this->remoteServerUser = $this->createdServer->user; + $this->updateServerDetails(); $this->currentState = 'validate-server'; } + private function updateServerDetails() + { + if ($this->createdServer) { + $this->remoteServerPort = $this->createdServer->port; + $this->remoteServerUser = $this->createdServer->user; + } + } + public function getProxyType() { // Set Default Proxy Type @@ -367,23 +375,12 @@ uZx9iFkCELtxrh31QJ68AAAAEXNhaWxANzZmZjY2ZDJlMmRkAQIDBA== 'remoteServerUser' => 'required|string', ]); - if (!$this->createdServer) { - $this->createdServer = Server::create([ - 'name' => $this->remoteServerName ?? 'New Server', - 'ip' => $this->remoteServerHost, - 'port' => $this->remoteServerPort, - 'user' => $this->remoteServerUser, - 'team_id' => currentTeam()->id, + $this->createdServer->update([ + 'name' => $this->remoteServerName, + 'port' => $this->remoteServerPort, + 'user' => $this->remoteServerUser, 'timezone' => 'UTC', ]); - } else { - $this->createdServer->update([ - 'port' => $this->remoteServerPort, - 'user' => $this->remoteServerUser, - 'timezone' => 'UTC', - ]); - } - $this->validateServer(); } diff --git a/resources/views/livewire/boarding/index.blade.php b/resources/views/livewire/boarding/index.blade.php index 4b1da05da..c826e7b98 100644 --- a/resources/views/livewire/boarding/index.blade.php +++ b/resources/views/livewire/boarding/index.blade.php @@ -64,9 +64,9 @@

Please check the connection details below and correct them if they are incorrect.

- +
- +

Non-root user is experimental: docs @@ -147,11 +147,7 @@

- No - (create - one - for - me) + No (create one for me)
@@ -167,18 +163,39 @@
@if (!$serverReachable) - This server is not reachable with the following public key. -

- Please make sure you have the correct public key in your ~/.ssh/authorized_keys file for - user or skip the boarding process and add a new private key manually to Coolify and to the - server. -
- Check this documentation for further - help. - - Check - again - +
+

Server is not reachable

+

Please check the connection details below and correct them if they are incorrect.

+ +
+ +
+ +

+ Non-root user is experimental: + docs +

+
+
+ +
+

If the connection details are correct, please ensure:

+
    +
  • The correct public key is in your ~/.ssh/authorized_keys file for the specified user
  • +
  • Or skip the boarding process and manually add a new private key to Coolify and the server
  • +
+
+ +

+ For more help, check this documentation. +

+ + + + + Check again + +
@endif @@ -225,27 +242,27 @@
- - + +
- +
- +
- +
Non-root user is experimental: docs.
- +
Continue
From d378bb94bea40dd7208df12390989577bbbee0d0 Mon Sep 17 00:00:00 2001 From: peaklabs-dev <122374094+peaklabs-dev@users.noreply.github.com> Date: Tue, 10 Sep 2024 17:29:53 +0200 Subject: [PATCH 09/16] Fix: remote servers with port and user --- app/Livewire/Boarding/Index.php | 11 ++++++----- app/Models/Server.php | 11 ++++++----- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/app/Livewire/Boarding/Index.php b/app/Livewire/Boarding/Index.php index 9503da499..514f00c3a 100644 --- a/app/Livewire/Boarding/Index.php +++ b/app/Livewire/Boarding/Index.php @@ -247,11 +247,12 @@ uZx9iFkCELtxrh31QJ68AAAAEXNhaWxANzZmZjY2ZDJlMmRkAQIDBA== public function saveServer() { $this->validate([ - 'remoteServerName' => 'required', - 'remoteServerHost' => 'required', + 'remoteServerName' => 'required|string', + 'remoteServerHost' => 'required|string', 'remoteServerPort' => 'required|integer', - 'remoteServerUser' => 'required', + 'remoteServerUser' => 'required|string', ]); + $this->privateKey = formatPrivateKey($this->privateKey); $foundServer = Server::whereIp($this->remoteServerHost)->first(); if ($foundServer) { @@ -379,8 +380,8 @@ uZx9iFkCELtxrh31QJ68AAAAEXNhaWxANzZmZjY2ZDJlMmRkAQIDBA== 'name' => $this->remoteServerName, 'port' => $this->remoteServerPort, 'user' => $this->remoteServerUser, - 'timezone' => 'UTC', - ]); + 'timezone' => 'UTC', + ]); $this->validateServer(); } diff --git a/app/Models/Server.php b/app/Models/Server.php index d30cdc9d6..46536ed47 100644 --- a/app/Models/Server.php +++ b/app/Models/Server.php @@ -113,8 +113,13 @@ class Server extends BaseModel ]; protected $fillable = [ + 'name', + 'ip', 'port', 'user', + 'description', + 'private_key_id', + 'team_id', ]; protected $guarded = []; @@ -148,11 +153,7 @@ class Server extends BaseModel public function settings() { - return $this->hasOne(ServerSetting::class)->withDefault([ - 'force_disabled' => false, - 'is_reachable' => false, - 'is_usable' => false, - ]); + return $this->hasOne(ServerSetting::class); } public function setupDefault404Redirect() From 2c9491d81c684380d072f663703d6aa61126a1f7 Mon Sep 17 00:00:00 2001 From: peaklabs-dev <122374094+peaklabs-dev@users.noreply.github.com> Date: Tue, 10 Sep 2024 17:43:16 +0200 Subject: [PATCH 10/16] Fix: Do not change localhost server name on revalidation --- app/Livewire/Boarding/Index.php | 1 - 1 file changed, 1 deletion(-) diff --git a/app/Livewire/Boarding/Index.php b/app/Livewire/Boarding/Index.php index 514f00c3a..7f913b79c 100644 --- a/app/Livewire/Boarding/Index.php +++ b/app/Livewire/Boarding/Index.php @@ -377,7 +377,6 @@ uZx9iFkCELtxrh31QJ68AAAAEXNhaWxANzZmZjY2ZDJlMmRkAQIDBA== ]); $this->createdServer->update([ - 'name' => $this->remoteServerName, 'port' => $this->remoteServerPort, 'user' => $this->remoteServerUser, 'timezone' => 'UTC', From 826b64d056c3c7083af9600d65903d1e5efd01a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Valentinas=20=C4=8Cirba?= Date: Wed, 11 Sep 2024 07:57:16 +0300 Subject: [PATCH 11/16] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c3412be14..14a741088 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,7 @@ Special thanks to our biggest sponsors! * [Latitude](https://latitude.sh/?ref=coolify.io) - A cloud computing platform offering bare metal servers and cloud instances for developers and businesses. * [Brand Dev](https://brand.dev/?ref=coolify.io) - A web development agency specializing in creating custom digital experiences and brand identities. * [Jobscollider](https://jobscollider.com/remote-jobs?ref=coolify.io) - A job search platform connecting professionals with remote work opportunities across various industries. -* [Hostinger](https://hostinger.com?ref=coolify.io) - A web hosting provider offering affordable hosting solutions, domain registration, and website building tools. +* [Hostinger](https://www.hostinger.com/vps/coolify-hosting?ref=coolify.io) - A web hosting provider offering affordable hosting solutions, domain registration, and website building tools. * [Glueops](https://www.glueops.dev/?ref=coolify.io) - A DevOps consulting company providing infrastructure automation and cloud optimization services. * [Ubicloud](https://ubicloud.com/?ref=coolify.io) - An open-source alternative to hyperscale cloud providers, offering high-performance cloud computing services. * [Juxtdigital](https://juxtdigital.dev/?ref=coolify.io) - A digital agency offering web development, design, and digital marketing services for businesses. From f1a1deff26b7a700614f2eadc2e97f46d043f45d Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Wed, 11 Sep 2024 10:21:18 +0200 Subject: [PATCH 12/16] fix: Disable mux_enabled during server validation --- app/Livewire/Boarding/Index.php | 4 +- .../views/livewire/boarding/index.blade.php | 338 ++++++++++-------- 2 files changed, 194 insertions(+), 148 deletions(-) diff --git a/app/Livewire/Boarding/Index.php b/app/Livewire/Boarding/Index.php index 7f913b79c..0bfcaf729 100644 --- a/app/Livewire/Boarding/Index.php +++ b/app/Livewire/Boarding/Index.php @@ -282,7 +282,7 @@ uZx9iFkCELtxrh31QJ68AAAAEXNhaWxANzZmZjY2ZDJlMmRkAQIDBA== public function validateServer() { try { - config()->set('coolify.mux_enabled', true); + config()->set('coolify.mux_enabled', false); // EC2 does not have `uptime` command, lol instant_remote_process(['ls /'], $this->createdServer, true); @@ -296,7 +296,6 @@ uZx9iFkCELtxrh31QJ68AAAAEXNhaWxANzZmZjY2ZDJlMmRkAQIDBA== $this->createdServer->settings()->update([ 'is_reachable' => false, ]); - return handleError(error: $e, livewire: $this); } @@ -316,6 +315,7 @@ uZx9iFkCELtxrh31QJ68AAAAEXNhaWxANzZmZjY2ZDJlMmRkAQIDBA== $this->createdServer->settings()->update([ 'is_usable' => false, ]); + return handleError(error: $e, livewire: $this); } } diff --git a/resources/views/livewire/boarding/index.blade.php b/resources/views/livewire/boarding/index.blade.php index c826e7b98..7b7ef8c12 100644 --- a/resources/views/livewire/boarding/index.blade.php +++ b/resources/views/livewire/boarding/index.blade.php @@ -1,18 +1,20 @@ @php use App\Enums\ProxyTypes; @endphp Onboarding | Coolify - -
-
- @if ($currentState === 'welcome') + +
+
+ @if ($currentState === 'welcome')

Welcome to Coolify

Let me help you set up the basics.
- Get + Get Started
- @elseif ($currentState === 'explanation') + @elseif ($currentState === 'explanation') Coolify is an all-in-one application to automate tasks on your servers, deploy application with @@ -29,21 +31,24 @@

You don't need to manage your servers anymore. Coolify does - it for you.

+ it for you. +

All configurations are stored on your servers, so - everything works without a connection to Coolify (except integrations and automations).

+ everything works without a connection to Coolify (except integrations and automations). +

You can get notified on your favourite platforms (Discord, - Telegram, Email, etc.) when something goes wrong, or an action is needed from your side.

+ Telegram, Email, etc.) when something goes wrong, or an action is needed from your side. +

- Next + Next
- @elseif ($currentState === 'select-server-type') + @elseif ($currentState === 'select-server-type') Do you want to deploy your resources to your @@ -52,46 +57,57 @@ ? - Localhost + Localhost - Remote Server + Remote Server @if (!$serverReachable) -
-

Server is not reachable

-

Please check the connection details below and correct them if they are incorrect.

+
+

Server is not reachable

+

Please check the connection details below and correct them if they are + incorrect.

-
- -
- -

- Non-root user is experimental: - docs -

+
+ +
+ +

+ Non-root user is experimental: + docs +

+
+ +
+

If the connection details are correct, please ensure:

+
    +
  • The correct public key is in your ~/.ssh/authorized_keys + file for the specified user
  • +
  • Or skip the boarding process and manually add a new private key to Coolify and + the server
  • +
+
+ +

+ For more help, check this documentation. +

+ + + + + Check Again +
- -
-

If the connection details are correct, please ensure:

-
    -
  • The correct public key is in your ~/.ssh/authorized_keys file for the specified user
  • -
  • Or skip the boarding process and manually add a new private key to Coolify and the server
  • -
-
- -

- For more help, check this documentation. -

- - - - - Check again - -
@endif @@ -101,33 +117,37 @@

is the server where Coolify is running on. It is not recommended to use one server - for everything.

+ for everything. +

is a server reachable through SSH. It can be hosted at home, or from any cloud - provider.

+ provider. +

- @elseif ($currentState === 'private-key') + @elseif ($currentState === 'private-key') Do you have your own SSH Private Key? - Yes + Yes - No (create one for me) + No (create one for me) @if (count($privateKeys) > 0) -
- - @foreach ($privateKeys as $privateKey) - - @endforeach - - Use this SSH Key -
+
+ + @foreach ($privateKeys as $privateKey) + + @endforeach + + Use this SSH Key +
@endif
@@ -139,7 +159,7 @@

- @elseif ($currentState === 'select-existing-server') + @elseif ($currentState === 'select-existing-server') There are already servers available for your Team. Do you want to use one of them? @@ -147,15 +167,16 @@
- No (create one for me) + No + (create one for me)
@foreach ($servers as $server) - + @endforeach Use this Server @@ -163,39 +184,48 @@
@if (!$serverReachable) -
-

Server is not reachable

-

Please check the connection details below and correct them if they are incorrect.

+
+

Server is not reachable

+

Please check the connection details below and correct them if they are + incorrect.

-
- -
- -

- Non-root user is experimental: - docs -

+
+ +
+ +

+ Non-root user is experimental: + docs +

+
+ +
+

If the connection details are correct, please ensure:

+
    +
  • The correct public key is in your ~/.ssh/authorized_keys + file for the specified user
  • +
  • Or skip the boarding process and manually add a new private key to Coolify and + the server
  • +
+
+ +

+ For more help, check this documentation. +

+ + + + + Check again +
- -
-

If the connection details are correct, please ensure:

-
    -
  • The correct public key is in your ~/.ssh/authorized_keys file for the specified user
  • -
  • Or skip the boarding process and manually add a new private key to Coolify and the server
  • -
-
- -

- For more help, check this documentation. -

- - - - - Check again - -
@endif @@ -206,22 +236,25 @@

- @elseif ($currentState === 'create-private-key') + @elseif ($currentState === 'create-private-key') Please let me know your key details. - - - + + + @if ($privateKeyType === 'create') - - ACTION REQUIRED: Copy the 'Public Key' to your - server's - ~/.ssh/authorized_keys - file. + + ACTION REQUIRED: Copy the 'Public Key' to your + server's + ~/.ssh/authorized_keys + file. @endif Save @@ -234,7 +267,7 @@

- @elseif ($currentState === 'create-server') + @elseif ($currentState === 'create-server') Please let me know your server details. @@ -242,33 +275,44 @@
- - + +
- +
-
- +
- -
Non-root user is experimental: docs. + +
Non-root user is + experimental: docs.
- +
Continue - @elseif ($currentState === 'validate-server') + @elseif ($currentState === 'validate-server') I need to validate your server (connection, Docker Engine, etc) and configure if something is @@ -280,7 +324,8 @@ - + Let's do it! @@ -289,19 +334,20 @@

This will install the latest Docker Engine on your server, configure a few things to be able to run optimal.

Minimum Docker Engine version is: 22

To manually install Docker - Engine, check this + Engine, check this documentation.

- @elseif ($currentState === 'create-project') + @elseif ($currentState === 'create-project') @if (count($projects) > 0) - You already have some projects. Do you want to use one of them or should I create a new one - for - you? + You already have some projects. Do you want to use one of them or should I create a new one + for + you? @else - Let's create an initial project for you. You can change all the details later on. + Let's create an initial project for you. You can change all the details later on. @endif @@ -309,15 +355,15 @@ project!
@if (count($projects) > 0) -
- - @foreach ($projects as $project) - - @endforeach - - Use this Project -
+
+ + @foreach ($projects as $project) + + @endforeach + + Use this Project +
@endif
@@ -328,7 +374,7 @@ staging version of the same application, but grouped separately.

- @elseif ($currentState === 'create-resource') + @elseif ($currentState === 'create-resource') Let's go to the new resource page, where you can create your first resource. @@ -341,23 +387,23 @@

A resource could be an application, a database or a service (like WordPress).

- @endif + @endif +
+
+
+
Skip + onboarding
+
Restart + onboarding
-
-
-
Skip - onboarding
-
Restart - onboarding
-
- - -
- Feedback -
-
- -
-
-
-
+ + +
+ Feedback +
+
+ +
+
+
From 5d476e39249be05e575e596acc4e3e6bd2be64b6 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Wed, 11 Sep 2024 14:23:19 +0200 Subject: [PATCH 13/16] chore: Update server check job middleware to use server ID instead of UUID --- app/Jobs/ServerCheckJob.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Jobs/ServerCheckJob.php b/app/Jobs/ServerCheckJob.php index f7b54cd80..540085385 100644 --- a/app/Jobs/ServerCheckJob.php +++ b/app/Jobs/ServerCheckJob.php @@ -47,12 +47,12 @@ class ServerCheckJob implements ShouldBeEncrypted, ShouldQueue public function middleware(): array { - return [(new WithoutOverlapping($this->server->uuid))]; + return [(new WithoutOverlapping($this->server->id))]; } public function uniqueId(): int { - return $this->server->uuid; + return $this->server->id; } public function handle() From b145691e1e7a1116a8d98a3ff84a330d8ebd2b76 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Wed, 11 Sep 2024 14:25:16 +0200 Subject: [PATCH 14/16] chore: Add reminder to backup .env file before running install script again --- scripts/install.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/install.sh b/scripts/install.sh index c7cfc0309..843c260a1 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -405,3 +405,6 @@ echo "Waiting for 20 seconds for Coolify to be ready..." sleep 20 echo "Please visit http://$(curl -4s https://ifconfig.io):8000 to get started." echo -e "\nCongratulations! Your Coolify instance is ready to use.\n" + +echo -e "Make sure you backup your .env file before running this script again.\n" +echo -e "You can find it in /data/coolify/source/.env\n" From bc13ad6b821cbd3d4ec87e1b3a361cea5dd5cd7f Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Wed, 11 Sep 2024 14:25:40 +0200 Subject: [PATCH 15/16] chore: Copy .env file to backup location during installation script --- scripts/install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/install.sh b/scripts/install.sh index 843c260a1..d9e570c58 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -406,5 +406,5 @@ sleep 20 echo "Please visit http://$(curl -4s https://ifconfig.io):8000 to get started." echo -e "\nCongratulations! Your Coolify instance is ready to use.\n" -echo -e "Make sure you backup your .env file before running this script again.\n" -echo -e "You can find it in /data/coolify/source/.env\n" +cp /data/coolify/source/.env /data/coolify/source/.env.backup +echo -e "Your .env file has been copied to /data/coolify/source/.env.backup\n" From 72f01185067201f34345ec1d21609562a0ff4e10 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Wed, 11 Sep 2024 14:26:10 +0200 Subject: [PATCH 16/16] chore: Add reminder to backup .env file during installation script --- scripts/install.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/install.sh b/scripts/install.sh index d9e570c58..648f78da0 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -406,5 +406,6 @@ sleep 20 echo "Please visit http://$(curl -4s https://ifconfig.io):8000 to get started." echo -e "\nCongratulations! Your Coolify instance is ready to use.\n" +echo -e "Make sure you backup your /data/coolify/source/.env file to a safe location, outside of this server.\n" cp /data/coolify/source/.env /data/coolify/source/.env.backup echo -e "Your .env file has been copied to /data/coolify/source/.env.backup\n"