lets-haproxy
A configuration which you can use to run a web-application + APIs behind HAProxy with Let's Encrypt and automatically renewed SSL certificates.
HAProxy, Let's Encrypt certbot and your Application(s) are run as Docker containers with Docker Compose. Therefore entire configuration is easy portable to any cloud. Almost everything is automated, so there are just a few manual steps you need to make.
Application
You need to deploy an App available on the web and your criterial are:
- HTTPS for security.
- Minimize vendor lock on cloud providers, so you can easily move to other cloud.
- Minimize hosting cost, e.g. have just 1 Virtual Machine (e.g. Amazon EC2).
- Have 1 or more pieces of your web-app (e.g. website + APIs service(s)) running behind a proxy with SSL.
Advantages:
- HAProxy takes care about HTTPS part. Your web-application can just talk plain HTTP.
- All components are Docker images, so thereare no other dependencies to configure.
- Deployment is done with docker-compose, so no need to configure ports / networks / files.
- All steps are scripted. There are minimum manul things left to do.
Pre-requisites:
- letsencrypt folder with initial certificates. Here is a nice article which shows how to get it. (It's also possible to do with just lets-certbot and lets-haproxy Docker images)
- Docker
- Docker Compose
Steps:
- build and run cookiecutter. cookiecutter will generate your scripts. Follow cookiecutter instruction and you will get all scripts in seconds.
# Builds cookiecutter docker image ./build.sh # Run cookiecutter docker container to generate lets-haproxy scripts ./run.sh
- Go to newly generated scripts folder
output
. The folder contains all scripts you would need to run and a sample react app.let-haproxy documentation / instructions can be found atcd output\{{directory_name you provided to cookiecutter}}
output\{{directory_name you provided to cookiecutter}}\README