Crates.io | thresh |
lib.rs | thresh |
version | 0.0.1 |
source | src |
created_at | 2020-06-25 02:56:58.054189 |
updated_at | 2020-06-25 02:56:58.054189 |
description | Tiny deployment agent |
homepage | https://github.com/huemul/thresh |
repository | https://github.com/huemul/thresh |
max_upload_size | |
id | 257751 |
size | 73,578 |
🛳 Tiny deployment agent
Download the latest released binary and add executable permissions:
$ wget -O thresh "https://github.com/Huemul/thresh/releases/download/v0.0.1/thresh-x86-64-linux"
$ chmod +x thresh
Now that Thresh is available, the help
subcommand can be run to display the
CLI information:
$ ./thresh --help
thresh 0.0.1
Tiny deployment agent
USAGE:
thresh [OPTIONS] <SUBCOMMAND>
FLAGS:
-h, --help Prints help information
-V, --version Prints version information
OPTIONS:
-c, --config <config> Path to Threshfile [default: .threshfile]
-s, --secret <secret> Secret to generate and authenticate the token. Can also be provided in the Threshfile
SUBCOMMANDS:
help Prints this message or the help of the given subcommand(s)
serve Start thresh agent server
token Create a token based on the secret to authorize agent connections
Next create a .threshfile
with the required configuration to deploy projects.
Optionally this file can contain global Thresh configuration. A threshfile
example can be found
here.
Create a systemd service file (/etc/systemd/system/thresh.service
) with the
following attributes:
[Unit]
Description=Thresh
[Service]
ExecStart=/path/to/thresh -c /path/to/.threshfile -s super-secret-secret serve -l /path/to/thresh-logs -p 8080
Then enable and start Thresh service:
# Might require sudo
$ systemctl enable /etc/systemd/system/thresh.service
$ systemctl start thresh
To read logs and check status the following commands can be used:
$ systemctl status thresh
$ journalctl -u thresh -b
Once Thresh is running and exposed to the internet, deployment jobs can be
triggered by POSTing to the /webhook
endpoint wiht the project name.
curl -X POST 'https://thresh.yourdomain.com/webhook' \
-H 'Authorization: Bearer ********' \
-d '{ "name": "foo-project" }'
cargo run
# Watch mode
cargo watch -x run
# Setting CLI options
cargo run -- --port 9090 --logs-dir ./logs
cargo test
# Watch mode
cargo watch -x test