services: {% include 'templates/docker/services/' + database_type + '.yml.j2' %} application: image: "friendica:{{friendica_version}}" restart: {{docker_restart_policy}} volumes: - data:/var/www/html ports: - "127.0.0.1:{{http_port}}:80" healthcheck: # This health check ensures the test email is sent only once to prevent # hitting SMTP rate limits due to multiple health check executions. # The logic checks for a temporary file (/tmp/email_sent) to determine # if the email has already been sent. If the file exists, the email # is skipped, but the health check continues by verifying the HTTP service. # Refer to the conversation with ChatGPT (https://chatgpt.com/share/67898c3f-2c1c-800f-861c-47dcbe109135) # on January 16, 2025, for the background behind this complexity. test: [ "CMD-SHELL", "(if [ ! -f /tmp/email_sent ]; then echo 'Subject: testmessage from {{domain}}\n\nSUCCESSFULL' | msmtp -t {{test_email}} && touch /tmp/email_sent; fi && curl -f http://127.0.0.1:80) || exit 1" ] interval: 1m timeout: 10s retries: 3 environment: FRIENDICA_URL: https://{{domain}} HOSTNAME: {{domain}} FRIENDICA_NO_VALIDATION: false # Debugging FRIENDICA_DEBUGGING: false FRIENDICA_LOGLEVEL: 5 FRIENDICA_LOGGER: stream FRIENDICA_LOGFILE: php://stdout # Database Configuration MYSQL_HOST: {{database_host}}:3306 MYSQL_DATABASE: {{database_name}} MYSQL_USER: {{database_username}} MYSQL_PASSWORD: {{database_password}} # Email Configuration SMTP: {{system_email_host}} SMTP_DOMAIN: {{system_email_domain}} SMTP_PORT: {{system_email_smtp_port}} SMTP_AUTH_USER: {{system_email_username}} SMTP_AUTH_PASS: {{system_email_password}} SMTP_TLS: {{ 'on' if system_email_tls else 'off' }} SMTP_STARTTLS: {{ 'on' if system_email_start_tls else 'off' }} SMTP_FROM: {{system_email_local}} # Administrator Credentials FRIENDICA_ADMIN_MAIL: {{administrator_email}} MAILNAME: {{administrator_email}} {% include 'templates/docker/container/networks.yml.j2' %} {% include 'templates/docker/container/depends-on-just-database.yml.j2' %} {% include 'templates/docker/compose/volumes.yml.j2' %} data: {% include 'templates/docker/compose/networks.yml.j2' %}