Last active
March 26, 2017 12:10
-
-
Save nikosolihin/3dd0a678f232c6946d5e68bf054d76e7 to your computer and use it in GitHub Desktop.
deploy.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -x | |
# App directories | |
APP_WEB_DIR="/var/www/html/wp-content/themes/client" | |
APP_GIT_DIR="/var/www/.git/" | |
# Stop server | |
echo "Stopping nginx..." | |
sudo systemctl stop nginx | |
# Remove current theme folder | |
echo "Removing current theme folder..." | |
sudo rm -rf ${APP_WEB_DIR} | |
sudo mkdir ${APP_WEB_DIR} | |
# Copy the repo content to the server live directory | |
echo "Copying working tree into theme folder..." | |
sudo git --work-tree=${APP_WEB_DIR} --git-dir=${APP_GIT_DIR} checkout -f | |
# Give nginx's document root to www-data | |
echo "Chowning nginx's root..." | |
sudo chown -R www-data:www-data /var/www/html | |
# Start server | |
echo "Starting nginx..." | |
sudo systemctl start nginx |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment