Sun, May 24, 2020
How to deploy STATEFUL container on DigitalOcean
The examples of usage includes,
- When you want to use MongoDB Atlas beyond free tier limits; or other self-hosted database
- Self-hosted WordPress
- Self-hosted stateful docker container, such as Remark42 or Isso.
(I have done all three.)
Actually, it's the answer to this question.
The steps required are
- Create a droplet on DigitalOcean. An easy way is to be preinstalled with Docker
- Add non-root user to the droplet -- How To Create a New Sudo-enabled User on Ubuntu 18.04 [Quickstart]
- Add SSH tunneling to VSCode -- How To Use Visual Studio Code for Remote Development via the Remote-SSH Plugin
- Add domain name (or subdomain) to the droplet -- How do you point a subdomain to DigitalOcean without using or the original domain or changing nameservers?
- Add auto-renewing SSH certificate (for HTTPS) to the droplet.
- nginx-le
- For Remark42, you just need a right settings, because the author is the same person who created nginx-le
ports:
- "80:8080"
- "443:8443"
environment:
- SSL_TYPE=auto
- SSL_ACME_EMAIL=<YOUR_EMAIL>
- IMAGE_PROXY_HTTP2HTTPS=true
Don't know if this is just my experience. docker-compose build
on DigitalOcean droplet failed due to not enough memory. I have to build on my development machine (macOS), then push
to Docker Hub. (Yes, this is my first time pushing to Docker Hub.) For anyone curious, see this gist.