From 104b7390daa18c121c1fef88b76debb9bc3d35ce Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Thu, 8 Apr 2021 14:32:19 +0200 Subject: [PATCH] Updated docker entry point so that it tries to download the GeoLite2 db file when the license key was provided --- .dockerignore | 2 +- docker/config/shlink_in_docker.local.php | 2 +- docker/docker-entrypoint.sh | 6 ++++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.dockerignore b/.dockerignore index f9102acb..9fb114c1 100644 --- a/.dockerignore +++ b/.dockerignore @@ -5,7 +5,7 @@ data/log/* data/locks/* data/proxies/* data/migrations_template.txt -data/GeoLite2-City.* +data/GeoLite2-City* data/database.sqlite data/shlink-tests.db CHANGELOG.md diff --git a/docker/config/shlink_in_docker.local.php b/docker/config/shlink_in_docker.local.php index 4ddd52e5..d022f79d 100644 --- a/docker/config/shlink_in_docker.local.php +++ b/docker/config/shlink_in_docker.local.php @@ -170,7 +170,7 @@ return [ ], 'geolite2' => [ - 'license_key' => env('GEOLITE_LICENSE_KEY', 'G4Lm0C60yJsnkdPi'), + 'license_key' => env('GEOLITE_LICENSE_KEY', 'G4Lm0C60yJsnkdPi'), // Deprecated. Remove the default value ], 'mercure' => $helper->getMercureConfig(), diff --git a/docker/docker-entrypoint.sh b/docker/docker-entrypoint.sh index df480d2f..1f9337c4 100644 --- a/docker/docker-entrypoint.sh +++ b/docker/docker-entrypoint.sh @@ -15,6 +15,12 @@ php vendor/doctrine/orm/bin/doctrine.php orm:generate-proxies -n -q echo "Clearing entities cache..." php vendor/doctrine/orm/bin/doctrine.php orm:clear-cache:metadata -n -q +# Try to download GeoLite2 db file only if the license key env var was defined +if [ ! -z "${GEOLITE_LICENSE_KEY}" ]; then + echo "Downloading GeoLite2 db file..." + php bin/cli visit:download-db -n -q +fi + # When restarting the container, swoole might think it is already in execution # This forces the app to be started every second until the exit code is 0 until php vendor/bin/laminas mezzio:swoole:start; do sleep 1 ; done