import { Template } from '@easypanel/template-sdk'; // This secure template generates the docker-compose and uses environment variables // so that secrets are not stored in files inside the project. Instead, config // is generated at container start from env vars injected by the panel. const t: Template = { meta: require('./meta.yaml'), render: (values: any) => { const libVersion = values.libretime_version || '4.5'; const publicUrl = values.public_url || 'http://{{hostname}}:8080'; const compose = `version: '3.8' services: postgres: image: postgres:15 environment: POSTGRES_USER: libretime POSTGRES_PASSWORD: ${values.postgres_password ? `'${values.postgres_password}'` : "\"\""} POSTGRES_DB: libretime volumes: - postgres_data:/var/lib/postgresql/data rabbitmq: image: rabbitmq:3.13-alpine environment: RABBITMQ_DEFAULT_VHOST: /libretime RABBITMQ_DEFAULT_USER: libretime RABBITMQ_DEFAULT_PASS: ${values.rabbitmq_password ? `'${values.rabbitmq_password}'` : "\"\""} api: image: ghcr.io/libretime/libretime-api:${libVersion} environment: - LIBRETIME_GENERAL_PUBLIC_URL=${publicUrl} - LIBRETIME_CONFIG_FROM_ENV=true volumes: - libretime_storage:/srv/libretime depends_on: - postgres - rabbitmq # composer not included; follow standard LibreTime docker installation legacy: image: ghcr.io/libretime/libretime-legacy:${libVersion} environment: - LIBRETIME_CONFIG_FROM_ENV=true volumes: - libretime_storage:/srv/libretime depends_on: - postgres - rabbitmq nginx: image: ghcr.io/libretime/libretime-nginx:${libVersion} ports: - "8080:8080" volumes: - libretime_storage:/srv/libretime:ro - ./docker/nginx/default.conf:/etc/nginx/conf.d/default.conf:ro depends_on: - legacy - api volumes: postgres_data: libretime_storage: `; const startupSh = `#!/bin/sh # At container start this script writes /etc/libretime/config.yml from env cat > /etc/libretime/config.yml <