Skip to content

yieldbot/nomad-syncer

Repository files navigation

nomad-syncer

Build Status GoDoc Release

An opinionated CLI for Nomad

Installation

Binary releases

Linux OSX
64bit 64bit

See all releases

Building from source

go get github.com/yieldbot/nomad-syncer
cd $GOPATH/src/github.com/yieldbot/nomad-syncer
go build

Usage

Help

./nomad-syncer -h
Usage: nomad-syncer [OPTIONS] COMMAND [arg...]

An opinionated CLI for Nomad

Options:
  --docker-pull : Pull Docker images before sync
  --nomad       : Nomad url (default "http://localhost:4646")
  --proxy       : Proxy url
  -h, --help    : Display usage
  -pp           : Pretty print for JSON output
  -v, --version : Display version information
  -vv           : Display extended version information

Commands:
  add           : Add a job
  del           : Delete a job
  get           : Get a job information
  jobs          : Retrieve jobs
  sync          : Sync jobs via a file or directory

Setting Nomad Url

Default Nomad url is http://localhost:4646. But also you can use --nomad argument on each command or set ENV variable with following command

export NOMAD_URL=http://localhost:4646

Setting Proxy Url

You can use --proxy argument on each command or set ENV variable with following command

export NOMAD_SYNCER_PROXY_URL=http://localhost:8888

Getting jobs

./nomad-syncer jobs

Syncing jobs

Syncing a file

./nomad-syncer sync examples/jobs/job-1.json

Syncing a directory

./nomad-syncer sync examples/jobs/

Syncing with --docker-pull

If you have private Docker repository and don't want to add credentials into jobs (see https://www.nomadproject.io/docs/drivers/docker.html) then you can use --docker-pull. It allows you to pull Docker images before syncing job files.

HOME=/apps/nomad /apps/nomad/nomad-syncer --docker-pull sync examples/jobs/

HOME=/apps/nomad points to .dockercfg 's directory. It can be a user or /etc directory.

Adding a job

./nomad-syncer add "$(cat examples/jobs/job-1.json)"

Getting a job

./nomad-syncer get job-1

Deleting a job

./nomad-syncer del job-1

TODO

  • Auto binary release
  • Add tests

License

Licensed under The MIT License (MIT)
For the full copyright and license information, please view the LICENSE.txt file.

[coverage-image]: https://coveralls.io/repos/yieldbot/nomad-syncer/badge.svg?branch=master&service=github)