Skip to content
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

build(all): Decouple Docker from Maven #27

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

igbanam
Copy link
Contributor

@igbanam igbanam commented Oct 22, 2024

While building out the utilities, we want to vend some packages as Docker images.

Our current build builds like this

┌─────────┐     ┌───────┐          ┌────────┐     ┌───────┐
│ machine │ ··> │ maven │ ·······> │ docker │ ··> │ image │
└─────────┘     └───────┘  :       └────────┘     └───────┘
                           :       ┌────────┐
                           └·····> │  app   │
                                   └────────┘

Ideally, we want to be able to build like this

┌─────────┐     ┌───────┐     ┌─────┐
│ machine │ ··> │ maven │ ··> │ app │
└─────────┘     └───────┘     └─────┘
┌─────────┐     ┌───────┐
│ docker  │ ··> │ image │
└─────────┘     └───────┘

…a clean separation of concerns.

This would also remove the dependence on the docker-compose plugin which uses the deprecated docker-compose command.

@igbanam igbanam self-assigned this Oct 22, 2024
@igbanam igbanam marked this pull request as ready for review October 24, 2024 02:40
@igbanam
Copy link
Contributor Author

igbanam commented Oct 26, 2024

Summary from Slack:

  • The image produced by the PR doesn't work™

Suggested changes

  • Bring back the empty properties files
  • Undo docker.context.xml renaming because this affects the metrics URL

Questions for @ademarcqrtsl

  • Why do we need 4 empty properties files?
    • why not just one?
    • why not more than four?
  • Could we have some documentation on how to run this?

@ademarcqrtsl
Copy link
Contributor

@igbanam ,

The empty properties deletion is harmless. What broke the image was renaming /app/rtsl/prom_db_exporter/prom_db_exporter.5.docker.properties to /app/rtsl/prom_db_exporter/docker.properties without reflecting the change in /usr/local/tomcat/conf/Catalina/localhost/*.xml

The empty properties deletion should be undone because they are placeholders, and it will be easier for people to find them if they are empty files (we can discuss it if you have better ideas on this and/or comments)

@ademarcqrtsl
Copy link
Contributor

ademarcqrtsl commented Oct 26, 2024

More context regarding the empty files.

That app loads its config by merging X properties files to get its final consolidated configuration. In order it loads (from file https://github.com/simpledotorg/rtsl_utils/blob/igbanam/sc-13779/extract-pde-image-build/Webapps/PrometheusDatabaseExporterWar/src/main/resources/spring.main.xml ):

  1. default.properties (inside the war itself, contains defaults described in the documentation)
  2. X properties with paths injected by environment variables / tomcat context XML

/app/rtsl/prom_db_exporter/prom_db_exporter.5.docker.properties Is loaded last and should contain all the things we want to more or less hard code in image. (like paths, mapping with environment variables ...)

Docker being by design made to be extended (layers), we're having more than one file to make this easy to extend by just COPY on property file that we want for each layer.

Classical layers for images in delivery can be

  • solution (dhis2/simple ...)
  • project (india/ nigeria ...)
  • environment (test/ production ...)

This part can be discussed if you find it complex to understand.

I'm taking the point for updating the documentation on image usage / extension

@ademarcqrtsl
Copy link
Contributor

Also, the content of the Image has been merged with the content of the WAR. This is not something we want as the two set of configuration serve different purpose.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants