forked from brentkearney/workshops
-
Notifications
You must be signed in to change notification settings - Fork 0
/
entrypoint.sh.example
executable file
·79 lines (66 loc) · 2.14 KB
/
entrypoint.sh.example
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/bin/bash
set -e
echo
echo "Welcome to OS:"
uname -v
cat /etc/issue
echo
echo "Setting system timezone..."
export DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true
echo "tzdata tzdata/Areas select America" > /tmp/tz.txt
echo "tzdata tzdata/Zones/America select Edmonton" >> /tmp/tz.txt
debconf-set-selections /tmp/tz.txt
rm /etc/timezone
rm /etc/localtime
dpkg-reconfigure --frontend noninteractive tzdata
# First-time run only
echo
echo "Create gemset..."
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
/usr/bin/curl -sSL https://get.rvm.io | bash -s stable
/usr/local/rvm/bin/rvm gemset create ruby-2.5.3
/usr/local/rvm/bin/rvm gemset use ruby-2.5.3@global
/usr/local/rvm/bin/rvm cleanup all
/usr/local/rvm/bin/rvm reload
echo
echo "Installing latest bundler..."
/usr/local/rvm/bin/rvm-exec 2.5.3 gem update --system
/usr/local/rvm/bin/rvm-exec 2.5.3 gem install bundler
# /usr/local/rvm/bin/rvm-exec 2.5.3 gem install rubygems-bundler
# echo
# echo "Bundle update rails..."
# RAILS_ENV=development /usr/local/rvm/bin/rvm-exec 2.5.3 bundle update rails
echo
echo "Bundle install..."
RAILS_ENV=development /usr/local/rvm/bin/rvm-exec 2.5.3 bundle install
# echo
# echo "Bundle update..."
# RAILS_ENV=development /usr/local/rvm/bin/rvm-exec 2.5.3 bundle update
echo
echo "Running migrations..."
rake db:migrate RAILS_ENV=development
rake db:migrate RAILS_ENV=test
# rake db:migrate RAILS_ENV=production
if [ -e lib/tasks/ws.rake ]; then
# Default settings
echo
echo "Adding default Settings..."
rake ws:init_settings
echo
echo "Creating admins..."
rake ws:create_admins RAILS_ENV=development
fi
echo
echo "Changing to non-root file permissions..."
chown -R app:app /usr/local/rvm/gems
if [ ! -e /home/app/workshops/tmp ]; then
mkdir -p /home/app/workshops/tmp
mkdir -p /home/app/workshops/vendor/cache
fi
chown -R app:app /home/app/workshops
echo
echo "Compiling Assets..."
su - app -c "cd /home/app/workshops; RAILS_ENV=development SECRET_KEY_BASE=token bundle exec rake assets:precompile --trace"
echo
echo "Starting web server..."
bundle exec passenger start