98 lines
3.2 KiB
YAML
98 lines
3.2 KiB
YAML
{{ ansible_managed | comment }}
|
|
|
|
# Infrastructure
|
|
# Ansible instructions to deploy the infrastructure
|
|
# Copyright (C) 2020 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:
|
|
|
|
database:
|
|
image: docker.io/library/postgres:{{ unicorns_website_database_image_version }}
|
|
mem_limit: 256mb
|
|
memswap_limit: 512mb
|
|
read_only: true
|
|
{% if unicorns_website_selinux_level != omit %}
|
|
security_opt:
|
|
- label=level:{{ unicorns_website_selinux_level }}
|
|
{% endif %}
|
|
tmpfs:
|
|
- /run/postgresql:size=512K
|
|
- /tmp:size=128K
|
|
stop_grace_period: 2m
|
|
stop_signal: SIGINT
|
|
environment:
|
|
- POSTGRES_USER={{ unicorns_website_database_user }}
|
|
- POSTGRES_PASSWORD={{ unicorns_website_database_password }}
|
|
- POSTGRES_DB={{ unicorns_website_database_name }}
|
|
volumes:
|
|
- {{ unicorns_website_database_location }}:/var/lib/postgresql/data
|
|
networks:
|
|
backend:
|
|
restart: always
|
|
|
|
redis:
|
|
image: docker.io/library/redis:{{ unicorns_website_redis_image_version }}
|
|
mem_limit: 512mb
|
|
memswap_limit: 768mb
|
|
{% if unicorns_website_selinux_level != omit %}
|
|
security_opt:
|
|
- label=level:{{ unicorns_website_selinux_level }}
|
|
{% endif %}
|
|
networks:
|
|
backend:
|
|
volumes:
|
|
- {{ unicorns_website_redis_location }}:/data
|
|
restart: always
|
|
|
|
web:
|
|
image: {{ unicorns_website_image }}:{{ unicorns_website_image_version }}
|
|
restart: always
|
|
depends_on:
|
|
- "database"
|
|
- "redis"
|
|
{% if unicorns_website_selinux_level != omit %}
|
|
security_opt:
|
|
- label=level:{{ unicorns_website_selinux_level }}
|
|
{% endif %}
|
|
networks:
|
|
backend:
|
|
{% if proxy_network is defined %}
|
|
{{ proxy_network }}:
|
|
{% endif %}
|
|
volumes:
|
|
- {{ unicorns_website_env_location }}:/var/www/html/env
|
|
- {{ unicorns_website_storage_location }}:/var/www/html/webapp/storage
|
|
labels:
|
|
- "traefik.http.routers.unicorns-website.rule=Host(`{{ unicorns_website_traefik_domain }}`) && PathPrefix(`/`)"
|
|
- "traefik.http.routers.unicorns-website.entrypoints=websecure"
|
|
- "traefik.http.routers.unicorns-website.tls=true"
|
|
- "traefik.http.routers.unicorns-website.tls.certresolver={{ unicorns_website_traefik_certresolver }}"
|
|
- "traefik.http.routers.unicorns-website.middlewares=unicorns-website,compress"
|
|
|
|
- "traefik.http.middlewares.unicorns-website.headers.sslredirect=true"
|
|
- "traefik.http.middlewares.unicorns-website.headers.stsSeconds=63072000"
|
|
|
|
- "traefik.enable=true"
|
|
{% if proxy_network is defined %}
|
|
- "traefik.docker.network={{ proxy_network }}"
|
|
{% endif %}
|
|
|
|
networks:
|
|
backend:
|
|
{% if proxy_network is defined %}
|
|
{{ proxy_network }}:
|
|
external: true
|
|
{% endif %}
|