infrastructure/roles/vikunja/templates/docker-compose.yml

129 lines
4.6 KiB
YAML
Raw Normal View History

{{ ansible_managed | comment }}
# Infrastructure
# Ansible instructions to deploy the infrastructure
# Copyright (C) 2021 Saibotk
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
version: '2'
services:
api:
image: docker.io/vikunja/api:{{ vikunja_api_image_version }}
2021-11-06 16:02:21 +00:00
mem_limit: 256mb
memswap_limit: 300mb
depends_on:
- db
- redis
volumes:
- "{{ vikunja_install_location }}/config.yml:/app/vikunja/config.yml"
- "{{ vikunja_api_files_location }}:/app/vikunja/files"
networks:
database:
{% if proxy_network is defined %}
{{ proxy_network }}:
{% endif %}
restart: always
{% if vikunja_selinux_level != omit %}
security_opt:
- label=level:{{ vikunja_selinux_level }}
{% endif %}
labels:
- "traefik.enable=true"
- "traefik.http.routers.vikunja-api.rule=Host(`{{ vikunja_api_domain }}`) && PathPrefix(`/api/v1`, `/dav/`, `/.well-known/`)"
- "traefik.http.routers.vikunja-api.entrypoints=websecure"
- "traefik.http.routers.vikunja-api.tls.certresolver={{ vikunja_api_traefik_certresolver }}"
- "traefik.http.routers.vikunja-api.middlewares=vikunja-api,compress"
- "traefik.http.services.vikunja-api.loadbalancer.server.port=3456"
- "traefik.http.middlewares.vikunja-api.headers.sslredirect=true"
- "traefik.http.middlewares.vikunja-api.headers.stsSeconds=63072000"
- "traefik.http.middlewares.vikunja-api.headers.referrerPolicy=no-referrer"
{% if proxy_network is defined %}
- "traefik.docker.network={{ proxy_network }}"
{% endif %}
{% if proxy_hiddenservice is defined and proxy_hiddenservice.content is defined %}
- "traefik.http.middlewares.vikunja-api.headers.customresponseheaders.alt-svc:h2={{ proxy_hiddenservice['content'] | b64decode | trim }}:443; ma=2592000"
{% endif %}
frontend:
image: docker.io/vikunja/frontend:{{ vikunja_frontend_image_version }}
restart: always
mem_limit: 10mb
memswap_limit: 15mb
security_opt:
- no-new-privileges
labels:
- "traefik.enable=true"
- "traefik.http.routers.vikunja-frontend.rule=Host(`{{ vikunja_frontend_domain }}`) && PathPrefix(`/`)"
- "traefik.http.routers.vikunja-frontend.entrypoints=websecure"
- "traefik.http.routers.vikunja-frontend.tls.certresolver={{ vikunja_frontend_traefik_certresolver }}"
- "traefik.http.routers.vikunja-frontend.middlewares=vikunja-frontend,compress"
- "traefik.http.services.vikunja-frontend.loadbalancer.server.port=80"
- "traefik.http.middlewares.vikunja-frontend.headers.sslredirect=true"
- "traefik.http.middlewares.vikunja-frontend.headers.stsSeconds=63072000"
- "traefik.http.middlewares.vikunja-frontend.headers.referrerPolicy=no-referrer"
{% if proxy_network is defined %}
- "traefik.docker.network={{ proxy_network }}"
{% endif %}
{% if proxy_hiddenservice is defined and proxy_hiddenservice.content is defined %}
- "traefik.http.middlewares.vikunja-frontend.headers.customresponseheaders.alt-svc:h2={{ proxy_hiddenservice['content'] | b64decode | trim }}:443; ma=2592000"
{% endif %}
{% if proxy_network is defined %}
networks:
{{ proxy_network }}:
{% endif %}
db:
image: docker.io/library/postgres:{{ vikunja_database_image_version }}
restart: always
mem_limit: 512mb
memswap_limit: 768mb
read_only: true
security_opt:
- no-new-privileges
tmpfs:
- /run/postgresql:size=512K
- /tmp:size=128K
stop_grace_period: 2m
stop_signal: SIGINT
environment:
- POSTGRES_DB=vikunja
- POSTGRES_USER=vikunja
- POSTGRES_PASSWORD={{ vikunja_database_password }}
volumes:
- "{{ vikunja_database_location }}:/var/lib/postgresql/data"
networks:
database:
redis:
image: "docker.io/library/redis:{{ vikunja_redis_image_version }}"
mem_limit: 512mb
memswap_limit: 768mb
restart: always
volumes:
- {{ vikunja_redis_location }}:/data
networks:
database:
networks:
database:
{% if proxy_network is defined %}
{{ proxy_network }}:
external: true
{% endif %}