Go HTTP service to deploy Node.js apps (Systemd services) from GitHub
Configure the service with following env variables:
Variable | Sample |
---|---|
LOG_FILE |
/var/log/app.out |
APPS_ROOT |
/var/apps/ |
SERVICES_PREFIX |
node- |
TCP_PORT |
:30000 |
http://localhost:3000/?AppName=myapp&GitBranch=master&Secret=SuperSecretPassword
You should use a proxy server (Nginx) and handle this request from a simpler URL, eg.:
https://myserver.com/myapp/deploy
# nginx.conf
location ~ ^\/(?<app>[a-z0-9-]+)\/deploy$ {
proxy_pass http://[::1]:3000/?Secret=SuperSecretPassword&AppName=$app&GitBranch=master;
}
The simplest way to get it running is creating a webhook on GitHub repository after releases (recommended) or pushes, using the same Secret passed by proxy: