dorc

Crates.iodorc
lib.rsdorc
version0.1.0
sourcesrc
created_at2021-08-12 02:46:49.877426
updated_at2021-08-16 15:50:33.508671
descriptiondevin's orchestrator - a stupid deployment utility
homepage
repositoryhttps://github.com/dwbrite/dorc
max_upload_size
id435031
size60,138
Devin Brite (dwbrite)

documentation

README

TODO: add badges

Devin's Orchestrator (dorc) - a stupid deployment utility

dorc is a tool for deploying simple backend services with a green–blue strategy.

Requirements, warnings, et al

dorc as it stands will only function on linux systems that use SystemD. That's pretty much the only requirement.

Not all software will work with dorc!

Binaries need to have a way to set which port they listen on (e.g., ./yourbin --port 8081)

You may run into trouble if your software uses filesystem as permanent storage if that data is stored relative to the working directory.

That means you should be storing data in an external database, or a bucket, or in some absolute path like /etc/yourapp/data.


If you need more (or different) functionality, use a more mainstream deployment tool like k8s or docker swarm.

Understanding dorc

To understand more about dorc, we need to talk terminology.

An application includes a release directory and a release binary. This is the location you should upload files for your software.

Applications also consist of services (also referred to as subservices). A service is a living version of your software. Each application has two subservices: green-{app} and blue-{app}, only one of which receives traffic at a given moment. That is to say, one is considered active and the other is inactive. dorc services are also registered as SystemD services.

The daemon is a background process that:

  • routes traffic from an application's listen port to the current active service,
  • watches release files to keep the inactive service up-to-date,
  • listens for commands to load, update, and remove applications; and reload or swap the active service of an application.

With that out of the way, let's talk about how everything works in practice.

First you should configure your CI/CD workflow to upload a release to your server. You can see how I do that for my website here.

Install dorc on your server. It will be registered as a SystemD service that starts the daemon on boot. If SystemD neglects to start the daemon on install, just run systemctl start dorc.

You can run dorc register to register an application and its subservices.

Once you've uploaded a new version of your software, dorc will copy that to the inactive service. Then you can call dorc switch {app} to swap which subservice is considered active. If you have any problems, simply call dorc switch {app} again to roll-back to the previous version.

Happy deploying!

Installing dorc

Just run cargo install dorc! When you run a command with dorc for the first time (e.g., dorc register) it will automatically install its SystemD service file, which you can start with systemctl start dorc.

Commit count: 24

cargo fmt