Setting up Ghost to use DigitalOcean Spaces storage integration
Update 1/13/2023: Added background information about DigitalOcean Spaces.
I've wanted to integrate DigitalOcean for my blog for a while and decided to try the platform since it is straightforward to use and integrate into the site. This would reduce the headaches and overhead of managing local storage inside my Droplet. Without further ado, Let's dig into the details.
DigitalOcean Spaces is a simple object storage that allows customers upload content on their cloud servers and scale up when needed. It is $5/month per 250GB of content. Anything over that will be billed as $0.02/GiB/month. If you are interested in doing business with DigitalOcean, please sign up via my referral link here. Not sponsored by them in any capacity, but I use their products regularly for both production and training purposes.
- DigitalOcean account and Ghost Droplet provisioned via One-Click Install
- DigitalOcean Spaces bucket (that is hosted on the same region as the bucket)
- Internet connection
- SSH terminal
- Some knowledge of Linux (ideally, Ubuntu Server)
- Latest version of Ghost 5
If you have your Ghost instance on, please stop the service before continuing this tutorial.
- Open a terminal or command prompt window.
- Login into your Droplet via your favorite SSH client.
- Enter any SSH password if prompted.
- Once you're inside, use the provided Ghost user that you are managing for your website.
sudo -i -u ghost-mgr
- Then, navigate to the folder that contains the Ghost files. Droplets that DigitalOcean's One-Click Install has provisioned will reside in
- Next, navigate over to the
- Inside this folder, you will need to invoke
yarn add ghost-storage-adapter-s3to install the dependency on your existing site.
- Now, we will need to copy the
node_modulesfolder into the
/var/www/ghost/versions/5.x.x/core/adapters/storage/s3. You will need to use
sudofor this action.
cp -r node_modules/ghost-storage-adapter-s3 /var/www/ghost/versions/5.x.x/core/server/adapters/storage/s3
- Finally, in the
/var/www/ghost/folder, edit the
config.production.jsonand add the following snippet:
Before you start using this adapter
ghost doctorto see if there are any issues with the created folders and fix them if necessary.
- Any assets that you've created in the past will be broken upon restart of the service.
Once you're happy with the configuration, spin back up Ghost by invoking
If you liked this tutorial, let me know in the comments below and don't forget to subscribe to my email newsletters so that you don't miss out any new posts I publish in the future.