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

fix(docker-jans-monolith): improve monolith behavior during restarts #8502

Merged
merged 8 commits into from
May 23, 2024

Conversation

tawaren
Copy link
Contributor

@tawaren tawaren commented May 13, 2024

Description

Improved restarting (docker stop/start & docker compose down/up) behaviour. The monolith can now be restarted after a down without the need to run the install script again. Further, the container can be restarted without leading to an increease in the containers size.

Target issue

  • On each monolith restart the conrainer size grew by a few 100 megabytes
  • After a down followed by an up the database was in a post-installation state but the container was in a pre-installation state
    Ref: Diskspace usage increate after restart #8414

Implementation Details

  • restart (or stop then start): CMD in Dockerfile will clean the jetty temp directory to prevent disk size growth.
  • down then up: added scripts (down.sh and up.sh) that create a post installation image on a down and use it on a later up such that only the first up runs the installation script.
  • clean: added clean.sh script to remove all docker artifacts (allows for a fresh start with new installation script run)
  • Guidelines: Updated README.md and Guiding echoes in startjanssenmonolithdemo.sh
  • host mounted log files: The log files are now mounted on the host to improve access to them and being capable to delete them easily

Signed-off-by: Markus Knecht markus.knecht85@gmail.com

 - restart (or stop then start): CMD in Dockerfile will now clean the jetty temp directory to prevent disk size grow
 - down then up: added scripts (down.sh and up.sh) that create a post installation image on a down and use it on a later up such that only first up runs the installation script
 - clean: added clean.sh script to remove all docker artifacts (allows for a fresh start)
 - Guidelines: Updated README.md and Guiding echoes in startjanssenmonolithdemo.sh
 - host mounted log files: The log files are now mounted on the host to improve access to them and being capable to delete them easily
@tawaren tawaren requested review from moabu and iromli as code owners May 13, 2024 13:55
@ossdhaval
Copy link
Contributor

@tawaren thanks for submitting the PR. Can you please add the DCO to your commit?

Signed-off-by: Mohammad Abudayyeh <47318409+moabu@users.noreply.github.com>
fi

export JANSSEN_IMAGE
docker compose -f ${yaml} up
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would make more sense to run this in detached mode.

@moabu moabu changed the title Improved Monolith behavior during restarts fix(docker-jans-monolith): improve monolith behavior during restarts May 15, 2024
echo -e "To clean up run:"
echo -e "docker compose -f /tmp/jans/docker-jans-monolith/jans-mysql-compose.yml down && rm -rf /tmp/jans"
echo -e "or docker compose -f /tmp/jans/docker-jans-monolith/jans-postgres-compose.yml down && rm -rf /tmp/jans"
echo -e "/tmp/jans/docker-jans-monolith/clean.sh mysql rm && -rf /tmp/jans"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems a typo of placing rm before &&.

elif [[ $JANS_PERSISTENCE == "LDAP" ]]; then
docker compose -f /tmp/jans/docker-jans-monolith/jans-ldap-compose.yml up -d
fi
/tmp/jans/docker-jans-monolith/up.sh ldap
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing fi syntax.

@@ -72,12 +72,11 @@ if [[ "$JANS_BUILD_COMMIT" ]]; then
fi
# --
if [[ $JANS_PERSISTENCE == "MYSQL" ]]; then
docker compose -f /tmp/jans/docker-jans-monolith/jans-mysql-compose.yml up -d
/tmp/jans/docker-jans-monolith/up.sh mysql
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Running the up.sh script will throw Permission denied because it's not executable. Probably run the script with bash /tmp/jans/... instead.

Merging changes since fork into pull request
 - rm after && in command hint
 - starting up in detached mode
 - stating bash explicitly for executing the scripts
 - added missing fi

Signed-off-by: Markus Knecht markus.knecht85@gmail.com
@tawaren
Copy link
Contributor Author

tawaren commented May 21, 2024

I added the requested changes

@ossdhaval ossdhaval requested review from iromli and moabu May 21, 2024 09:49
docker-jans-monolith/clean.sh Outdated Show resolved Hide resolved
Signed-off-by: Markus Knecht <markus.knecht85@gmail.com>
@tawaren
Copy link
Contributor Author

tawaren commented May 22, 2024

Changed the misstyping in the variable names

@moabu moabu merged commit 13278a9 into JanssenProject:main May 23, 2024
2 checks passed
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.

None yet

4 participants