Add monica deployment

Added basic monica docker deployment.

A key which is required for monica is automatically generated on
deployment.
Optionally, geolocation and weather api can be enabled.
Mail-sending functionality is disabled by default but can be enabled
with any compatible smtp server set up.
This commit is contained in:
Marty Oehme 2021-10-25 20:23:04 +02:00
parent 3f944df048
commit 010d8f93c4
Signed by: Marty
GPG key ID: B7538B8F50A1C800
12 changed files with 353 additions and 1 deletions

View file

@ -0,0 +1,70 @@
version: '3.7'
services:
app:
image: {{ stack_image }}:{{ monica_version }}
networks:
- "{{ docker_swarm_public_network_name }}"
- backend
volumes:
- data:/var/www/html/storage
environment:
{% if server_domain is not undefined and not none %}
- APP_ENV=production
{% else %}
- APP_ENV=local
{% endif %}
- APP_KEY={{ monica_app_key }}
{% if monica_app_disable_signups is sameas true %}
- APP_DISABLE_SIGNUP=true
{% endif %}
- DB_HOST=db
- DB_DATABASE={{ monica_db_database }}
- DB_USERNAME={{ monica_db_username }}
- DB_PASSWORD={{ monica_db_password }}
{% if server_domain is not undefined and not none %}
- "APP_URL={{ (monica_use_https == True) | ternary('https', 'http') }}://{{ (subdomain_alias is not undefined and not none) | ternary(subdomain_alias, stack_name) }}.{{server_domain}}"
{% if monica_app_geolocation_api_key is not undefined and not none %}
- ENABLE_GEOLOCATION=true
- LOCATION_IQ_API_KEY={{ monica_app_geolocation_api_key }}
{% if monica_app_weather_api_key is not undefined and not none %}
- ENABLE_WEATHER=true
- DARKSKY_API_KEY={{ monica_app_weather_api_key }}
{% endif %}
{% endif %}
{% if monica_mail_host is not undefined and not none %}
- MAIL_MAILER=smtp
- MAIL_HOST={{ monica_mail_host }}
- MAIL_PORT={{ monica_mail_port }}
- MAIL_ENCRYPTION={{ monica_mail_encryption }}
- MAIL_USERNAME={{ monica_mail_username }}
- MAIL_PASSWORD={{ monica_mail_password }}
- MAIL_FROM_ADDRESS={{ monica_mail_from }}
- MAIL_FROM_NAME="{{ monica_mail_from_name }}"
- APP_EMAIL_NEW_USERS_NOTIFICATION={{ monica_mail_new_user_notification_address }}
{% endif %}
{% else %}
- "APP_URL={{ (monica_use_https == True) | ternary('https', 'http') }}://localhost/{{ (subdomain_alias is not undefined and not none) | ternary(subdomain_alias, stack_name) }}/"
- APP_FORCE_URL=true
{% endif %}
db:
image: mariadb:10
environment:
- MYSQL_ROOT_PASSWORD={{ monica_db_root_password }}
- MYSQL_DATABASE={{ monica_db_database }}
- MYSQL_USER={{ monica_db_username }}
- MYSQL_PASSWORD={{ monica_db_password }}
networks:
- backend
volumes:
- db:/var/lib/mysql
volumes:
data:
db:
networks:
"{{ docker_swarm_public_network_name }}":
external: true
backend: