Mercurial > hg > soundsoftware-site
annotate deploy/provision.d/030-webapp-dir.sh @ 1628:9c5f8e24dadc live tip
Quieten this cron script
author | Chris Cannam |
---|---|
date | Tue, 25 Aug 2020 11:38:49 +0100 |
parents | 18643ab36008 |
children |
rev | line source |
---|---|
Chris@1577 | 1 #!/bin/bash |
Chris@1577 | 2 |
Chris@1577 | 3 set -e |
Chris@1577 | 4 |
Chris@1589 | 5 # We might be running in one of two ways: |
Chris@1589 | 6 # |
Chris@1589 | 7 # 1. The code directory is already at /var/www/code, either because a |
Chris@1589 | 8 # previous provisioning step has imported it there or because this |
Chris@1589 | 9 # script has been run before -- in this situation all we do is |
Chris@1589 | 10 # re-check the ownership and permissions. OR |
Chris@1589 | 11 # |
Chris@1589 | 12 # 2. The code directory has not yet been copied to /var/www/code, in |
Chris@1589 | 13 # which case we expect to find it at /code-to-deploy, e.g. as a |
Chris@1589 | 14 # Vagrant shared folder, and we copy it over from there. (We don't |
Chris@1589 | 15 # deploy directly from shared folders as we might not be able to |
Chris@1589 | 16 # manipulate ownership and permissions properly there.) |
Chris@1589 | 17 |
Chris@1577 | 18 if [ ! -d /var/www/code ]; then |
Chris@1587 | 19 if [ ! -d /code-to-deploy ]; then |
Chris@1589 | 20 echo "ERROR: Expected to find code tree at /var/www/code or /code-to-deploy: is the deployment script being invoked correctly?" |
Chris@1587 | 21 exit 2 |
Chris@1587 | 22 fi |
Chris@1587 | 23 cp -a /code-to-deploy /var/www/code |
Chris@1577 | 24 fi |
Chris@1577 | 25 |
Chris@1587 | 26 chown -R code.www-data /var/www/code |
Chris@1605 | 27 chmod 755 /var/www/code |
Chris@1587 | 28 find /var/www/code -type d -exec chmod g+s \{\} \; |
Chris@1587 | 29 |