web-app-openproject: migrate from OpenProject 13 to 14

- updated base image from openproject/community:13 to openproject/openproject:14
- added dedicated migration task (db:migrate + schema cache clear)
- moved settings, ldap, and admin tasks to separate files
- adjusted docker-compose template to use OPENPROJECT_WEB_SERVICE / OPENPROJECT_SEEDER_SERVICE variables
- replaced postinstall.sh with precompile-assets.sh
- ensured depends_on uses variable-based service names

Ref: https://chatgpt.com/share/68d57770-2430-800f-ae53-e7eda6993a8d
This commit is contained in:
2025-09-25 19:10:46 +02:00
parent 6f3522dc28
commit f55b0ca797
9 changed files with 50 additions and 27 deletions

View File

@@ -0,0 +1,16 @@
- name: Run DB migrations (OpenProject)
shell: >
docker compose run --rm {{ OPENPROJECT_SEEDER_SERVICE }} bash -lc
"cd /app && RAILS_ENV={{ ENVIRONMENT | lower }} bin/rails db:migrate"
args:
chdir: "{{ docker_compose.directories.instance }}"
register: openproject_migrate
changed_when: openproject_migrate.rc == 0
failed_when: openproject_migrate.rc != 0
- name: Clear schema cache
shell: >
docker compose run --rm {{ OPENPROJECT_SEEDER_SERVICE }} bash -lc
"cd /app && RAILS_ENV={{ ENVIRONMENT | lower }} bin/rails db:schema:cache:clear"
args:
chdir: "{{ docker_compose.directories.instance }}"

View File

@@ -0,0 +1,10 @@
- name: Set settings in OpenProject
shell: >
docker compose exec {{ OPENPROJECT_WEB_SERVICE }} bash -c "cd /app &&
RAILS_ENV={{ ENVIRONMENT | lower }} bundle exec rails runner \"Setting[:{{ item.key }}] = '{{ item.value }}'\""
args:
chdir: "{{ docker_compose.directories.instance }}"
loop: "{{ OPENPROJECT_RAILS_SETTINGS | dict2items }}"
async: "{{ ASYNC_TIME if ASYNC_ENABLED | bool else omit }}"
poll: "{{ ASYNC_POLL if ASYNC_ENABLED | bool else omit }}"
no_log: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}"

View File

@@ -12,7 +12,7 @@
- name: "Transfering Gemfile.plugins to {{ OPENPROJECT_PLUGINS_FOLDER }}"
copy:
src: Gemfile.plugins
dest: "{{ OPENPROJECT_PLUGINS_FOLDER }}Gemfile.plugins"
dest: "{{ [OPENPROJECT_PLUGINS_FOLDER,'Gemfile.plugins'] | path_join }}"
notify:
- docker compose up
- docker compose build
@@ -26,20 +26,15 @@
- name: flush docker service
meta: flush_handlers
- name: Set settings in OpenProject
shell: >
docker compose exec web bash -c "cd /app &&
RAILS_ENV={{ ENVIRONMENT | lower }} bundle exec rails runner \"Setting[:{{ item.key }}] = '{{ item.value }}'\""
args:
chdir: "{{ docker_compose.directories.instance }}"
loop: "{{ OPENPROJECT_RAILS_SETTINGS | dict2items }}"
async: "{{ ASYNC_TIME if ASYNC_ENABLED | bool else omit }}"
poll: "{{ ASYNC_POLL if ASYNC_ENABLED | bool else omit }}"
no_log: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}"
- name: Execute Migrations
include_tasks: 01_migration.yml
- name: Deploy Settings
include_tasks: 02_settings.yml
- name: Setup LDAP
include_tasks: 01_ldap.yml
include_tasks: 03_ldap.yml
when: OPENPROJECT_LDAP_ENABLED | bool
- name: Create OpenProject Administrator
include_tasks: 02_admin.yml
include_tasks: 04_admin.yml