1.9 KiB
Installing
You will need nodejs and systemd installed, and access to an email account using SMTP.
You might want to run the app with a dedicated non-privileged user:
sudo adduser webhooks
su webhooks
cd ~
Now you can install git-webhooks as the webhooks user:
git clone https://git.suboptimal.solutions/hugh/git-webhooks.git
cd git-webhooks
npm install
web server
You'll need to set up a webserver configuration. If you use nginx, start with the example in nginx.conf - update the server_name, check the port is correct, and then add it to the conf files:
cp nginx.conf /etc/nginx/sites-available/git-webhooks.conf
ln -s /etc/nginx/sites-available/git-webhooks.conf /etc/nginx/sites-enabled/
Then set up an https certificate using certbot.
Systemd
Now update the values in git-webhooks.env:
SECRETis the secret code you will share with your git server.EMAIL_USER,EMAIL_PASSWORD,SMTP_DOMAINshould all be available from your mail provider.EMAIL_SEND_ADDRESSis the address you want to send from.EMAIL_RECEIVE_ADDRESSis the email address you want to send alerts toAPP_PATHis the URL path to POST to. e.g. "library-map" if you are sending POST requests tohttps://example.com/library-mapLOCAL_REPOis the path of the repository to update on the server. e.g./srv/my_awesome_app_repository
You'll need to check git-webhooks.service is correct for your system. You might need to change the WorkingDirectory, for example, if you chose not to create a webhooks user.
Once these files are correct, move both to where we store systemd unit files:
sudo mv git-webhooks.service git-webhooks.env /etc/systemd/system/
Now enable and start the service:
sudo systemctl enable git-webhooks.service
sudo systemctl start git-webhooks.service
Your webhooks server should now be operational!