-
Notifications
You must be signed in to change notification settings - Fork 1
/
deploy.sh
executable file
·49 lines (38 loc) · 1.08 KB
/
deploy.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
#!/bin/sh
chown -R magiclab:magiclab ../
sudo -u magiclab git pull
#put all our needed gems in vendors
echo building gems
bundle install --path vendor/bundle
#migrate anything new
echo running migrations
bundle exec rake db:migrate RAILS_ENV="production"
bundle exec rake db:seed RAILS_ENV="production"
#remove previous assets
echo removing previous assets
rm -R /var/www/icd1/container/public/assets/*
# precompile assets (if you need to debug delete all in /public/assets)
echo precompiling assets
bundle exec rake assets:precompile --trace RAILS_ENV=production
#change permissions
echo ensuring permissions
chown -R www-data:www-data ../container/
#restart workers
echo killing all previous ruby and icd processes
/etc/init.d/icd stop
killall ruby
sleep 5
echo starting workers
/etc/init.d/icd start
#reset server
echo killing nginx
killall nginx
echo restarting nginx
/etc/init.d/nginx restart
#restart workers
#echo starting workers with foreman -f Procfile
#foreman start -f Procfile &
#echo restarting workers
#cd /var/www/icd
#sh start-workers.sh stop
#sh start-workers.sh start