deployster

command module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 6, 2015 License: MIT Imports: 13 Imported by: 0

README

Deployster

Deployster is a Golang HTTP service for simplifying deploys to a CoreOS Fleet cluster. It is extremely opinionated in how you tag your Docker images, where you store them, and how the service's unit files are configured.

This project is also available as bmorton/deployster publically on the Docker Hub Registry.

Currently this project is in use for a few side projects, but is not currently in heavy production use. Yammer has been exploring this path for production and this will likely be used in some prototyping there.

Features
  • Deploy a new version of a service from the Docker registry (with optionally destroying the previously running version)
  • Shutdown a deployed version of a service
  • List all units associated to a service
Requirements and limitations

To use Deployster, you'll need:

  • CoreOS cluster - There are some tutorials for doing this on DigitalOcean and Azure. Make sure to be using version 550.0.0 or greater of CoreOS so that Fleet's HTTP API is available for Deployster to use.
  • Images hosted on the public Docker Hub Registry - They can be private, but for now they must come from the same user on the public Docker Hub Registry. There's a todo item below to make this better.
  • Expose an HTTP service on port 3000 - This should be configurable in the future too.
  • Containers are stateless - Linking in volumes is currently not supported. Again, something for the future.
  • Vulcand running - For zero downtime deploys of new versions of services.
Getting started

After the above requirements are fulfilled, you can launch Deployster with Fleet.

  1. Using a unit file like this one, run fleetctl start deployster.service

    [Unit]
    Description=Deployster
    After=docker.service
    
    [Service]
    TimeoutStartSec=0
    ExecStartPre=/usr/bin/docker pull bmorton/deployster
    ExecStartPre=-/usr/bin/docker rm -f deployster
    ExecStart=/usr/bin/docker run --name deployster -p 3000:3000 -v /var/run/fleet.sock:/var/run/fleet.sock bmorton/deployster -password=DONTUSETHIS -docker-hub-username=mycompany
    ExecStop=/usr/bin/docker rm -f deployster
    
  2. Start up a new service that is available on the Docker Hub Registry at mycompany/railsapp:9f88701 (username/service:version)

    $ curl -XPOST http://localhost:3000/v1/services/railsapp/deploys -H "Content-Type: application/json" -d '{"deploy":{"version":"9f88701", "destroy_previous": false}}' -u deployster:DONTUSETHIS
    $ fleetctl list-units
    UNIT                        MACHINE                  ACTIVE  SUB
    railsapp-9f88701@1.service  8dcea1bd.../100.10.11.1  active  running
    
  3. Deploy an updated version while automatically destroying the previous version once the new one is online

    $ curl -XPOST http://localhost:3000/v1/services/railsapp/deploys -H "Content-Type: application/json" -d '{"deploy":{"version":"7bdae1c", "destroy_previous": true}}' -u deployster:DONTUSETHIS
    $ fleetctl list-units
    UNIT                        MACHINE                  ACTIVE      SUB
    railsapp-7bdae1c@1.service  8dcea1bd.../100.10.11.1  activating  start-pre
    railsapp-9f88701@1.service  8dcea1bd.../100.10.11.1  active      running
    $ fleetctl list-units
    UNIT                        MACHINE                  ACTIVE  SUB
    railsapp-7bdae1c@1.service  8dcea1bd.../100.10.11.1  active  running
    
  4. List units associated to a service

    $ curl http://localhost:3000/v1/services/carousel/units -u deployster:DONTUSETHIS
    {"units":[{"service":"railsapp","instance":"1","version":"7bdae1c","current_state":"launched","desired_state":"launched","machine_id":"8dcea1bd8c304e1bbe2c25dce526109c"}]}
    
  5. Manually shutdown a version of a service

    $ curl -XDELETE http://localhost:3000/v1/services/railsapp/deploys/7bdae1c -u deployster:DONTUSETHIS
    
Configurable options
$ deployster -h
Usage of ./deployster:
  -docker-hub-username="": The username of the Docker Hub account that all deployable images are hosted under
  -listen="0.0.0.0:3000": Specifies the IP and port that the HTTP server will listen on
  -password="mmmhm": Password that will be used to authenticate with Deployster via HTTP basic auth
  -username="deployster": Username that will be used to authenticate with Deployster via HTTP basic auth
Todo
  • Move these todos to GitHub issues
  • Test coverage (started, but needs more ;/)
  • Documentation and more extensive examples/tutorials
  • HTTPS support
  • Vagrantfile for easy experimentation and testing
  • Allow tasks, such as rake db:migrate to be run before a deploy
  • Allow multiple instances to be started at once
  • Add support for multiple unit templates
  • Add support for Docker containers that need volumes linked (not stateless)
Contributing

Pull requests and bug reports are greatly appreciated and encouraged. If you'd like to help out with any of the above items or have a feature that you think would be awesome for this project, we'd love your help! To get the design conversation started, open a new GitHub issue with your ideas and we can hash out the details.

License

Code and documentation copyright 2015 Brian Morton. Code released under the MIT license.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL