Content
Docker-Compose Script->Modified to Name All Volumes
Added by Randy R almost 4 years ago
Relates to giving all Docker volumes a name. This is an optional personal preference. I believe OpenProject's anonymous volumes can get blown away without any impact. So this modification is not necessary. Also, I have only used OpenProject for a month now, so this post may contain incorrect assumptions.
I spooled-up/spooled-down the native DockerCompose script multiple times. I converted the anonymous volumes into named volumes until I could spool-up without seeing an anonymous volume.
- Volumes with potential data to backup are named "DataVolume".
- Temp/disposable volumes are named "TempVolume".
About the volume "AssetData" (aka "opdata"). This volume is shown above with an orange "unused" tag:
- Using the native DockerCompose script will save screenshots/attachments into the "opdata" volume.
- However, using the modified script below will NOT save screenshots/attachments into AssetData (aka "opdata"). Instead, screenshots/attachments get saved into the "XXX_Web_02" volume. I would like to know why this is. I had to do a migration to a brand new machine and all of the screenshots/attachments migrated over fine. Not saying this is 100% safe but it has worked so far.
Note: I only tested creating work packages. I did not test using GIT/SVN, or any other feature. So I would backup all volumes to be safe (including the volumes named "TempVolume").
#2020-12-19 OpenProject version 11.1
#Docker compose file modified from: https://github.com/opf/openproject-deploy/blob/stable/11/compose/docker-compose.yml
#My edits are noted with "★". Basically, I went through every anonymous volume that OpenProject created and gave it a name.
#Initial username/password is admin/admin.
version: "3.7"
networks:
frontend:
backend:
x-op-restart-policy: &restart_policy
restart: unless-stopped
x-op-image: &image
image: openproject/community:11.1 #Have to define exact version. Using ":latest" returns error about manifest. ★
x-op-app: &app
<<: *image
<<: *restart_policy
environment:
RAILS_CACHE_STORE: "memcache"
OPENPROJECT_CACHE__MEMCACHE__SERVER: "cache:11211"
OPENPROJECT_RAILS__RELATIVE__URL__ROOT: "${OPENPROJECT_RAILS__RELATIVE__URL__ROOT:-}"
DATABASE_URL: "postgres://postgres:p4ssw0rd@db/openproject"
USE_PUMA: "true"
# set to true to enable the email receiving feature. See ./docker/cron for more options
IMAP_ENABLED: "${IMAP_ENABLED:-false}"
#See volume notes at bottom. ★
volumes:
- OpenProject_DataVolume_AssetData:/var/openproject/assets
services:
db:
image: postgres:10
<<: *restart_policy
stop_grace_period: "3s"
#See notes in "top level key" section at bottom. ★
volumes:
- OpenProject_DataVolume_PostgreSqlData:/var/lib/postgresql/data
environment:
POSTGRES_PASSWORD: p4ssw0rd
POSTGRES_DB: openproject
networks:
- backend
cache:
image: memcached
<<: *restart_policy
networks:
- backend
#No volume needed. I tested. ★
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
#See volume notes at bottom. ★
volumes:
- OpenProject_TempVolume_Proxy_01:/var/openproject/pgdata
- OpenProject_TempVolume_Proxy_02:/var/openproject/assets
web:
<<: *app
command: "./docker/prod/web"
networks:
- frontend
- backend
depends_on:
- db
- cache
- seeder
#See volume notes at bottom. ★
volumes:
- OpenProject_DataVolume_Web_01:/var/openproject/pgdata
- OpenProject_DataVolume_Web_02:/var/openproject/assets
worker:
<<: *app
command: "./docker/prod/worker"
networks:
- backend
depends_on:
- db
- cache
- seeder
#See volume notes at bottom. ★
volumes:
- OpenProject_TempVolume_Worker_01:/var/openproject/pgdata
- OpenProject_TempVolume_Worker_02:/var/openproject/assets
cron:
<<: *app
command: "./docker/prod/cron"
networks:
- backend
depends_on:
- db
- cache
- seeder
#See volume notes at bottom. ★
volumes:
- OpenProject_TempVolume_CronJob_01:/var/openproject/pgdata
- OpenProject_TempVolume_CronJob_02:/var/openproject/assets
seeder:
<<: *app
command: "./docker/prod/seeder"
restart: on-failure
networks:
- backend
#See volume notes at bottom. ★
volumes:
- OpenProject_TempVolume_Seeder_01:/var/openproject/pgdata
- OpenProject_TempVolume_Seeder_02:/var/openproject/assets
volumes:
#---------------------------------
#ABOUT VOLUMES:
#2020-12-19 Results from test with OpenProject 11.1. Created 50 tasks with file attachments and screenshots. Note: This is not a complete test. Ex: I did NOT test the GIT/SVN capabilities etc. I would backup all volumes to be safe.
#I named all volumes to prevent Docker from assigning a bogus anonymous GUID name.
#---------------------------------
#- AssetData: Empty. When "opdata" is renamed, then screenshots/attachments get saved to Web_02 volume below. So this AssetData volume remains empty. I would like to understand why this is. But anyhow, this works.
#- PostgreSqlData: ☆☆☆ Had data.
#- Web_01: Empty
#- Web_02: ☆☆☆ Had task attachments/screenshot files.
#- CronJob_01: Empty
#- CronJob_02: Empty
#- Proxy_01: Empty
#- Proxy_02: Empty
#- Seeder_01: Empty
#- Seeder_02: Empty
#- Worker_01: Empty
#- Worker_02: Empty
OpenProject_DataVolume_AssetData:
name: OpenProject_DataVolume_AssetData #Original volume name "opdata". ★
OpenProject_DataVolume_PostgreSqlData:
name: OpenProject_DataVolume_PostgreSqlData #Original volume name "pgdata". ★
OpenProject_DataVolume_Web_01:
name: OpenProject_DataVolume_Web_01 #Original script had no volume name. I gave it this name. ★
OpenProject_DataVolume_Web_02:
name: OpenProject_DataVolume_Web_02 #Original script had no volume name. I gave it this name. ★
OpenProject_TempVolume_Proxy_01:
name: OpenProject_TempVolume_Proxy_01 #Original script had no volume name. I gave it this name. ★
OpenProject_TempVolume_Proxy_02:
name: OpenProject_TempVolume_Proxy_02 #Original script had no volume name. I gave it this name. ★
OpenProject_TempVolume_Worker_01:
name: OpenProject_TempVolume_Worker_01 #Original script had no volume name. I gave it this name. ★
OpenProject_TempVolume_Worker_02:
name: OpenProject_TempVolume_Worker_02 #Original script had no volume name. I gave it this name. ★
OpenProject_TempVolume_CronJob_01:
name: OpenProject_TempVolume_CronJob_01 #Original script had no volume name. I gave it this name. ★
OpenProject_TempVolume_CronJob_02:
name: OpenProject_TempVolume_CronJob_02 #Original script had no volume name. I gave it this name. ★
OpenProject_TempVolume_Seeder_01:
name: OpenProject_TempVolume_Seeder_01 #Original script had no volume name. I gave it this name. ★
OpenProject_TempVolume_Seeder_02:
name: OpenProject_TempVolume_Seeder_02 #Original script had no volume name. I gave it this name. ★
Replies (2)
Hello,
Thank you for your message, however the point of having the same volume names is that they are shareable by multiple services. So your approach wouldn't work I suppose?
Hey Cyril,
It works OK. No issues so far.