aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Magorsch <max@magorsch.de>2019-09-05 16:12:58 +0200
committerMax Magorsch <max@magorsch.de>2019-09-05 16:12:58 +0200
commita3a60ea3ae355d6a39fda1f07f3d79644ddd2a41 (patch)
treec1dd484b81a21228067f66a9cb0bf5ae725486fd /bin/first-run
parentUse docker volumes for the portage tree (diff)
downloadpackages-5-a3a60ea3ae355d6a39fda1f07f3d79644ddd2a41.tar.gz
packages-5-a3a60ea3ae355d6a39fda1f07f3d79644ddd2a41.tar.bz2
packages-5-a3a60ea3ae355d6a39fda1f07f3d79644ddd2a41.zip
Run the initialization scripts using docker-composefeature/es-7.3develop
docker-compose can be used to deploy the application. The index will be initialized and updated. Furthermore a cron job will be registered for production environments to update the index every 10 minutes. ° Signed-off-by: Max Magorsch <max@magorsch.de>
Diffstat (limited to 'bin/first-run')
-rwxr-xr-xbin/first-run22
1 files changed, 16 insertions, 6 deletions
diff --git a/bin/first-run b/bin/first-run
index dd06ce2..63130ed 100755
--- a/bin/first-run
+++ b/bin/first-run
@@ -1,8 +1,18 @@
#!/bin/bash
-bundle install --deployment
-bundle exec rake tmp:create
-bundle exec rake assets:precompile
-bundle exec rake kkuleomi:index:init
-bundle exec rake kkuleomi:seed:all
-./update-all.sh
+# Wait for Elasticsearch to start up
+sleep 30
+
+bundler install
+bundle exec rake tmp:create RAILS_ENV=${1:-development}
+bundle exec rake assets:precompile RAILS_ENV=${1:-development}
+bundle exec rake kkuleomi:index:init RAILS_ENV=${1:-development}
+./bin/update-all.sh ${1:-development}
+
+if [[ "${1:-development}" == "production" ]]
+then
+ crontab -l | { cat; echo "*/10 * * * * /var/www/packages.gentoo.org/htdocs/bin/update-all.sh ${1:-development}"; } | crontab -
+fi
+
+# Finally start the http server when the index is initialized
+bundle exec thin start -p 5000 \ No newline at end of file