Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

refactor: Update OS_TYPE for Asahi Linux in install.sh script

Andras Bacsaiaa28c9982791
diff --git a/other/nightly/install.sh b/other/nightly/install.sh
index 020e7d45ba..feb97295a9 100755
--- a/other/nightly/install.sh
+++ b/other/nightly/install.sh
@@ -8,7 +8,7 @@ set -o pipefail # Cause a pipeline to return the status of the last command that
CDN="https://cdn.coollabs.io/coolify-nightly"
DATE=$(date +"%Y%m%d-%H%M%S")
-VERSION="1.5"
+VERSION="1.6"
DOCKER_VERSION="26.0"
# TODO: Ask for a user
CURRENT_USER=$USER
@@ -39,6 +39,11 @@ if [ "$OS_TYPE" = "manjaro" ] || [ "$OS_TYPE" = "manjaro-arm" ]; then
OS_TYPE="arch"
fi
+# Check if the OS is Asahi Linux, if so, change it to fedora
+if [ "$OS_TYPE" = "fedora-asahi-remix" ]; then
+ OS_TYPE="fedora"
+fi
+
# Check if the OS is popOS, if so, change it to ubuntu
if [ "$OS_TYPE" = "pop" ]; then
OS_TYPE="ubuntu"
diff --git a/scripts/install.sh b/scripts/install.sh
index 5ca488729a..7b1d0c2832 100755
--- a/scripts/install.sh
+++ b/scripts/install.sh
@@ -10,6 +10,8 @@ DATE=$(date +"%Y%m%d-%H%M%S")
VERSION="1.6"
DOCKER_VERSION="26.0"
+# TODO: Ask for a user
+CURRENT_USER=$USER
mkdir -p /data/coolify/{source,ssh,applications,databases,backups,services,proxy,webhooks-during-maintenance,metrics,logs}
mkdir -p /data/coolify/ssh/{keys,mux}
@@ -401,88 +403,18 @@ if [ ! -f ~/.ssh/authorized_keys ]; then
chmod 600 ~/.ssh/authorized_keys
fi
-checkSshKeyInAuthorizedKeys() {
- grep -qw "root@coolify" ~/.ssh/authorized_keys
- return $?
-}
-
-checkSshKeyInCoolifyData() {
- [ -s /data/coolify/ssh/keys/[email protected] ]
- return $?
-}
+set +e
+IS_COOLIFY_VOLUME_EXISTS=$(docker volume ls | grep coolify-db | wc -l)
+set -e
-generateAuthorizedKeys() {
- sed -i "/root@coolify/d" ~/.ssh/authorized_keys
- cat /data/coolify/ssh/keys/[email protected] >> ~/.ssh/authorized_keys
- rm -f /data/coolify/ssh/keys/[email protected]
-}
-generateSshKey() {
+if [ "$IS_COOLIFY_VOLUME_EXISTS" -eq 0 ]; then
echo " - Generating SSH key."
- ssh-keygen -t ed25519 -a 100 -f /data/coolify/ssh/keys/[email protected] -q -N "" -C root@coolify
- chown 9999 /data/coolify/ssh/keys/[email protected]
- generateAuthorizedKeys
-}
-
-syncSshKeys() {
- DB_RUNNING=$(docker inspect coolify-db --format '{{ .State.Status }}' 2>/dev/null)
- # Check if SSH key exists in Coolify data but not in authorized_keys
- if checkSshKeyInCoolifyData && ! checkSshKeyInAuthorizedKeys; then
- # Add the existing Coolify SSH key to authorized_keys
- cat /data/coolify/ssh/keys/[email protected] >> ~/.ssh/authorized_keys
- # Check if SSH key exists in authorized_keys but not in Coolify data
- elif checkSshKeyInAuthorizedKeys && ! checkSshKeyInCoolifyData; then
- # Ensure Coolify DB is running before proceeding
- if [ "$DB_RUNNING" = "running" ]; then
- # Retrieve DB user and SSH key from Coolify database
- DB_USER=$(docker inspect coolify-db --format '{{ .Config.Env }}' | grep -oP 'POSTGRES_USER=\K[^ ]+')
- DB_SSH_KEY=$(docker exec coolify-db psql -U $DB_USER -d coolify -t -c "SELECT \"private_key\" FROM \"private_keys\" WHERE id = 0 AND team_id = 0 LIMIT 1;" -A -t)
-
- if [ -z "$DB_SSH_KEY" ]; then
- # If no key found in DB, generate a new one
- echo " - SSH key not found in database. Generating new key."
- generateSshKey
- else
- # If key found in DB, save it and update authorized_keys
- echo " - SSH key found in database. Saving to file."
- echo "$DB_SSH_KEY" > /data/coolify/ssh/keys/[email protected]
- chmod 600 /data/coolify/ssh/keys/[email protected]
- chown 9999 /data/coolify/ssh/keys/[email protected]
-
- # Generate public key from private key and update authorized_keys
- ssh-keygen -y -f /data/coolify/ssh/keys/[email protected] -C root@coolify > /data/coolify/ssh/keys/[email protected]
- sed -i "/root@coolify/d" ~/.ssh/authorized_keys
- cat /data/coolify/ssh/keys/[email protected] >> ~/.ssh/authorized_keys
- rm -f /data/coolify/ssh/keys/[email protected]
- chmod 600 ~/.ssh/authorized_keys
- fi
- fi
- # If SSH key doesn't exist in either location
- elif ! checkSshKeyInAuthorizedKeys && ! checkSshKeyInCoolifyData; then
- # Ensure Coolify DB is running before proceeding
- if [ "$DB_RUNNING" = "running" ]; then
- # Retrieve DB user and SSH key from Coolify database
- DB_USER=$(docker inspect coolify-db --format '{{ .Config.Env }}' | grep -oP 'POSTGRES_USER=\K[^ ]+')
- DB_SSH_KEY=$(docker exec coolify-db psql -U $DB_USER -d coolify -t -c "SELECT \"private_key\" FROM \"private_keys\" WHERE id = 0 AND team_id = 0 LIMIT 1;" -A -t)
- if [ -z "$DB_SSH_KEY" ]; then
- # If no key found in DB, generate a new one
- echo " - SSH key not found in database. Generating new key."
- generateSshKey
- else
- # If key found in DB, save it and update authorized_keys
- echo " - SSH key found in database. Saving to file."
- echo "$DB_SSH_KEY" > /data/coolify/ssh/keys/[email protected]
- chmod 600 /data/coolify/ssh/keys/[email protected]
- ssh-keygen -y -f /data/coolify/ssh/keys/[email protected] -C root@coolify > /data/coolify/ssh/keys/[email protected]
- sed -i "/root@coolify/d" ~/.ssh/authorized_keys
- cat /data/coolify/ssh/keys/[email protected] >> ~/.ssh/authorized_keys
- fi
- else
- generateSshKey
- fi
- fi
-}
-
-syncSshKeys || true
+ ssh-keygen -t ed25519 -a 100 -f /data/coolify/ssh/keys/[email protected] -q -N "" -C coolify
+ chown 9999 /data/coolify/ssh/keys/[email protected]
+ sed -i "/coolify/d" ~/.ssh/authorized_keys
+ cat /data/coolify/ssh/keys/[email protected] >> ~/.ssh/authorized_keys
+ rm -f /data/coolify/ssh/keys/[email protected]
+fi
chown -R 9999:root /data/coolify
chmod -R 700 /data/coolify