|
@ -58,59 +58,33 @@ schema_seminar.pdf: |
|
|
schema_all.pdf: |
|
|
schema_all.pdf: |
|
|
./manage.py graph_models -a -g | dot -Tpdf > schema_all.pdf |
|
|
./manage.py graph_models -a -g | dot -Tpdf > schema_all.pdf |
|
|
|
|
|
|
|
|
# remote commands
|
|
|
# Deploy to current *mamweb-test* directory
|
|
|
|
|
|
deploy_test: |
|
|
TEST_USER=test-mam |
|
|
@if [[ `pwd` != "/akce/MaM/WWW/mamweb-test" ]]; then echo "Only possible in /akce/MaM/WWW/mamweb-test"; exit 1; fi |
|
|
TEST_SERVER=atrey.karlin.mff.cuni.cz |
|
|
@echo "Installing version from origin/master ..." |
|
|
TEST_DIR=/home/test-mam/mamweb-test/ |
|
|
git pull origin master |
|
|
|
|
|
git clean -f |
|
|
PROD_USER=test-mam |
|
|
make install |
|
|
PROD_SERVER=atrey.karlin.mff.cuni.cz |
|
|
./manage.py migrate |
|
|
PROD_DIR=/home/test-mam/mamweb-prod/ |
|
|
./manage.py collectstatic --noinput |
|
|
|
|
|
(chown -Rf :mam . || true ) |
|
|
HEAD=`git log --color=never |head -1|sed 's/.*commit //'` |
|
|
(chmod -Rf g+w . || true ) |
|
|
|
|
|
touch mamweb/wsgi.py |
|
|
push_test: |
|
|
@echo Done. |
|
|
@echo "Checking out commited HEAD (${HEAD}) state at ${TEST_SSH} ..." |
|
|
|
|
|
git tag deploy-test-`date +%Y-%m-%d-%H-%M`-${USER} |
|
|
# Deploy to current *mamweb-prod* directory
|
|
|
git push --all |
|
|
deploy_prod: |
|
|
ssh ${TEST_USER}@${TEST_SERVER} -n -x "\
|
|
|
@if [[ `pwd` != "/akce/MaM/WWW/mamweb-prod" ]]; then echo "Only possible in /akce/MaM/WWW/mamweb-prod"; exit 1; fi |
|
|
cd ${TEST_DIR} && \
|
|
|
@echo "Backing up production DB ..." |
|
|
git fetch --all && \
|
|
|
cd .. && ./backup_prod_db.sh |
|
|
git checkout ${HEAD} -f && \
|
|
|
@echo "Installing version from origin/stable ..." |
|
|
git clean -f && \
|
|
|
git pull origin stable |
|
|
cp mamweb/settings_test.py mamweb/settings.py && \
|
|
|
git clean -f |
|
|
make install && \
|
|
|
make install |
|
|
./manage.py collectstatic --noinput && \
|
|
|
./manage.py migrate |
|
|
./manage.py migrate --noinput && \
|
|
|
./manage.py collectstatic --noinput |
|
|
(chown -Rf :mam . || true ) && \
|
|
|
(chown -Rf :mam . || true ) |
|
|
(chmod -Rf g+w . || true ) && \
|
|
|
(chmod -Rf g+w . || true ) |
|
|
echo 'Reloading apache ... (You may have to start it manually on error!)' && \
|
|
|
touch mamweb/wsgi.py |
|
|
~/etc/apache2/apache2ctl -k restart && \
|
|
|
@echo Done. |
|
|
echo Done."
|
|
|
|
|
|
@echo "Test pushed to ${TEST_SERVER}:${TEST_DIR} successfully." |
|
|
|
|
|
|
|
|
|
|
|
push_prod: |
|
|
|
|
|
@echo "Checking out commited HEAD (${HEAD}) state at ${PROD_SSH} ..." |
|
|
|
|
|
git tag deploy-prod-`date +%Y-%m-%d-%H-%M`-${USER} |
|
|
|
|
|
git push --all |
|
|
|
|
|
ssh ${PROD_USER}@${PROD_SERVER} -n -x "\
|
|
|
|
|
|
echo 'Stopping apache ... (You may have to start it manually on error!)' && \
|
|
|
|
|
|
~/etc/apache2/apache2ctl -k stop && \
|
|
|
|
|
|
cd ${PROD_DIR} && \
|
|
|
|
|
|
./backup_prod_db.sh && \
|
|
|
|
|
|
git fetch --all && \
|
|
|
|
|
|
git checkout ${HEAD} -f && \
|
|
|
|
|
|
git clean -f && \
|
|
|
|
|
|
cp mamweb/settings_prod.py mamweb/settings.py && \
|
|
|
|
|
|
make install && \
|
|
|
|
|
|
./manage.py collectstatic --noinput && \
|
|
|
|
|
|
./manage.py migrate --noinput && \
|
|
|
|
|
|
(chown -Rf :mam . || true ) && \
|
|
|
|
|
|
(chmod -Rf g+w . || true ) && \
|
|
|
|
|
|
echo 'Starting apache ... (You may have to start it manually on error!)' && \
|
|
|
|
|
|
~/etc/apache2/apache2ctl -k start && \
|
|
|
|
|
|
echo Done."
|
|
|
|
|
|
@echo "Deployed to ${PROD_SERVER}:${PROD_DIR} successfully." |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|