-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathentrypoint.sh
executable file
·43 lines (38 loc) · 1.29 KB
/
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
#!/bin/bash
# Temp files created by the container will be erasable by external user
umask 0000
# just in case to allow edits from the integrated browser editor
find . \( -type d -exec chmod 777 {} \; \) -o \( -type f -exec chmod 666 {} \; \)
chmod 777 entrypoint.sh bin/* node_modules/* -R
chmod +X tmp -R
# ensure latest updates
bundle install
echo -e "\e[33mUpgrading Decidim..."
bin/rails decidim:upgrade
echo -e "\e[33mTrying to execute migrations..."
if bin/rails db:migrate; then
echo -e "\e[32mDatabase already created. No need for seeding."
else
echo -e "\e[31mMigration failed. Installing database"
bin/rails db:create
echo -e "\e[33mExecuting migrations..."
bin/rails db:migrate
echo -e "\e[32mDatabase just created so let's seed some data..."
bin/rails db:seed
fi
echo -e "\e[33mSeeding hacks content..."
bin/rails db:seed:hacks
echo
echo -e "\e[32mGreat! Please use this user/password to login:"
echo
echo -e "\e[[email protected]"
echo -e "\e[31mdecidim123456789"
echo
echo -e "\e[33mStarting rails server..."
bin/rails server -b 0.0.0.0 2>&1
# stop supervisor if last command failed
if [ $? -ne 0 ]; then
echo -e "\e[31mSomething went wrong. Stopping supervisor..."
echo -e "\e[31mPlease press CTRL+C to stop the container."
kill -QUIT $(cat supervisord.pid)
fi