ModernMAK/Personal-Website

Separate Docker Images / Move development.modernmak.com to same IP as modernmak.com

Opened this issue · 0 comments

Now that I'm using nginx, I could move development to the same IP and avoid using a separate EC2 instance to run dev.

To do this; I'd need to run both dev and production on the same machine. My first thought was docker-in-docker, but that seemed like a bad idea. (And according to this article it is a bad idea) So I was thinking about alternatives, when I realized I could run three different images separately now that I'm binding on unix sockets

By mounting a shared socket location for the images, and setting up the uvicorn script to use the shared socket location, nginx should be able to route traffic while the images don't need to install nginx themselves.

To lay it out in a list:

  • Get docker setup and working properly
    • Separate the https-prod image to use an nginx image and a uvicorn-prod image
    • Separate the https-dev image to get a uvicorn-dev image
    • Setup a bash script to build-and-run all images
  • Perform cleanup on development
    • Change development IP via domain provider
    • Drop the ec2 development instance
    • Rebuild development HTTPS certificates (new IP probably will invalidate old ones)

As a closing note; the article mentioned that by mounting the docker socket; a docker image could run sibling images. I'm assuming that nginx can read sockets in the mounted volume and that uvicorn can create sockets in the mounted volume.