-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: set DHIS2_HOME env var to /DHIS2_home for images pre-Jib TECH-1433 #586
Conversation
Only mount the config, as the DHIS2_HOME directory is already created using the correct ownership/permissions for DHIS2 to write to it. The env var DHIS2_HOME is set to the appropriate location based on the DHIS2 version. For more details see dhis2/cli#586
The env var DHIS2_HOME is set to the appropriate location based on the DHIS2 version. For more details see dhis2/cli#586
2b8e486
to
ba6d998
Compare
685d6e4
to
81f0457
Compare
Docker images created for releases after 2.39.0, 2.38.2, 2.37.8.2 or 2.37.9 (not yet released) do not create directory /DHIS2_home anymore. See dhis2/dhis2-core#11981 Instead /opt/dhis2 is created which is the default location used by DHIS2. Set DHIS2_HOME to /DHIS2_home for images created before such releases and to /opt/dhis2 otherwise.
@@ -1,4 +1,5 @@ | |||
module.exports = { | |||
dhis2Home: '/opt/dhis2', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(minor) As far as I can tell this will never be used because it is always overridden by the "computed" dhis2home (common.js::168), is that correct and if so should this default be removed...?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given that dhis2Version
is also in the defaults with an empty value, maybe we can either keep it as /opt/dhis2
(if we assume this is the default home location for images going forward) or also keep it with an empty value. I'm also fine either way. 🤷♂️ 😅
so we can simplify our logic that future proofed the next 2.37 release
🎉 This PR is included in version 4.2.3 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
Docker images for releases starting from
2.39.0
,2.38.2
,2.37.9
do not create directory/DHIS2_home
anymore. See dhis2/dhis2-core#11981 Instead/opt/dhis2
is created which is the default location used by DHIS2.Set DHIS2_HOME to /DHIS2_home for images created before such releases and to /opt/dhis2 otherwise.
The changes make sure that the "effective" docker-compose.yml
for old Docker images (not using Jib) is
for new Docker images (using Jib) is
Mount other files into DHIS2_HOME
If you need to mount additional files. Find the docker-compose.yml in the d2 cache. And add one line. Make sure that the left side corresponds to a path on your host where the file exists! And make sure the right side points to the
DHIS2_HOME
for the version you deploy.environment: DHIS2_HOME=/opt/dhis2 volumes: - ./config/DHIS2_home/dhis.conf:/opt/dhis2/dhis.conf + - ./config/DHIS2_home/dhis-google-auth.json:/opt/dhis2/dhis-google-auth.json
Tests
Automated
See unit and "integration" tests of the resulting config in this PR.
Manual
Created DHIS2 instances of the new image using d2. All started and let me log in.
I could stream the logs see dhis2/d2-cluster-docker-compose#26 (comment)
Details on issues with bind-mounting DHIS2_HOME
https://community.dhis2.org/t/d2-cluster-changes-feedback-needed-on-files-added-to-dhis2-home/51126
No matter where DHIS2_HOME is bind-mounted /DHIS2_home or /opt/dhis2 it has the following effect for rootless images:
Ownership of DHIS2_HOME with bind mount will be that of the host uid/guid. This will take write permission from DHIS2 to DHIS2_HOME.
This is why if you execute
d2 cluster up 2.39.0.1
, you will seeDHIS2_HOME exists in the images before using Jib /DHIS2_home and with using Jib /opt/dhis2. The DHIS2_HOME has the appropriate permission/ownership.
DHIS2_HOME
? Asked in various Slack channels and CoP.