feat: initialize unidesk platform
This commit is contained in:
@@ -0,0 +1,118 @@
|
||||
version: "3.8"
|
||||
|
||||
services:
|
||||
database:
|
||||
image: postgres:16-alpine
|
||||
container_name: unidesk-database
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "${UNIDESK_DATABASE_PORT}:5432"
|
||||
environment:
|
||||
POSTGRES_USER: "${UNIDESK_DATABASE_USER}"
|
||||
POSTGRES_PASSWORD: "${UNIDESK_DATABASE_PASSWORD}"
|
||||
POSTGRES_DB: "${UNIDESK_DATABASE_NAME}"
|
||||
command:
|
||||
- "postgres"
|
||||
- "-c"
|
||||
- "config_file=/etc/postgresql/postgresql.conf"
|
||||
- "-c"
|
||||
- "logging_collector=on"
|
||||
- "-c"
|
||||
- "log_directory=/var/log/unidesk"
|
||||
- "-c"
|
||||
- "log_filename=${UNIDESK_LOG_PREFIX}_database.log"
|
||||
- "-c"
|
||||
- "log_connections=on"
|
||||
- "-c"
|
||||
- "log_disconnections=on"
|
||||
volumes:
|
||||
- unidesk_pgdata_10gb:/var/lib/postgresql/data
|
||||
- ./src/components/database/init:/docker-entrypoint-initdb.d:ro
|
||||
- ./src/components/database/config/postgresql.conf:/etc/postgresql/postgresql.conf:ro
|
||||
- ${UNIDESK_LOG_DIR}:/var/log/unidesk
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U ${UNIDESK_DATABASE_USER} -d ${UNIDESK_DATABASE_NAME}"]
|
||||
interval: 5s
|
||||
timeout: 3s
|
||||
retries: 20
|
||||
|
||||
backend-core:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: src/components/backend-core/Dockerfile
|
||||
container_name: unidesk-backend-core
|
||||
restart: unless-stopped
|
||||
depends_on:
|
||||
- database
|
||||
ports:
|
||||
- "${UNIDESK_CORE_PORT}:8080"
|
||||
environment:
|
||||
PORT: "8080"
|
||||
DATABASE_URL: "postgres://${UNIDESK_DATABASE_USER}:${UNIDESK_DATABASE_PASSWORD}@database:5432/${UNIDESK_DATABASE_NAME}"
|
||||
PROVIDER_TOKEN: "${UNIDESK_PROVIDER_TOKEN}"
|
||||
HEARTBEAT_TIMEOUT_MS: "${UNIDESK_HEARTBEAT_TIMEOUT_MS}"
|
||||
LOG_FILE: "/var/log/unidesk/${UNIDESK_LOG_PREFIX}_backend-core.jsonl"
|
||||
volumes:
|
||||
- ${UNIDESK_LOG_DIR}:/var/log/unidesk
|
||||
healthcheck:
|
||||
test: ["CMD", "bun", "-e", "fetch('http://127.0.0.1:8080/health').then(r=>process.exit(r.ok?0:1)).catch(()=>process.exit(1))"]
|
||||
interval: 5s
|
||||
timeout: 3s
|
||||
retries: 20
|
||||
|
||||
frontend:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: src/components/frontend/Dockerfile
|
||||
container_name: unidesk-frontend
|
||||
restart: unless-stopped
|
||||
depends_on:
|
||||
- backend-core
|
||||
ports:
|
||||
- "${UNIDESK_FRONTEND_PORT}:8080"
|
||||
environment:
|
||||
PORT: "8080"
|
||||
CORE_PUBLIC_URL: "http://${UNIDESK_PUBLIC_HOST}:${UNIDESK_CORE_PORT}"
|
||||
LOG_FILE: "/var/log/unidesk/${UNIDESK_LOG_PREFIX}_frontend.jsonl"
|
||||
volumes:
|
||||
- ${UNIDESK_LOG_DIR}:/var/log/unidesk
|
||||
healthcheck:
|
||||
test: ["CMD", "bun", "-e", "fetch('http://127.0.0.1:8080/health').then(r=>process.exit(r.ok?0:1)).catch(()=>process.exit(1))"]
|
||||
interval: 5s
|
||||
timeout: 3s
|
||||
retries: 20
|
||||
|
||||
provider-gateway:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: src/components/provider-gateway/Dockerfile
|
||||
container_name: unidesk-provider-gateway-main
|
||||
restart: unless-stopped
|
||||
depends_on:
|
||||
- backend-core
|
||||
environment:
|
||||
PROVIDER_SERVER_URL: "ws://backend-core:8080/ws/provider"
|
||||
PROVIDER_TOKEN: "${UNIDESK_PROVIDER_TOKEN}"
|
||||
PROVIDER_ID: "${UNIDESK_PROVIDER_ID}"
|
||||
PROVIDER_NAME: "${UNIDESK_PROVIDER_NAME}"
|
||||
PROVIDER_LABELS_JSON: "${UNIDESK_PROVIDER_LABELS_JSON}"
|
||||
HEARTBEAT_INTERVAL_MS: "${UNIDESK_HEARTBEAT_INTERVAL_MS}"
|
||||
RECONNECT_BASE_MS: "${UNIDESK_RECONNECT_BASE_MS}"
|
||||
RECONNECT_MAX_MS: "${UNIDESK_RECONNECT_MAX_MS}"
|
||||
DOCKER_SOCKET_PATH: "/var/run/docker.sock"
|
||||
LOG_FILE: "/var/log/unidesk/${UNIDESK_LOG_PREFIX}_provider-gateway.jsonl"
|
||||
HOST_SSH_HOST: "${UNIDESK_HOST_SSH_HOST}"
|
||||
HOST_SSH_PORT: "${UNIDESK_HOST_SSH_PORT}"
|
||||
HOST_SSH_USER: "${UNIDESK_HOST_SSH_USER}"
|
||||
HOST_SSH_KEY: "/run/host-ssh/id_ed25519"
|
||||
HOST_REMOTE_CWD: "/root"
|
||||
HOST_LOGIN_SHELL: "/bin/bash"
|
||||
volumes:
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
- ${UNIDESK_LOG_DIR}:/var/log/unidesk
|
||||
extra_hosts:
|
||||
- "host.docker.internal:host-gateway"
|
||||
|
||||
volumes:
|
||||
unidesk_pgdata_10gb:
|
||||
name: unidesk_pgdata_10gb
|
||||
Reference in New Issue
Block a user