refactor(roles/coolify): refactored coolify role

This commit is contained in:
ITQ
2026-03-19 14:41:51 +03:00
parent 8a9cc4a1ce
commit 81b623432c
12 changed files with 533 additions and 202 deletions
+33 -13
View File
@@ -1,18 +1,38 @@
APP_ID={{ coolify_app_id | default('') }}
APP_NAME={{ coolify_app_name | default('Coolify') }}
APP_KEY={{ coolify_app_key | default('') }}
# Managed by Ansible — manual changes will be overwritten on next deployment
DB_USERNAME={{ coolify_db_username | default('coolify') }}
DB_PASSWORD={{ coolify_db_password | default('') }}
APP_ID={{ coolify_app_id }}
APP_NAME={{ coolify_app_name }}
APP_KEY={{ coolify_app_key }}
APP_ENV={{ coolify_app_env }}
APP_PORT={{ coolify_app_port }}
REDIS_PASSWORD={{ coolify_redis_password | default('') }}
REGISTRY_URL={{ coolify_registry_url }}
LATEST_IMAGE={{ coolify_image_tag }}
PUSHER_APP_ID={{ coolify_pusher_app_id | default('') }}
PUSHER_APP_KEY={{ coolify_pusher_app_key | default('') }}
PUSHER_APP_SECRET={{ coolify_pusher_app_secret | default('') }}
PHP_MEMORY_LIMIT={{ coolify_php_memory_limit }}
PHP_FPM_PM_CONTROL={{ coolify_php_fpm_pm_control }}
PHP_FPM_PM_START_SERVERS={{ coolify_php_fpm_pm_start_servers }}
PHP_FPM_PM_MIN_SPARE_SERVERS={{ coolify_php_fpm_pm_min_spare_servers }}
PHP_FPM_PM_MAX_SPARE_SERVERS={{ coolify_php_fpm_pm_max_spare_servers }}
ROOT_USERNAME={{ coolify_root_username | default('') }}
ROOT_USER_EMAIL={{ coolify_root_user_email | default('') }}
ROOT_USER_PASSWORD={{ coolify_root_user_password | default('') }}
DB_USERNAME={{ coolify_db_username }}
DB_PASSWORD={{ coolify_db_password }}
DB_DATABASE={{ coolify_db_database }}
REGISTRY_URL={{ coolify_registry_url | default('ghcr.io') }}
REDIS_PASSWORD={{ coolify_redis_password }}
SOKETI_PORT={{ coolify_soketi_port }}
SOKETI_DEBUG={{ coolify_soketi_debug }}
PUSHER_APP_ID={{ coolify_pusher_app_id }}
PUSHER_APP_KEY={{ coolify_pusher_app_key }}
PUSHER_APP_SECRET={{ coolify_pusher_app_secret }}
{% if coolify_root_username | default('', true) | length > 0 %}
ROOT_USERNAME={{ coolify_root_username }}
{% endif %}
{% if coolify_root_user_email | default('', true) | length > 0 %}
ROOT_USER_EMAIL={{ coolify_root_user_email }}
{% endif %}
{% if coolify_root_user_password | default('', true) | length > 0 %}
ROOT_USER_PASSWORD={{ coolify_root_user_password }}
{% endif %}
@@ -0,0 +1,104 @@
# Managed by Ansible — manual changes will be overwritten on next deployment
services:
coolify:
image: "${REGISTRY_URL:-ghcr.io}/coollabsio/coolify:${LATEST_IMAGE:-latest}"
volumes:
- type: bind
source: /data/coolify/source/.env
target: /var/www/html/.env
read_only: true
- /data/coolify/ssh:/var/www/html/storage/app/ssh
- /data/coolify/applications:/var/www/html/storage/app/applications
- /data/coolify/databases:/var/www/html/storage/app/databases
- /data/coolify/services:/var/www/html/storage/app/services
- /data/coolify/backups:/var/www/html/storage/app/backups
environment:
- APP_ENV=${APP_ENV:-production}
- PHP_MEMORY_LIMIT=${PHP_MEMORY_LIMIT:-256M}
- PHP_FPM_PM_CONTROL=${PHP_FPM_PM_CONTROL:-dynamic}
- PHP_FPM_PM_START_SERVERS=${PHP_FPM_PM_START_SERVERS:-1}
- PHP_FPM_PM_MIN_SPARE_SERVERS=${PHP_FPM_PM_MIN_SPARE_SERVERS:-1}
- PHP_FPM_PM_MAX_SPARE_SERVERS=${PHP_FPM_PM_MAX_SPARE_SERVERS:-10}
env_file:
- /data/coolify/source/.env
ports:
- name: web
target: 8080
published: ${APP_PORT:-8000}
host_ip: 127.0.0.1
protocol: tcp
app_protocol: http
expose:
- "${APP_PORT:-8000}"
healthcheck:
test: curl --fail http://127.0.0.1:8080/api/health || exit 1
interval: 5s
retries: 10
timeout: 2s
postgres:
volumes:
- coolify-db:/var/lib/postgresql/data
environment:
POSTGRES_USER: "${DB_USERNAME}"
POSTGRES_PASSWORD: "${DB_PASSWORD}"
POSTGRES_DB: "${DB_DATABASE:-coolify}"
healthcheck:
test:
- CMD-SHELL
- pg_isready -U ${DB_USERNAME} -d ${DB_DATABASE:-coolify}
interval: 5s
retries: 10
timeout: 2s
redis:
command: redis-server --save 20 1 --loglevel warning --requirepass ${REDIS_PASSWORD}
environment:
REDIS_PASSWORD: "${REDIS_PASSWORD}"
volumes:
- coolify-redis:/data
healthcheck:
test: redis-cli ping
interval: 5s
retries: 10
timeout: 2s
soketi:
image: "${REGISTRY_URL:-ghcr.io}/coollabsio/coolify-realtime:1.0.10"
ports:
- name: soketi
target: 6001
published: ${SOKETI_PORT:-6001}
host_ip: 127.0.0.1
protocol: tcp
app_protocol: http
- name: terminal
target: 6002
published: 6002
host_ip: 127.0.0.1
protocol: tcp
app_protocol: http
volumes:
- /data/coolify/ssh:/var/www/html/storage/app/ssh
environment:
APP_NAME: "${APP_NAME:-Coolify}"
SOKETI_DEBUG: "${SOKETI_DEBUG:-false}"
SOKETI_DEFAULT_APP_ID: "${PUSHER_APP_ID}"
SOKETI_DEFAULT_APP_KEY: "${PUSHER_APP_KEY}"
SOKETI_DEFAULT_APP_SECRET: "${PUSHER_APP_SECRET}"
healthcheck:
test:
- CMD-SHELL
- wget -qO- http://127.0.0.1:6001/ready && wget -qO- http://127.0.0.1:6002/ready || exit 1
interval: 5s
retries: 10
timeout: 2s
volumes:
coolify-db:
name: coolify-db
coolify-redis:
name: coolify-redis
networks:
coolify:
external: true
@@ -0,0 +1,41 @@
# Managed by Ansible — manual changes will be overwritten on next deployment
services:
coolify:
container_name: coolify
restart: always
working_dir: /var/www/html
extra_hosts:
- host.docker.internal:host-gateway
networks:
- coolify
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
soketi:
condition: service_healthy
postgres:
image: postgres:15-alpine
container_name: coolify-db
restart: always
networks:
- coolify
redis:
image: redis:7-alpine
container_name: coolify-redis
restart: always
networks:
- coolify
soketi:
container_name: coolify-realtime
extra_hosts:
- host.docker.internal:host-gateway
restart: always
networks:
- coolify
networks:
coolify:
name: coolify
driver: bridge
external: false