Intro
In deployment of services to the cloud you want as little dependencies as possible on the host systems. Just get a Droplet from Digital Ocean or an EC2 from AWS, then get the software from your Github account, run a start script and everything should go from there.
This document shows how such a setup could look like.
It explains the following concepts and techniques:
- How to put Nginx in a Docker Container
- How to do the Docker Networking to tie everything together
- Setting up Domain names each pointing to different sites
- Using SSL in Ngix in Docker
- How to handle secret files
- How to set up databases MySQL, Postgres and MongoDB
- How to install a Python Flask API
- How to install a NodeJS API
- How to install a ReactJS Frontend
(All spread out over different parts of the tutorial. Pick what you need from it)
And you could use the same Nginx setup to service a stream for something like SFTP.
The core of the project is a Nginx Proxyserver project running in a Docker Container
The configuration grew from an idea in the past to the full setup as it is used today. If you don't understand some parts of it, please, please, please let me know. I will clarify/update the article with a better explanation. Also, if you don't agree with some solutions, let me know. I would love a discussion on this and be proven wrong. 😃
Approach and tools​
The approach to achieve this is Docker. The host system, being a Digital-Ocean Droplet, an AWS EC2 Server or any other plain Ubuntu box.
All you need is Docker (and docker-compose) installed and a few open ports on the firewall.
Tools used:
- The Linux system, wherever you get this from
- Nginx
- SSL
- DNS (for the domains)
- Bit-of-BashScripting
For the setup of the network and base installation, we won't be creating any Docker Images. Everything we need is already there in standard Docker Images from Docker Hub.
- All the orange boxes are Docker Containers
- A lot of detail is missing. Follow along and more images will follow
Advantage​
The advantage of this approach is total flexibility where to deploy services, independant of the Cloud Provider. The complete Deployment of all of the services is stored in a project itself.
Disadvantage​
No Kubernetes yet. That's for a later version of this article
These days (mid-2023, when this article was written) people are all over Terraform. I agree that could also be a solution, but this is just another approach.
And, Terraform is Declarative and a bit more complex than this solution.
What you already need to know​
This article expects you already know a bit about:
- bash shell scripting
- docker and docker-compose on a beginners level
- dns, ssl and basic networking stuff on Unix
Source code​
If you're too lazy to do Copy/Page on all the code, you could also take a look at the source code in the public repo about this project