Skip to content

Commit

Permalink
Copying existing config files and using them for restore copies.
Browse files Browse the repository at this point in the history
  • Loading branch information
huertanix committed Feb 19, 2018
1 parent b969683 commit 982c402
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion config/ghost/config.production.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"connection": {
"host": "localhost",
"user": "ghost",
"password": "4f4f2a8d6453316891c59c635f245223c4fa83a31521378a",
"password": "DB_PASSWORD_PLACEHOLDER",
"database": "ghost_production"
},
"debug": false
Expand Down
2 changes: 1 addition & 1 deletion config/ghost/config.production.json.orig
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"connection": {
"host": "localhost",
"user": "ghost",
"password": "4f4f2a8d6453316891c59c635f245223c4fa83a31521378a",
"password": "",
"database": "ghost_production"
}
},
Expand Down
12 changes: 9 additions & 3 deletions setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ apt-get -y --force-confold install tor deb.torproject.org-keyring
#apt-get -y install unattended-upgrades
#cp blooming-onion/config/apt/20auto-upgrades /etc/apt/apt.conf.d/.

# Copy original config in case it needs to be restored later
cp blooming-onion/config/tor/torrc ./tor/torrc.orig

echo 'Setting up Tor onion service and waiting 5 seconds for .onion address creation...'
cp blooming-onion/config/tor/torrc /etc/tor/.
service tor reload
Expand All @@ -30,13 +33,16 @@ sleep 5s
ONION_ADDRESS=`cat /var/lib/tor/hidden_service/hostname`

if [ -n "$ONION_ADDRESS" ]; then
# Copy for future restore
cp /etc/nginx/sites-available/ghost blooming-onion/config/nginx/ghost.orig
echo 'Setting up the web server NGINX to use Tor onion service...'
cp blooming-onion/config/nginx/ghost /etc/nginx/sites-available/.
sed -i 's/ONION_PLACEHOLDER/'$ONION_ADDRESS'/g' /etc/nginx/sites-available/ghost

# Copy for future restore
cp /var/www/ghost/config.production.json blooming-onion/config/ghost/config.production.json.orig
echo 'Updating Ghost config to use .onion address...'
cp blooming-onion/config/ghost/config.production.json /var/www/ghost/.
sed -i 's/ONION_PLACEHOLDER/'$ONION_ADDRESS'/g' /var/www/ghost/config.production.json
#cp blooming-onion/config/ghost/config.production.json /var/www/ghost/.
sed -i 's/\"url\": \"http:\/\/.*\"/\"url\": \"http:\/\/'$ONION_ADDRESS'\"/g' /var/www/ghost/config.production.json

echo 'Restarting NGINX...'
service nginx reload
Expand Down

0 comments on commit 982c402

Please sign in to comment.