diff --git a/config/constants.php b/config/constants.php index 537fbfc6c..1aff0b787 100644 --- a/config/constants.php +++ b/config/constants.php @@ -2,7 +2,7 @@ return [ 'coolify' => [ - 'version' => '4.0.0-beta.381', + 'version' => '4.0.0-beta.382', 'self_hosted' => env('SELF_HOSTED', true), 'autoupdate' => env('AUTOUPDATE'), 'base_config_path' => env('BASE_CONFIG_PATH', '/data/coolify'), diff --git a/database/seeders/ProductionSeeder.php b/database/seeders/ProductionSeeder.php index ecf840c1e..8574ee846 100644 --- a/database/seeders/ProductionSeeder.php +++ b/database/seeders/ProductionSeeder.php @@ -46,8 +46,6 @@ class ProductionSeeder extends Seeder ]); } - $this->call(RootUserSeeder::class); - if (GithubApp::find(0) == null) { GithubApp::create([ 'id' => 0, @@ -190,5 +188,6 @@ uZx9iFkCELtxrh31QJ68AAAAEXNhaWxANzZmZjY2ZDJlMmRkAQIDBA== $this->call(OauthSettingSeeder::class); $this->call(PopulateSshKeysDirectorySeeder::class); $this->call(SentinelSeeder::class); + $this->call(RootUserSeeder::class); } } diff --git a/other/nightly/install.sh b/other/nightly/install.sh index def105aa7..766b1fc63 100755 --- a/other/nightly/install.sh +++ b/other/nightly/install.sh @@ -5,7 +5,7 @@ set -e # Exit immediately if a command exits with a non-zero status ## $1 could be empty, so we need to disable this check #set -u # Treat unset variables as an error and exit set -o pipefail # Cause a pipeline to return the status of the last command that exited with a non-zero status -CDN="https://cdn.coollabs.io/coolify-nightly" +CDN="https://cdn.coollabs.io/coolify" DATE=$(date +"%Y%m%d-%H%M%S") VERSION="1.6" @@ -22,6 +22,11 @@ echo -e "Welcome to Coolify Installer!" echo -e "This script will install everything for you. Sit back and relax." echo -e "Source code: https://github.com/coollabsio/coolify/blob/main/scripts/install.sh\n" +# Predefined root user +ROOT_USERNAME=${ROOT_USERNAME:-} +ROOT_USER_EMAIL=${ROOT_USER_EMAIL:-} +ROOT_USER_PASSWORD=${ROOT_USER_PASSWORD:-} + TOTAL_SPACE=$(df -BG / | awk 'NR==2 {print $2}' | sed 's/G//') AVAILABLE_SPACE=$(df -BG / | awk 'NR==2 {print $4}' | sed 's/G//') REQUIRED_TOTAL_SPACE=30 @@ -481,6 +486,19 @@ else sed -i "s|^PUSHER_APP_SECRET=.*|PUSHER_APP_SECRET=$(openssl rand -hex 32)|" "$ENV_FILE-$DATE" fi +# Add default root user credentials from environment variables +if [ -n "$ROOT_USERNAME" ] && [ -n "$ROOT_USER_EMAIL" ] && [ -n "$ROOT_USER_PASSWORD" ]; then + if ! grep -q "^ROOT_USERNAME=" "$ENV_FILE-$DATE"; then + sed -i "s|^ROOT_USERNAME=.*|ROOT_USERNAME=$ROOT_USERNAME|" "$ENV_FILE-$DATE" + fi + if ! grep -q "^ROOT_USER_EMAIL=" "$ENV_FILE-$DATE"; then + sed -i "s|^ROOT_USER_EMAIL=.*|ROOT_USER_EMAIL=$ROOT_USER_EMAIL|" "$ENV_FILE-$DATE" + fi + if ! grep -q "^ROOT_USER_PASSWORD=" "$ENV_FILE-$DATE"; then + sed -i "s|^ROOT_USER_PASSWORD=.*|ROOT_USER_PASSWORD=$ROOT_USER_PASSWORD|" "$ENV_FILE-$DATE" + fi +fi + # Merge .env and .env.production. New values will be added to .env echo -e "7. Propagating .env with new values - if necessary." awk -F '=' '!seen[$1]++' "$ENV_FILE-$DATE" /data/coolify/source/.env.production > $ENV_FILE @@ -542,7 +560,7 @@ echo -e "You can access Coolify through your Public IP: http://$(curl -4s https: set +e DEFAULT_PRIVATE_IP=$(ip route get 1 | sed -n 's/^.*src \([0-9.]*\) .*$/\1/p') -PRIVATE_IPS=$(hostname -I) +PRIVATE_IPS=$(hostname -I 2>/dev/null || ip -o addr show scope global | awk '{print $4}' | cut -d/ -f1) set -e if [ -n "$PRIVATE_IPS" ]; then diff --git a/other/nightly/versions.json b/other/nightly/versions.json index 2d96743f4..f8214d091 100644 --- a/other/nightly/versions.json +++ b/other/nightly/versions.json @@ -1,10 +1,10 @@ { "coolify": { "v4": { - "version": "4.0.0-beta.378" + "version": "4.0.0-beta.382" }, "nightly": { - "version": "4.0.0-beta.379" + "version": "4.0.0-beta.383" }, "helper": { "version": "1.0.4" diff --git a/versions.json b/versions.json index c94c15901..f8214d091 100644 --- a/versions.json +++ b/versions.json @@ -1,10 +1,10 @@ { "coolify": { "v4": { - "version": "4.0.0-beta.381" + "version": "4.0.0-beta.382" }, "nightly": { - "version": "4.0.0-beta.382" + "version": "4.0.0-beta.383" }, "helper": { "version": "1.0.4"