-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-entrypoint.sh
49 lines (42 loc) · 1.38 KB
/
docker-entrypoint.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/bin/bash
echo "Creating log folder"
mkdir -p $APP_WORKDIR/log
if [ "$RAILS_ENV" = "production" ]; then
# Verify all the production gems are installed
bundle check
else
# install any missing development gems (as we can tweak the development container without rebuilding it)
bundle check || bundle install --without production
fi
# wait for Solr and Fedora to come up
sleep 15s
## Run any pending migrations, if the database exists
## If not setup the database
if bundle exec rake db:exists
then
bundle exec db:migrate
else
bundle exec rake db:setup
bin/rails hyrax:default_admin_set:create
bin/rails hyrax:default_collection_types:create
bundle exec rake hyrax:workflow:load
fi
# check that Solr is running
SOLR=$(curl --silent --connect-timeout 45 "http://${SOLR_HOST:-solr}:${SOLR_PORT:-8983}/solr/" | grep "Apache SOLR")
if [ -n "$SOLR" ] ; then
echo "Solr is running..."
else
echo "ERROR: Solr is not running"
exit 1
fi
# check that Fedora is running
FEDORA=$(curl --silent --connect-timeout 45 "http://${FEDORA_HOST:-fcrepo}:${FEDORA_PORT:-8080}/fcrepo/" | grep "Fedora Commons Repository")
if [ -n "$FEDORA" ] ; then
echo "Fedora is running..."
else
echo "ERROR: Fedora is not running"
exit 1
fi
# echo "--------- Starting Hyrax in $RAILS_ENV mode ---------"
rm -f /tmp/hyrax.pid
bundle exec rails server -p 3000 -b '0.0.0.0' --pid /tmp/hyrax.pid