Skip to content

Commit

Permalink
Update blog
Browse files Browse the repository at this point in the history
  • Loading branch information
scottleechua committed Nov 20, 2024
1 parent abdef72 commit de36567
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions _posts/2023-09-10-self-hosting-ghost-on-google-cloud.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ The whole thing takes 1-2 hours depending on your comfort level with the various
- Operating system: `Ubuntu`
- Version: `Ubuntu 22.04 LTS x86/64`
- Boot disk type: `Standard persistent disk`
- Size (GB): 25
- Firewall:
- `Allow HTTP traffic`
- `Allow HTTPS traffic`
Expand Down Expand Up @@ -169,6 +170,32 @@ The whole thing takes 1-2 hours depending on your comfort level with the various
su - service_account
```

#### Create swapfile
To minimize the chance of Ghost running out of memory on a small virtual machine like this one, create a swapfile---a preallocated amount of disk storage that the RAM can overflow to.

1. Allocate 2GB to a swapfile that only root can access:
```bash
sudo fallocate -l 2G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
```

2. To make the swapfile persistent, open the file:
```bash
sudo nano /etc/fstab
```
and add this line at the bottom:
```bash
/swapfile swap swap defaults 0 0
```

3. Now running:
```bash
sudo free -h
```
should show `Swap: 2.0G`.

#### Install Ghost dependencies
1. Install Nginx and open the firewall:

Expand Down Expand Up @@ -471,6 +498,8 @@ This walkthrough last worked for me in **September 2023**. If you spot errors, v
## Changelog
- **2024-11-20**: Create a 25GB boot disk and [set up swapfiles](https://linuxize.com/post/create-a-linux-swap-file/) immediately upon Ghost setup in order to stave off Ghost websites going offline due to virtual machines running out of memory.
- **2024-11-17**: Remove Secure Boot recommendation as the setting doesn't always stick, and seems to create more trouble when SSH-ing; revert Nodejs installation from using `nvm` to direct installation; update Mailgun instructions to use a mail-specific subdomain (`mg`) by default.

- **2024-10-02**: Add setting to autodelete disk snapshots after 7 days to minimize costs, as snapshot storage is no longer included in the Free Tier.
Expand Down

0 comments on commit de36567

Please sign in to comment.