An extremely simple HTTP-based deployment solution for Continuous Integration services
An extremely simple HTTP-based deployment solution for Continuous Integration services. Originally designed as a safer, simpler alternative to SSH and SCP for GitLab's CI/CD.
A single wildcard endpoint is exposed:
/deploy/*
If you want to deploy localfile.zip
to archive/localfile.zip
, you would submit a POST
request to: /deploy/archive/localfile.zip
, with the file content as form data and the deployment key as a KEY
header.
Note that all deployment paths are relative to the working directory of the deployer binary!
curl -F [email protected] -H "KEY: 123" "https://website.com/deploy/archive/localfile.zip"
Example variables:
localfile.zip
Example secrets:
123
https://website.com/deploy/archive
steps:
- name: deploy
image: alpine
environment:
DEPLOY_KEY:
from_secret: DEPLOY_KEY
DEPLOY_URL:
from_secret: DEPLOY_URL
commands:
- apk add --no-cache curl
- >
STATUS=$(curl --write-out %{http_code} --silent --output /dev/null
-F file=@$DEPLOY_FILE -H "KEY: $DEPLOY_KEY" "$DEPLOY_URL/$DEPLOY_FILE")
- >
echo "Result: $STATUS"
- >
[ "$STATUS" = "200" ] || exit 1
deploy:
image: ubuntu
stage: alpine
before_script:
- apk add --no-cache curl
script:
- >
STATUS=$(curl --write-out %{http_code} --silent --output /dev/null
-F file=@$DEPLOY_FILE -H "KEY: $DEPLOY_KEY" "$DEPLOY_URL/$DEPLOY_FILE")
- >
echo "Result: $STATUS"
- >
[ "$STATUS" == "200" ] || exit 1
key.txt
in the deployer's working directory. It must be longer than 10 characters or you will get a bad key
error.echo "SUPER_LONG_AND_SECRET_KEY" > key.txt
/home/deploy/deployer-amd64 --port 5000