From ab915cdf21b15935c4076e14d2d531fc56aa33d4 Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Sun, 14 Jan 2024 14:10:36 +0100 Subject: [PATCH] Implemented gitlab plugin to openproject --- roles/docker-openproject/files/Dockerfile | 14 ++++++++++++++ roles/docker-openproject/files/Gemfile.plugins | 3 +++ roles/docker-openproject/handlers/main.yml | 8 ++++++++ roles/docker-openproject/tasks/main.yml | 17 +++++++++++++++++ .../templates/docker-compose.yml.j2 | 11 +++++++++-- roles/docker-openproject/templates/env.j2 | 1 - .../templates/docker-compose.yml.j2 | 1 + 7 files changed, 52 insertions(+), 3 deletions(-) create mode 100644 roles/docker-openproject/files/Dockerfile create mode 100644 roles/docker-openproject/files/Gemfile.plugins create mode 100644 roles/docker-openproject/handlers/main.yml diff --git a/roles/docker-openproject/files/Dockerfile b/roles/docker-openproject/files/Dockerfile new file mode 100644 index 00000000..e5b7688d --- /dev/null +++ b/roles/docker-openproject/files/Dockerfile @@ -0,0 +1,14 @@ +FROM openproject/community:13 + +# If installing a local plugin (using `path:` in the `Gemfile.plugins` above), +# you will have to copy the plugin code into the container here and use the +# path inside of the container. Say for `/app/vendor/plugins/openproject-slack`: +# COPY /path/to/my/local/openproject-slack /app/vendor/plugins/openproject-slack + +COPY Gemfile.plugins /app/ + +# If the plugin uses any external NPM dependencies you have to install them here. +# RUN npm add npm * + +RUN bundle config unset deployment && bundle install && bundle config set deployment 'true' +RUN ./docker/prod/setup/postinstall.sh \ No newline at end of file diff --git a/roles/docker-openproject/files/Gemfile.plugins b/roles/docker-openproject/files/Gemfile.plugins new file mode 100644 index 00000000..ea364983 --- /dev/null +++ b/roles/docker-openproject/files/Gemfile.plugins @@ -0,0 +1,3 @@ +group :opf_plugins do + gem "openproject-gitlab-integration", git: "openproject-gitlab_integration", branch: "master" +end \ No newline at end of file diff --git a/roles/docker-openproject/handlers/main.yml b/roles/docker-openproject/handlers/main.yml new file mode 100644 index 00000000..a0e308ce --- /dev/null +++ b/roles/docker-openproject/handlers/main.yml @@ -0,0 +1,8 @@ +--- +- name: rebuild docker image + command: + cmd: docker build --no-cache -t custom_openproject . + chdir: "{{docker_compose_instance_directory}}" + environment: + COMPOSE_HTTP_TIMEOUT: 600 + DOCKER_CLIENT_TIMEOUT: 600 \ No newline at end of file diff --git a/roles/docker-openproject/tasks/main.yml b/roles/docker-openproject/tasks/main.yml index 2ca735b6..60c376ab 100644 --- a/roles/docker-openproject/tasks/main.yml +++ b/roles/docker-openproject/tasks/main.yml @@ -8,6 +8,23 @@ - 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}}" + copy: + src: Gemfile.plugins + dest: "{{docker_compose_instance_directory}}Gemfile.plugins" + notify: + - docker compose project setup + - rebuild docker image + +- name: "Transfering Dockerfile to {{docker_compose_instance_directory}}" + copy: + src: Dockerfile + dest: "{{docker_compose_instance_directory}}Dockerfile" + notify: + - docker compose project setup + - rebuild docker image + - name: "create {{dummy_volume}}" file: path: "{{dummy_volume}}" diff --git a/roles/docker-openproject/templates/docker-compose.yml.j2 b/roles/docker-openproject/templates/docker-compose.yml.j2 index d6bedb37..9e51d0e0 100644 --- a/roles/docker-openproject/templates/docker-compose.yml.j2 +++ b/roles/docker-openproject/templates/docker-compose.yml.j2 @@ -2,7 +2,7 @@ version: "3.7" x-op-app: &app restart: {{docker_restart_policy}} - image: openproject/community:${TAG:-13} + image: custom_openproject environment: OPENPROJECT_HTTPS: "${OPENPROJECT_HTTPS}" OPENPROJECT_HOST__NAME: "${OPENPROJECT_HOST__NAME}" @@ -25,12 +25,14 @@ services: cache: image: memcached + container_name: openproject-memcached restart: {{docker_restart_policy}} {% include 'templates/docker-container-networks.yml.j2' %} proxy: restart: {{docker_restart_policy}} - image: openproject/community:${TAG:-13} + image: custom_openproject + container_name: openproject-proxy command: "./docker/prod/proxy" ports: - "${PORT}:80" @@ -47,6 +49,7 @@ services: web: <<: *app command: "./docker/prod/web" + container_name: openproject-web {% include 'templates/docker-container-networks.yml.j2' %} {% include 'templates/docker-container-depends-on-also-database.yml.j2' %} cache: @@ -64,6 +67,7 @@ services: autoheal: image: willfarrell/autoheal:1.2.0 + container_name: openproject-autoheal volumes: - "/var/run/docker.sock:/var/run/docker.sock" environment: @@ -74,6 +78,7 @@ services: worker: <<: *app command: "./docker/prod/worker" + container_name: openproject-worker {% include 'templates/docker-container-networks.yml.j2' %} {% include 'templates/docker-container-depends-on-also-database.yml.j2' %} cache: @@ -84,6 +89,7 @@ services: cron: <<: *app command: "./docker/prod/cron" + container_name: openproject-cron {% include 'templates/docker-container-networks.yml.j2' %} {% include 'templates/docker-container-depends-on-also-database.yml.j2' %} cache: @@ -94,6 +100,7 @@ services: seeder: <<: *app command: "./docker/prod/seeder" + container_name: openproject-seeder restart: on-failure {% include 'templates/docker-container-networks.yml.j2' %} diff --git a/roles/docker-openproject/templates/env.j2 b/roles/docker-openproject/templates/env.j2 index 1e91cdac..1a5ec540 100644 --- a/roles/docker-openproject/templates/env.j2 +++ b/roles/docker-openproject/templates/env.j2 @@ -6,7 +6,6 @@ # Please refer to our documentation to see all possible variables: # https://www.openproject.org/docs/installation-and-operations/configuration/environment/ # -TAG=13 OPENPROJECT_HTTPS=true OPENPROJECT_HOST__NAME={{domain}} PORT=127.0.0.1:{{http_port}} diff --git a/roles/docker-wordpress/templates/docker-compose.yml.j2 b/roles/docker-wordpress/templates/docker-compose.yml.j2 index b78e8eb7..751fe34c 100644 --- a/roles/docker-wordpress/templates/docker-compose.yml.j2 +++ b/roles/docker-wordpress/templates/docker-compose.yml.j2 @@ -8,6 +8,7 @@ services: logging: driver: journald image: custom_wordpress + container_name: wordpress-application build: context: . restart: {{docker_restart_policy}}