mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2024-11-21 20:31:02 +01:00
Implemented docker-compose.yml file https://chat.openai.com/share/981ecca4-9df7-4086-b99e-1b60f2632bf6
This commit is contained in:
parent
e889f7cf24
commit
d1b2d8e653
@ -2,21 +2,40 @@
|
||||
- name: "include tasks nginx-docker-proxy-domain.yml"
|
||||
include_tasks: nginx-docker-proxy-domain.yml
|
||||
|
||||
- name: "create {{ repository_directory }}"
|
||||
file:
|
||||
path: "{{ repository_directory }}"
|
||||
state: directory
|
||||
mode: 0755
|
||||
- name: register repository_directory_register
|
||||
stat:
|
||||
path: "{{repository_directory}}"
|
||||
register: repository_directory_register
|
||||
|
||||
- name: checkout repository
|
||||
ansible.builtin.shell: git checkout .
|
||||
become: true
|
||||
args:
|
||||
chdir: "{{repository_directory}}"
|
||||
when: repository_directory_register.stat.exists
|
||||
|
||||
- name: "backup docker-compose.yml if it exists"
|
||||
command: >
|
||||
mv "{{ docker_compose_file_path }}" "{{ docker_compose_backup_path }}"
|
||||
args:
|
||||
removes: "{{ docker_compose_file_path }}"
|
||||
become: true
|
||||
|
||||
- name: pull docker repository
|
||||
git:
|
||||
repo: "https://github.com/opf/openproject-deploy"
|
||||
dest: "{{repository_directory}}"
|
||||
dest: "{{ repository_directory }}"
|
||||
update: yes
|
||||
notify: recreate openproject
|
||||
become: true
|
||||
register: git_result
|
||||
ignore_errors: true
|
||||
|
||||
- name: "restore docker-compose.yml from backup"
|
||||
command: >
|
||||
mv "{{ docker_compose_backup_path }}" "{{ docker_compose_file_path }}"
|
||||
args:
|
||||
removes: "{{ docker_compose_backup_path }}"
|
||||
become: true
|
||||
|
||||
- name: Warn if repo is not reachable
|
||||
debug:
|
||||
@ -26,5 +45,11 @@
|
||||
- name: "copy .env"
|
||||
template:
|
||||
src: env.j2
|
||||
dest: "{{docker_compose_instance_directory}}.env"
|
||||
notify: recreate openproject
|
||||
dest: "{{ docker_compose_instance_directory }}.env"
|
||||
notify: recreate openproject
|
||||
|
||||
- name: "copy docker-compose.yml"
|
||||
template:
|
||||
src: docker-compose.yml.j2
|
||||
dest: "{{ docker_compose_file_path }}"
|
||||
notify: recreate openproject
|
||||
|
117
roles/docker-openproject/templates/docker-compose.yml.j2
Normal file
117
roles/docker-openproject/templates/docker-compose.yml.j2
Normal file
@ -0,0 +1,117 @@
|
||||
version: "3.7"
|
||||
|
||||
networks:
|
||||
frontend:
|
||||
backend:
|
||||
|
||||
volumes:
|
||||
pgdata:
|
||||
opdata:
|
||||
|
||||
x-op-restart-policy: &restart_policy
|
||||
restart: unless-stopped
|
||||
x-op-image: &image
|
||||
image: openproject/community:${TAG:-13}
|
||||
x-op-app: &app
|
||||
<<: [*image, *restart_policy]
|
||||
environment:
|
||||
OPENPROJECT_HTTPS: "${OPENPROJECT_HTTPS:-true}"
|
||||
OPENPROJECT_HOST__NAME: "${OPENPROJECT_HOST__NAME:-localhost:8080}"
|
||||
OPENPROJECT_HSTS: "${OPENPROJECT_HSTS:-true}"
|
||||
RAILS_CACHE_STORE: "memcache"
|
||||
OPENPROJECT_CACHE__MEMCACHE__SERVER: "cache:11211"
|
||||
OPENPROJECT_RAILS__RELATIVE__URL__ROOT: "${OPENPROJECT_RAILS__RELATIVE__URL__ROOT:-}"
|
||||
DATABASE_URL: "${DATABASE_URL:-postgres://postgres:p4ssw0rd@db/openproject?pool=20&encoding=unicode&reconnect=true}"
|
||||
RAILS_MIN_THREADS: ${RAILS_MIN_THREADS:-4}
|
||||
RAILS_MAX_THREADS: ${RAILS_MAX_THREADS:-16}
|
||||
# set to true to enable the email receiving feature. See ./docker/cron for more options
|
||||
IMAP_ENABLED: "${IMAP_ENABLED:-false}"
|
||||
volumes:
|
||||
- "${OPDATA:-opdata}:/var/openproject/assets"
|
||||
|
||||
services:
|
||||
db:
|
||||
image: postgres:13
|
||||
<<: *restart_policy
|
||||
stop_grace_period: "3s"
|
||||
volumes:
|
||||
- "${PGDATA:-pgdata}:/var/lib/postgresql/data"
|
||||
environment:
|
||||
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-p4ssw0rd}
|
||||
POSTGRES_DB: openproject
|
||||
networks:
|
||||
- backend
|
||||
|
||||
cache:
|
||||
image: memcached
|
||||
<<: *restart_policy
|
||||
networks:
|
||||
- backend
|
||||
|
||||
proxy:
|
||||
<<: [*image, *restart_policy]
|
||||
command: "./docker/prod/proxy"
|
||||
ports:
|
||||
- "${PORT:-8080}:80"
|
||||
environment:
|
||||
APP_HOST: web
|
||||
OPENPROJECT_RAILS__RELATIVE__URL__ROOT: "${OPENPROJECT_RAILS__RELATIVE__URL__ROOT:-}"
|
||||
depends_on:
|
||||
- web
|
||||
networks:
|
||||
- frontend
|
||||
|
||||
web:
|
||||
<<: *app
|
||||
command: "./docker/prod/web"
|
||||
networks:
|
||||
- frontend
|
||||
- backend
|
||||
depends_on:
|
||||
- db
|
||||
- cache
|
||||
- seeder
|
||||
labels:
|
||||
- autoheal=true
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://localhost:8080${OPENPROJECT_RAILS__RELATIVE__URL__ROOT:-}/health_checks/default"]
|
||||
interval: 10s
|
||||
timeout: 3s
|
||||
retries: 3
|
||||
start_period: 30s
|
||||
|
||||
autoheal:
|
||||
image: willfarrell/autoheal:1.2.0
|
||||
volumes:
|
||||
- "/var/run/docker.sock:/var/run/docker.sock"
|
||||
environment:
|
||||
AUTOHEAL_CONTAINER_LABEL: autoheal
|
||||
AUTOHEAL_START_PERIOD: 600
|
||||
AUTOHEAL_INTERVAL: 30
|
||||
|
||||
worker:
|
||||
<<: *app
|
||||
command: "./docker/prod/worker"
|
||||
networks:
|
||||
- backend
|
||||
depends_on:
|
||||
- db
|
||||
- cache
|
||||
- seeder
|
||||
|
||||
cron:
|
||||
<<: *app
|
||||
command: "./docker/prod/cron"
|
||||
networks:
|
||||
- backend
|
||||
depends_on:
|
||||
- db
|
||||
- cache
|
||||
- seeder
|
||||
|
||||
seeder:
|
||||
<<: *app
|
||||
command: "./docker/prod/seeder"
|
||||
restart: on-failure
|
||||
networks:
|
||||
- backend
|
@ -18,5 +18,5 @@ RAILS_MIN_THREADS=4
|
||||
RAILS_MAX_THREADS=16
|
||||
|
||||
# The following volumes are default
|
||||
# PGDATA="pgdata"
|
||||
# OPDATA="opdata"
|
||||
PGDATA="pgdata"
|
||||
OPDATA="opdata"
|
@ -1,2 +1,4 @@
|
||||
repository_directory: "{{ path_docker_compose_instances }}openproject/"
|
||||
docker_compose_instance_directory: "{{repository_directory}}compose/"
|
||||
docker_compose_file_path: "{{docker_compose_instance_directory}}docker-compose.yml"
|
||||
docker_compose_backup_path: "/tmp/openproject-docker-compose-backup.yml"
|
Loading…
Reference in New Issue
Block a user