cleanup instalation

This commit is contained in:
ayntk-ai
2024-08-07 14:59:42 +02:00
parent 4336acc16e
commit ddf0ff8f25
5 changed files with 41 additions and 21 deletions

View File

@@ -1,10 +1,19 @@
# Coolify Configuration
APP_ID= APP_ID=
APP_NAME=Coolify
APP_KEY= APP_KEY=
# PostgreSQL Database Configuration
DB_DATABASE=coolify-db
DB_USERNAME=
DB_PASSWORD= DB_PASSWORD=
# Redis Configuration
REDIS_PASSWORD= REDIS_PASSWORD=
# Pusher Configuration
PUSHER_APP_ID= PUSHER_APP_ID=
PUSHER_APP_KEY= PUSHER_APP_KEY=
PUSHER_APP_SECRET= PUSHER_APP_SECRET=
# Additional Configuration
SELF_HOSTED=true

View File

@@ -13,13 +13,12 @@ services:
- /data/coolify/backups:/var/www/html/storage/app/backups - /data/coolify/backups:/var/www/html/storage/app/backups
- /data/coolify/webhooks-during-maintenance:/var/www/html/storage/app/webhooks-during-maintenance - /data/coolify/webhooks-during-maintenance:/var/www/html/storage/app/webhooks-during-maintenance
environment: environment:
- PHP_MEMORY_LIMIT
- APP_ID
- APP_ENV=production - APP_ENV=production
- APP_DEBUG - APP_NAME=Coolify
- APP_NAME - APP_ID
- APP_KEY - APP_KEY
- APP_URL - APP_URL
- APP_DEBUG
- DB_CONNECTION - DB_CONNECTION
- DB_HOST - DB_HOST
- DB_PORT - DB_PORT
@@ -34,6 +33,7 @@ services:
- HORIZON_BALANCE_MAX_SHIFT - HORIZON_BALANCE_MAX_SHIFT
- HORIZON_BALANCE_COOLDOWN - HORIZON_BALANCE_COOLDOWN
- SSL_MODE=off - SSL_MODE=off
- PHP_MEMORY_LIMIT
- PHP_PM_CONTROL=dynamic - PHP_PM_CONTROL=dynamic
- PHP_PM_START_SERVERS=1 - PHP_PM_START_SERVERS=1
- PHP_PM_MIN_SPARE_SERVERS=1 - PHP_PM_MIN_SPARE_SERVERS=1
@@ -83,20 +83,22 @@ services:
condition: service_healthy condition: service_healthy
redis: redis:
condition: service_healthy condition: service_healthy
soketi:
condition: service_healthy
postgres: postgres:
volumes: volumes:
- coolify-db:/var/lib/postgresql/data - coolify-db:/var/lib/postgresql/data
environment: environment:
POSTGRES_USER: "${DB_USERNAME:-coolify}" POSTGRES_USER: "${DB_USERNAME}"
POSTGRES_PASSWORD: "${DB_PASSWORD}" POSTGRES_PASSWORD: "${DB_PASSWORD}"
POSTGRES_DB: "${DB_DATABASE:-coolify}" POSTGRES_DB: "${DB_DATABASE:-coolify-db}"
healthcheck: healthcheck:
test: test:
[ [
"CMD-SHELL", "CMD-SHELL",
"pg_isready -U ${DB_USERNAME:-coolify}", "pg_isready -U ${DB_USERNAME}",
"-d", "-d",
"${DB_DATABASE:-coolify}" "${DB_DATABASE:-coolify-db}"
] ]
interval: 5s interval: 5s
retries: 10 retries: 10

View File

@@ -71,16 +71,16 @@ services:
volumes: volumes:
- coolify-db:/var/lib/postgresql/data - coolify-db:/var/lib/postgresql/data
environment: environment:
POSTGRES_USER: "${DB_USERNAME:-coolify}" POSTGRES_USER: "${DB_USERNAME}"
POSTGRES_PASSWORD: "${DB_PASSWORD}" POSTGRES_PASSWORD: "${DB_PASSWORD}"
POSTGRES_DB: "${DB_DATABASE:-coolify}" POSTGRES_DB: "${DB_DATABASE:-coolify-db}"
healthcheck: healthcheck:
test: test:
[ [
"CMD-SHELL", "CMD-SHELL",
"pg_isready -U ${DB_USERNAME:-coolify}", "pg_isready -U ${DB_USERNAME}",
"-d", "-d",
"${DB_DATABASE:-coolify}" "${DB_DATABASE:-coolify-db}"
] ]
interval: 5s interval: 5s
retries: 10 retries: 10

View File

@@ -10,6 +10,7 @@ services:
depends_on: depends_on:
- postgres - postgres
- redis - redis
- soketi
postgres: postgres:
image: postgres:15-alpine image: postgres:15-alpine
container_name: coolify-db container_name: coolify-db
@@ -32,4 +33,4 @@ networks:
coolify: coolify:
name: coolify name: coolify
driver: bridge driver: bridge
external: true external: false

View File

@@ -287,13 +287,21 @@ curl -fsSL $CDN/upgrade.sh -o /data/coolify/source/upgrade.sh
# 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.production /data/coolify/source/.env cp /data/coolify/source/.env.production /data/coolify/source/.env
sed -i "s|APP_ID=.*|APP_ID=$(openssl rand -hex 16)|g" /data/coolify/source/.env # Generate a secure APP_ID and APP_KEY
sed -i "s|APP_KEY=.*|APP_KEY=base64:$(openssl rand -base64 32)|g" /data/coolify/source/.env sed -i "s|^APP_ID=.*|APP_ID=$(openssl rand -hex 16)|" "$ENV_FILE"
sed -i "s|DB_PASSWORD=.*|DB_PASSWORD=$(openssl rand -base64 32)|g" /data/coolify/source/.env sed -i "s|^APP_KEY=.*|APP_KEY=base64:$(openssl rand -base64 32)|" "$ENV_FILE"
sed -i "s|REDIS_PASSWORD=.*|REDIS_PASSWORD=$(openssl rand -base64 32)|g" /data/coolify/source/.env
sed -i "s|PUSHER_APP_ID=.*|PUSHER_APP_ID=$(openssl rand -hex 32)|g" /data/coolify/source/.env # Generate a secure Postgres DB username and password
sed -i "s|PUSHER_APP_KEY=.*|PUSHER_APP_KEY=$(openssl rand -hex 32)|g" /data/coolify/source/.env sed -i "s|^DB_USERNAME=.*|DB_USERNAME=$(openssl rand -hex 16)|" "$ENV_FILE"
sed -i "s|PUSHER_APP_SECRET=.*|PUSHER_APP_SECRET=$(openssl rand -hex 32)|g" /data/coolify/source/.env sed -i "s|^DB_PASSWORD=.*|DB_PASSWORD=$(openssl rand -base64 32)|" "$ENV_FILE"
# Generate a secure Redis password
sed -i "s|^REDIS_PASSWORD=.*|REDIS_PASSWORD=$(openssl rand -base64 32)|" "$ENV_FILE"
# 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"
fi fi
# Merge .env and .env.production. New values will be added to .env # Merge .env and .env.production. New values will be added to .env