-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupdate_latest.sh
executable file
·41 lines (30 loc) · 1.08 KB
/
update_latest.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
#!/usr/bin/env bash
# Update to latest commit
cd /var/www/oscar/builds/latest
git pull --ff-only 2> /dev/null
[ $? -gt 0 ] && echo "Git pull failed" >&2 && exit 1
# Remove existing pyc files
find . -type f -name "*.pyc" -delete
# Update any dependencies
source ../../virtualenvs/latest/bin/activate
python setup.py develop
pip install -r requirements.txt
# Update sandbox database
cd sites/sandbox
./manage.py migrate
# Rebuild statics
./manage.py collectstatic --noinput
./manage.py thumbnail clear
# Load standard fixtures
./manage.py loaddata ../_fixtures/promotions.json
# Restart Tomcat (to pick up any Solr schema changes)
/etc/init.d/tomcat7 restart
# Re-compile python code
touch deploy/wsgi/latest.wsgi
# Copy down server config files
cp deploy/nginx/latest.conf /etc/nginx/sites-enabled/latest.oscarcommerce.com
/etc/init.d/nginx configtest 2> /dev/null && /etc/init.d/nginx force-reload 2> /dev/null
cp deploy/supervisord/latest.conf /etc/supervisor/conf.d/latest.conf
supervisorctl reread && supervisorctl reload
# Copy down cronjob file
cp deploy/cron.d/oscar /etc/cron.d/oscar-latest