Skip to content

About

Pre-cooked, simple infrastructure to deploy containerized projects on a single-node server

Topics

Resources

Stars

4 stars

Watchers

2 watching

Forks

Repository files navigation

Compose prod

An Infrastructure-As-Code template for deploying your containerized projects on a single-node server.

Features:

  • Deploy your projects by defining a simple docker-compose.yml file
  • Ready out of the box: Buy a VPS, fork this repository, and follow the guide to have your project running and deployed in a few minutes.
  • from zero to https in an instant: Automatic TLS certificate generation, powered by traefik.
  • A grafana control panel to monitor the state of all your services, and their logs.
    powered by pre-configured Prometheus, Loki, node-exporter, Container-advisor.

Guide

Overview

This ansible project will configure your ubuntu server, install docker, and set up the following folder structure in the home folder of the administrator user:

home/admin/
├── platform/
│   ├── docker-compose.platform.yml
│   └── docker-compose.traefik.yml
├── project-name1/
│   └── docker-compose.yml
└── project-name2/
    └── docker-compose.yml

To deploy your projects, you have then several options. If you want to follow a continuos-deployment approach:

  • add a docker-compose file to your project repository
  • configure the deploy.yml file in the infrastructure repository:
    projects:
      - name: "my-projet"
        git: "https://github.com/username/repository"
        compose_path: "/compose-prod/"
        autodeploy_on_change: true
    
  • That's it! The system running on your server will monitor your project repository, and will automatically deploy your docker-compose when it detects a change. If you deployed a web server, it will instantly be availabe online, with a valid TLS certificate.

If you want to manually manage your projects, that's fine too! Just copy your docker-compose files into the server, and launch them with docker compose up -d
Your project logs and metrics will be available on the Grafana dashboard.

FAQ

  • Does this scale? Chances are this is not the question you should be asking:
    No. This Infrastructure will run on a single-server only, and cannot scale to multiple nodes.
    But most project will never need to scale. This infrastructure running on a 4$ VPS can handle more than 10k cuncurrent users depending on the workload.
    Know your system: are you running expensive machine learning inference models, or just serving a static web page? Most importantly: can you afford downtime? can you run your database on a single node?

  • What happens if the server breaks?
    All the docker-compose projects you deployed on the server will go offline. Since all your infrastructure is stored in git and automated via Ansible, you can get a new server up and running in a few minutes: just run the Ansible scripts again.
    This is an extremely simple and cheap way to deploy your projects, but it comes at the cost of less availabilty. If you cannot afford downtime, docker-compose on a single server is not the right way to deploy your projects, and it's probably time to look at more expensive and complicated solutions.

  • Is this web scale?
    yes, it's web scale. And blazing fast.

Contributing

Contributions are always welcome! The ansible code in this repository follows an experimental coding style, you can read more about it in the code guidelines

About

Pre-cooked, simple infrastructure to deploy containerized projects on a single-node server

Topics

Resources

Stars

4 stars

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages