I cant update 0.7.9 to 0.8.0 in Digital Ocean

June 8, 2016 429 views

I get Bad Gateway all the time. I follow the guide ghost has in the site exactly but I still have the same error.

I'm out of ideas on how to do it. Im not a command line expert. Can someone help me out?

2 Answers

Have you tried creating your ghost blog from the 1-click image. Using that image will help you bypass a lot of the command line work associated with setting it up and should have the most recent version. You can find more info on the one click here.

  • But I have to destroy the actual droplet and start again? I have database and pictures but I will lose the IP Address, right?


Here's a quick copy & paste that you can use from the command line that will take care of updating the OS, upgrading existing OS packages, installing Node.js, setting up a new unprivileged user, setting correct permissions & ownership on /var/www/ghost, updating npm, installing PM2 (to allow Ghost to run without requiring the terminal be open), and finally, installing Ghost. It will then run Ghost as ghostjs (the created unprivileged user).

This was just tested on Ubuntu 15.10 64-bit here at DigitalOcean on a 1GB Droplet. All you need to do is copy & paste the below to your favorite text editor.

For this to work, you'll need to copy and paste the multi-command shown below and do a quick search and replace. Search for DROPLETIP and replace it with the IP address of your Droplet. Once you've replaced DROPLETIP with your Droplet IP, simply paste it in to the CLI and hit enter.

Please keep in mind, this is simply to get you going and will only allow you to access the Ghost installation by using the Droplet IP (though you can point your domain to the IP and use it instead).

If you need to further configure Ghost, you'll need to navigate to /var/www/ghost (using cd /var/www/ghost) and edit the config.js file (nano /var/www/ghost/config.js).

clear \
&& sudo apt-get update \
&& sudo apt-get upgrade -y \
&& sudo apt-get install -y build-essential make automake autoconf git gcc g++ bison flex libssl-dev sqlite curl python python3 libcurl4-openssl-dev software-properties-common zip unzip libcap2-bin \
&& sudo curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash - \
&& sudo apt-get install -y nodejs \
&& sudo curl -L https://ghost.org/zip/ghost-latest.zip -o ghost.zip \
&& sudo mkdir -p /var/www/ghost /var/www/.pm2 \
&& sudo unzip -uo ghost.zip -d /var/www/ghost \
&& cd /var/www/ghost \
&& sudo useradd -d /var/www/ -s /bin/bash ghostjs \
&& mv /var/www/ghost/config.example.js /var/www/ghost/config.js \
&& sed -i 's/my-ghost-blog.com:2368/DROPLETIP/g' /var/www/ghost/config.js \
&& sed -i 's/my-ghost-blog.com/DROPLETIP/g' /var/www/ghost/config.js \
&& sed -i 's/localhost:2368/DROPLETIP/g' /var/www/ghost/config.js \
&& sed -i 's/' /var/www/ghost/config.js \
&& sed -i 's/2368/80/g' /var/www/ghost/config.js \
&& sudo setcap 'cap_net_bind_service=+ep' /usr/bin/nodejs \
&& npm install -g pm2 coffee-script node-gyp node-pre-gyp sqlite \
&& npm install --production \
&& chown -R ghostjs:ghostjs /var/www/ghost \
&& chown -R ghostjs:ghostjs /var/www/.pm2 \
&& su - ghostjs -c "pm2 start /var/www/ghost/index.js -u ghostjs -n ghost"

In regards to the question posed to @etel , if you use the pre-made option, you would deploy a new Droplet and then destroy the other. If you have an existing database, the above multi-command will help you get moving in the right direction without tampering with anything, though I would recommend running it on a fresh Droplet to ensure that anything you've done to your existing will not cause the commands above to fail.

Important Sidenote

Since you mention that you've not too familiar with the CLI, it's worth noting that servers are not, by default, secure and server maintenance is a requirement, not an option. Failure to realize this often results in compromised servers which leads to data leaks and more often than not, data deletion.

VPS's, Dedicated Servers and similar are nothing like shared hosting where the web hosting provider takes care of these things for you, so to truly benefit from the power and speed that more capable options provide, learning the command line and what it takes to properly secure, manage and optimize a web server beyond Ghost (firewalls, ssh, sftp, keys and numerous other things) is something I'd look in to and learn.

Have another answer? Share your knowledge.