Reacts to incoming webhooks with execution of local shell commands and sends outgoing webhooks
1.3K
Securely runs your deployment commands triggered by a HTTP call.
Example case:
PIP: https://pypi.org/project/Thin-Deployer/ Travis: https://travis-ci.org/Wolnosciowiec/thin-deployer Docker: https://hub.docker.com/r/wolnosciowiec/thin-deployer/
Created for an anarchist portal, with aim to propagate the freedom and grass-roots social movements where the human and it's needs is on first place, not the capital and profit.
Default configuration path is ~/.deployer.yml, but can be specified with a switch --configuration={{ file path }}
Example:
# service definition (and service name there)
phpdenyhosts:
# token used to authorize via "token" GET parameter, or "X-Auth-Token" header
token: some-token-goes-here-use-only-at-least-64-characters-long-tokens
# optional: support for notifying Slack and other messengers
# with wolnosciowiec-notification-client
use_notification: true
notification_group: "logs"
# working directory to be in to execute every command
pwd: /var/www/app
# could be empty, if not empty then the deploy will execute
# only if the INCOMING REQUEST BODY will match this regexp
# useful for example to deploy only from a proper branch
request_regexp: "\"branch\": \"([production|stage]+)\""
# commands to execute in order
commands:
- git pull
- composer install --no-dev
# (...) there could be more service definitions
One of the ways, a traditional one is to install as a Python package on the host machine.
pip install Thin-Deployer
thin-deployer --configuration=/etc/thin-deployer/.deployer.yml
Modern and more secure way is to use a docker image to run the thin-deployer inside of an isolated container.
sudo docker run -p 8012:8012 -v ./deployer.yml:/root/.deployer.yml --rm --name thin-deployer wolnosciowiec/thin-deployer
make install_dependencies
# simplest form with all default params
make run
# or advanced with possibility to add commandline switches
python3 ./bin/deployer.py
Use --log-file-prefix={{ path_to_log_file }} switch to save logs to file.
--port={{ port_number }} switch will change server listen port--listen={{ ip_addres }} makes server listen to given address, defaults to 0.0.0.0POST /deploy/phpdenyhosts HTTP/1.1
Host: localhost:8012
X-Auth-Token: some-token-goes-here-use-only-at-least-64-characters-long-tokens
{
"output": "Command \"ls -la /nonexisting\" failed, output: \"b''\""
}
Headers:
Service provides a simple monitoring endpoint at GET /technical/healthcheck
Authorization is done in two ways. Its up to you to use a preferred one in a request to the endpoint.
X-Auth-Token with a token as a valueExamples of headers:
Health check endpoint is configurable via environment variables.
HC_TOKEN={{ token }} health check access tokenHC_MIN_TOKEN_LENGTH={{ min_length }} minimum length of a token in every serviceHC_MAX_DISK_USAGE={{ max_disk_usage_percentage }} defaults to 90 (it's 90%), when disk usage is higher or equals to this value then an error will be reportedIntegrates well with Wolnościowiec Notification using a shell client
Content type
Image
Digest
Size
77.9 MB
Last updated
almost 8 years ago
docker pull wolnosciowiec/thin-deployer