This commit is contained in:
Andras Bacsai 2023-04-27 14:45:45 +02:00
parent d51167d770
commit 4435563f1e
3 changed files with 33 additions and 18 deletions

16
.env.production.example Normal file
View File

@ -0,0 +1,16 @@
APP_NAME=Coolify
APP_SERVICE=php
APP_ENV=local
APP_KEY=
APP_DEBUG=false
APP_URL=http://localhost
APP_PORT=3000
DB_CONNECTION=pgsql
DB_HOST=postgres
DB_PORT=5432
DB_DATABASE=coolify
DB_USERNAME=
DB_PASSWORD=
QUEUE_CONNECTION=database

View File

@ -1,4 +1,7 @@
#!/bin/bash #!/bin/bash
## Do not modify this file. You will lost the ability to installation and autoupdate!
VERSION="0.1.0"
if [ "$EUID" -ne 0 ]; then if [ "$EUID" -ne 0 ]; then
echo "Please run as root" echo "Please run as root"
exit exit
@ -23,29 +26,22 @@ mkdir -p /data/coolify/source
chown -R 9999:root /data chown -R 9999:root /data
chmod -R 700 /data chmod -R 700 /data
echo "Downloading docker-compose.yml..." echo "Downloading required files from GitHub..."
curl -fsSL https://raw.githubusercontent.com/coollabsio/coolify/${COOLIFY_VERSION_BRANCH}/docker-compose.yml -o /data/coolify/source/docker-compose.yml curl -fsSL https://raw.githubusercontent.com/coollabsio/coolify/${COOLIFY_VERSION_BRANCH}/docker-compose.yml -o /data/coolify/source/docker-compose.yml
echo "docker-compose.yml downloaded successfully"
echo "Downloading docker-compose.prod.yml..."
curl -fsSL https://raw.githubusercontent.com/coollabsio/coolify/${COOLIFY_VERSION_BRANCH}/docker-compose.prod.yml -o /data/coolify/source/docker-compose.prod.yml curl -fsSL https://raw.githubusercontent.com/coollabsio/coolify/${COOLIFY_VERSION_BRANCH}/docker-compose.prod.yml -o /data/coolify/source/docker-compose.prod.yml
echo "docker-compose.prod.yml downloaded successfully" curl -fsSL https://raw.githubusercontent.com/coollabsio/coolify/${COOLIFY_VERSION_BRANCH}/.env.production.example -o /data/coolify/source/.env.production.example
curl -fsSL https://raw.githubusercontent.com/coollabsio/coolify/v4/scripts/upgrade.sh -o /data/coolify/source/upgrade.sh
echo "Downloading .env.example..."
curl -fsSL https://raw.githubusercontent.com/coollabsio/coolify/${COOLIFY_VERSION_BRANCH}/.env.example -o /data/coolify/source/.env.example
echo ".env.example downloaded successfully"
# Copy .env.example if .env does not exist # Copy .env.example if .env does not exist
if [ ! -f /data/coolify/source/.env ]; then if [ ! -f /data/coolify/source/.env ]; then
cp /data/coolify/source/.env.example /data/coolify/source/.env cp /data/coolify/source/.env.production.example /data/coolify/source/.env
sed -i 's/APP_ENV=.*/APP_ENV=production/g' /data/coolify/source/.env
sed -i 's/APP_DEBUG=.*/APP_DEBUG=false/g' /data/coolify/source/.env
sed -i "s|APP_KEY=.*|APP_KEY=base64:$(openssl rand -base64 32)|g" /data/coolify/source/.env sed -i "s|APP_KEY=.*|APP_KEY=base64:$(openssl rand -base64 32)|g" /data/coolify/source/.env
sed -i "s|DB_PASSWORD=.*|DB_PASSWORD=$(openssl rand -base64 32)|g" /data/coolify/source/.env sed -i "s|DB_PASSWORD=.*|DB_PASSWORD=$(openssl rand -base64 32)|g" /data/coolify/source/.env
fi fi
# Generate an ssh key (ed25519) at /data/coolify/ssh-keys/id.root@host.docker.internal # Generate an ssh key (ed25519) at /data/coolify/ssh-keys/id.root@host.docker.internal
if [ ! -f /data/coolify/ssh-keys/id.root@host.docker.internal ]; then if [ ! -f /data/coolify/ssh-keys/id.root@host.docker.internal ]; then
# Add date to the end of the key to prevent collisions
ssh-keygen -t ed25519 -f /data/coolify/ssh-keys/id.root@host.docker.internal -q -N "" -C root@coolify ssh-keygen -t ed25519 -f /data/coolify/ssh-keys/id.root@host.docker.internal -q -N "" -C root@coolify
chown 9999 /data/coolify/ssh-keys/id.root@host.docker.internal chown 9999 /data/coolify/ssh-keys/id.root@host.docker.internal
fi fi
@ -55,18 +51,15 @@ addSshKey() {
chmod 600 ~/.ssh/authorized_keys chmod 600 ~/.ssh/authorized_keys
} }
if [ ! -d ~/.ssh ]; then if [ ! -f ~/.ssh/authorized_keys ]; then
mkdir -p ~/.ssh mkdir -p ~/.ssh
chmod 700 ~/.ssh chmod 700 ~/.ssh
touch ~/.ssh/authorized_keys touch ~/.ssh/authorized_keys
addSshKey addSshKey
fi fi
if [ ! -f ~/.ssh/authorized_keys ]; then
touch ~/.ssh/authorized_keys
addSshKey
fi
if [ -z "$(grep -w "root@coolify" ~/.ssh/authorized_keys)" ]; then if [ -z "$(grep -w "root@coolify" ~/.ssh/authorized_keys)" ]; then
addSshKey addSshKey
fi fi
docker compose --env-file /data/coolify/source/.env -f /data/coolify/source/docker-compose.yml -f /data/coolify/source/docker-compose.prod.yml up --pull always bash /data/coolify/source/upgrade.sh

View File

@ -1,4 +1,10 @@
#!/bin/bash #!/bin/bash
## Do not modify this file. You will lost the ability to autoupdate! ## Do not modify this file. You will lost the ability to autoupdate!
VERSION="0.1.0"
if [ "$EUID" -ne 0 ]; then
echo "Please run as root"
exit
fi
docker run --pull always -v /data/coolify/source:/data/coolify/source -v /var/run/docker.sock:/var/run/docker.sock --rm ghcr.io/coollabsio/coolify-builder bash -c "APP_TAG=${1:-} docker compose --env-file /data/coolify/source/.env -f /data/coolify/source/docker-compose.yml -f /data/coolify/source/docker-compose.prod.yml up -d --pull always --remove-orphans --force-recreate" docker run --pull always -v /data/coolify/source:/data/coolify/source -v /var/run/docker.sock:/var/run/docker.sock --rm ghcr.io/coollabsio/coolify-builder bash -c "APP_TAG=${1:-} docker compose --env-file /data/coolify/source/.env -f /data/coolify/source/docker-compose.yml -f /data/coolify/source/docker-compose.prod.yml up -d --pull always --remove-orphans --force-recreate"