Implemented helper role docker-central-database and refactored code

This commit is contained in:
2025-02-04 18:14:37 +01:00
parent cb6a42e97d
commit 5503326ea6
91 changed files with 358 additions and 237 deletions

View File

@@ -16,7 +16,7 @@ This role is designed to deploy the OpenProject application using Docker. It inc
The role uses several variables, defined in `vars/main.yml`:
- `repository_directory`: The directory for the OpenProject repository.
- `docker_compose_instance_directory`: Directory for Docker Compose instances.
- `docker_compose.directories.instance`: Directory for Docker Compose instances.
## Handlers

View File

@@ -2,7 +2,7 @@
- name: rebuild docker image
command:
cmd: docker build --no-cache -t custom_openproject .
chdir: "{{docker_compose_instance_directory}}"
chdir: "{{docker_compose.directories.instance}}"
environment:
COMPOSE_HTTP_TIMEOUT: 600
DOCKER_CLIENT_TIMEOUT: 600

View File

@@ -1,6 +1,7 @@
---
- name: "include docker/compose/database.yml"
include_tasks: docker/compose/database.yml
- name: "include docker-central-database"
include_role:
name: docker-central-database
- name: "include tasks nginx-docker-proxy-domain.yml"
include_tasks: nginx-docker-proxy-domain.yml
@@ -8,18 +9,18 @@
- name: "include tasks update-repository-with-docker-compose.yml"
include_tasks: update-repository-with-docker-compose.yml
- name: "Transfering Gemfile.plugins to {{docker_compose_instance_directory}}"
- name: "Transfering Gemfile.plugins to {{docker_compose.directories.instance}}"
copy:
src: Gemfile.plugins
dest: "{{docker_compose_instance_directory}}Gemfile.plugins"
dest: "{{docker_compose.directories.instance}}Gemfile.plugins"
notify:
- docker compose project setup
- rebuild docker image
- name: "Transfering Dockerfile to {{docker_compose_instance_directory}}"
- name: "Transfering Dockerfile to {{docker_compose.directories.instance}}"
copy:
src: Dockerfile
dest: "{{docker_compose_instance_directory}}Dockerfile"
dest: "{{docker_compose.directories.instance}}Dockerfile"
notify:
- docker compose project setup
- rebuild docker image
@@ -33,5 +34,5 @@
- name: "copy .env"
template:
src: env.j2
dest: "{{ docker_compose_instance_directory }}.env"
dest: "{{ docker_compose.directories.instance }}.env"
notify: docker compose project setup

View File

@@ -20,7 +20,7 @@ x-op-app: &app
services:
{% include 'templates/docker/services/' + database_type + '.yml.j2' %}
{% include 'roles/docker-central-database/templates/services/' + database_type + '.yml.j2' %}
{% include 'roles/docker-oauth2-proxy/templates/container.yml.j2' %}

View File

@@ -1,6 +1,6 @@
application_id: "openproject"
repository_directory: "{{ path_docker_compose_instances }}{{application_id}}/"
docker_compose_instance_directory: "{{repository_directory}}compose/"
docker_compose.directories.instance: "{{repository_directory}}compose/"
repository_address: "https://github.com/opf/openproject-deploy"
database_password: "{{openproject_database_password}}"
database_type: "postgres"