Skip to content

Instantly share code, notes, and snippets.

@Chovin
Last active March 26, 2025 15:29
Show Gist options
  • Select an option

  • Save Chovin/722b45f2205eccac7677a0dfb8857ad1 to your computer and use it in GitHub Desktop.

Select an option

Save Chovin/722b45f2205eccac7677a0dfb8857ad1 to your computer and use it in GitHub Desktop.
wordpress on free google compute

Wordpress (almost) Free on Google Compute

Most of this came from an article that I can't seem to find anymore

  1. create a google cloud account / turn on compute
  2. create a free tier compute instance
  3. purchase a domain
  4. set up a static ip (costs ~ $3.60/month)
  5. set up dns
  6. ssh into compute instance
  7. install docker in rootless mode
    1. sudo apt-get install -y dbus-user-session # don't remember if this is needed
    2. cat <<EOF | sudo sh -x
      apt-get -y install uidmap
      EOF
    3. curl -fsSL https://get.docker.com/rootless | sh
  8. allow rootless docker user to bind low port numbers: sudo setcap cap_net_bind_service=ep $(which rootlesskit)
  9. install git if not already installed
  10. set up swapfile so that wordpress has more memory to work with
    1. sudo fallocate -l 4G /swapfile
    2. sudo chmod 600 /swapfile
    3. sudo mkswap /swapfile
    4. sudo swapon /swapfile
    5. sudo vi /etc/fstab
    6. add to the end of the file /swapfile none swap sw 0 0
  11. set up crontab to restart server every day to deal with memory leaks and large swapfiles slowing down the site
    1. sudo crontab -e
    2. 0 0 * * * /sbin/shutdown -r
  12. git clone https://github.com/Chovin/nginx-proxy-snippet.git
  13. cd into it and set up .env
  14. docker compose up -d
  15. cd ..
  16. git clone https://github.com/Chovin/wordpress-docker-compose.git
  17. cd into it and set up .env
  18. docker compose up -d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment