|
|
|
|
|
by __mp
2534 days ago
|
|
0) Get a cheap virtual/dedicated machine. 1) Install docker and docker-compose 2) Setup traefik, a reverse proxy, in docker (good starting point: https://docs.traefik.io/user-guide/docker-and-lets-encrypt/ ). 3) Run $docker container (ghost, wordpress...). I typically use one docker-compose file for each domain. "expose" is not necessary because the requests are proxied by traefik. Here's a docker-compose sample for a website available under my-website.com: version: '3'
services:
web:
container_name: my-website.com-nginx
image: nginx
restart: unless-stopped
volumes:
- ./data:/usr/share/nginx/html
labels:
- "traefik.docker.network=web"
- "traefik.enable=true"
- "traefik.basic.frontend.rule=Host:my-website.com"
- "traefik.basic.port=80"
- "traefik.basic.protocol=http"
networks:
default:
external:
name: web
There are probably more elegant ways to do this, however I found it quite effective for my setup. |
|
Put Docker on your VM / instance, make a project with a docker-compose that just ties one or many services together with traefik as the reverse proxy (I use CNAMEs or subdomain routing - path routing & stripping adds complexity and breaks many apps).
For the actual site you can choose any stack you desire. I'd recommend node / express over wordpress for a simple site, but you can rock a flavor of the month, or whatever your experience allows you to be productive in - Swift Vapor, go, php, .NET... then dockerize your site.
Deploys and execution should be identical locally and remotely. If you get popular, you are in a great place to scale out compared to many traditional stacks. If you want to try out another service, tool, database, whatever; just add it to the docker-compose, run docker-compose down/up, and there she is.
There is a sharp initial learning curve with Docker - images, containers and their layers, volumes, networks and ports, and how all that interacts with the host machine. Containerization is arguable something you won't be able to ignore forever. The advantages are just too numerous and appealing, especially for the hero solo developer!