Skip to content

Instantly share code, notes, and snippets.

@dimaip
Last active January 17, 2018 16:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dimaip/083fee92b399b244c5a333a702dbaec9 to your computer and use it in GitHub Desktop.
Save dimaip/083fee92b399b244c5a333a702dbaec9 to your computer and use it in GitHub Desktop.
Elevator pitch for a stateless Github + Docker Swarm based PaaS

Here's a quick idea for a stateless PaaS on top of Github and docker swarm.

  1. You mark Github repos that you want to deploy to your Docker swarm with a certain tag, say "my-server".
  2. Each repo has a docker-compose.yml file defining the stack needed to run it.
  3. You have a daemon that periodically queries Github API for repos with given tag name (and from a certain user, for security reason). For every found repo it would do docker stack deploy RepoName --compose-file "...". Stacks would be deployed according to given service's deploy policy, utilizing its healthchecks etc.

So if you need to add a new repo to the swarm, you just mark it with a tag and wait a few min. If you need to update a service, you just edit its docker-compose.yml file and wait a few min. Secrets would be managed via docker secrets.

Advantages over plain swarm cluster?

  • Stateless. You don't have to remeber which stacks you need to deploy to which swarm in case of a crash. Also the state of the stacks deployed to swarm will never get out of sync with docker-compose.yml files defined in the repo.
  • People who want to deploy new stacks to the swarm don't need to have access to the swarm itself, only to managing Github repos. No need to bring some complicated management tools like Rancher.

Does this make sense? Would you be interested in a solution like this? Get in touch! https://twitter.com/dimaip

==========

Edit: actually it might well run as a Docker plugin. So far it needs to config variables:

server_name: 'my-server'
valid_users: 'dimaip,somebodyElse'
@dfeyer
Copy link

dfeyer commented Jan 17, 2018

WebHook fit better than crawling the API

Not sure about Swarm ... even Docker is moving to Kubernetes ...

But the concept is intersting

@dimaip
Copy link
Author

dimaip commented Jan 17, 2018

Thanks for the tip. Webhook is a bit annoying to setup if you have multiple projects... but yeah, need to think about it.
Swarm is there out of the box, it just works. But yes, this concept is orchestration-platform agnostic, I'll try to learn more about Kubernetes, but so far I'm a bit scared of it.
Probably I'll wait for Docker to seamlessly embed it under the hood, via their human-friendly api.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment