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

Small changes to the docker-entrypoint #129

Open
1 task done
moovida opened this issue Dec 4, 2024 · 1 comment
Open
1 task done

Small changes to the docker-entrypoint #129

moovida opened this issue Dec 4, 2024 · 1 comment
Labels
feature New feature or request

Comments

@moovida
Copy link
Contributor

moovida commented Dec 4, 2024

Checklist

  • I've searched through the current issues to make sure this feature hasn't been requested already.

Motivation

I like to test both devel and prod mode of the suite using the official docker image and mounting the code into it.

In this case, if a plugin is added to the g3w-admin, that needs to install some pip requirements, I do that in the docker-entrypoint.sh and mount it in the docker-compose file and set it in the same docker compose as the entrypoint to use.

This works well, but some of the commands in the original entrypoint shipped in this repo are not understood, probably due to the fact that the shell used on startup is not a bash.

There are only two small changes that can make the script compatible that I would like to propose.

Suggested solution

This is the diff I would propose for the enrtypoint file:

diff --git a/scripts/docker-entrypoint.sh b/scripts/docker-entrypoint.sh
index 96c2a0a..7536d3f 100755
--- a/scripts/docker-entrypoint.sh
+++ b/scripts/docker-entrypoint.sh
@@ -6,7 +6,7 @@
 figlet -t "G3W-SUITE Docker by Gis3w"
 
 # Start XVfb
-if [[  -f /tmp/.X99-lock ]]; then
+if [  -f /tmp/.X99-lock ]; then
   rm /tmp/.X99-lock
 fi
 Xvfb :99 -screen 0 640x480x24 -nolisten tcp &
@@ -14,10 +14,11 @@ export DISPLAY=:99
 export QGIS_SERVER_PARALLEL_RENDERING=1
 # Start
 cd /code/g3w-admin
 
 # Activate the front end app settings
 
-if [[ "${FRONTEND}" =~ [Tt][Rr][Uu][Ee] ]] ; then
+if echo "${FRONTEND}" | grep -iq "^true$"; then
  1. the first double square brackets should not be necessary, since there is no pattern matching anyways. Therefore just a change to single brackets.
  2. in the second case a case insensitive check on true is done, which could be solved using echo and grep

This allows proper startup of the overridden entrypoint.

Alternatives considered

No response

@moovida moovida added the feature New feature or request label Dec 4, 2024
@moovida
Copy link
Contributor Author

moovida commented Dec 6, 2024

One small change slipped through my check before. This would be the complete change:

diff --git a/scripts/docker-entrypoint.sh b/scripts/docker-entrypoint.sh
index 96c2a0a..a2215c4 100755
--- a/scripts/docker-entrypoint.sh
+++ b/scripts/docker-entrypoint.sh
@@ -6,7 +6,7 @@
 figlet -t "G3W-SUITE Docker by Gis3w"
 
 # Start XVfb
-if [[  -f /tmp/.X99-lock ]]; then
+if [  -f /tmp/.X99-lock ]; then
   rm /tmp/.X99-lock
 fi
 Xvfb :99 -screen 0 640x480x24 -nolisten tcp &
@@ -14,12 +14,13 @@ export DISPLAY=:99
 export QGIS_SERVER_PARALLEL_RENDERING=1
 # Start
 cd /code/g3w-admin
 
 # Activate the front end app settings
 
-if [[ "${FRONTEND}" =~ [Tt][Rr][Uu][Ee] ]] ; then
+if echo "${FRONTEND}" | grep -iq "^true$"; then
   SETTINGS_LOCKFILE=/shared-volume/.settings.lockfile
-  if [[ ! -f ${SETTINGS_LOCKFILE} ]]; then
+  if [ ! -f $SETTINGS_LOCKFILE ]; then
     echo "FRONTEND = True"  >> /code/g3w-admin/base/settings/local_settings.py
     echo "FRONTEND_APP = 'frontend'" >> /code/g3w-admin/base/settings/local_settings.py
     touch ${SETTINGS_LOCKFILE}

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

No branches or pull requests

1 participant