58 lines
1.9 KiB
Markdown
58 lines
1.9 KiB
Markdown
|
## 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:
|
||
|
|
||
|
```sh
|
||
|
sudo adduser webhooks
|
||
|
su webhooks
|
||
|
cd ~
|
||
|
```
|
||
|
|
||
|
Now you can install `git-webhooks` as the `webhooks` user:
|
||
|
|
||
|
```sh
|
||
|
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:
|
||
|
|
||
|
```sh
|
||
|
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](https://certbot.eff.org/).
|
||
|
|
||
|
## Systemd
|
||
|
|
||
|
Now update the values in `git-webhooks.env`:
|
||
|
|
||
|
* `SECRET` is the secret code you will share with your git server.
|
||
|
* `EMAIL_USER`, `EMAIL_PASSWORD`, `SMTP_DOMAIN` should all be available from your mail provider.
|
||
|
* `EMAIL_SEND_ADDRESS` is the address you want to send from.
|
||
|
* `EMAIL_RECEIVE_ADDRESS` is the email address you want to send alerts to
|
||
|
* `APP_PATH` is the URL path to POST to. e.g. "library-map" if you are sending POST requests to `https://example.com/library-map`
|
||
|
* `LOCAL_REPO` is 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:
|
||
|
|
||
|
```sh
|
||
|
sudo mv git-webhooks.service git-webhooks.env /etc/systemd/system/
|
||
|
```
|
||
|
|
||
|
Now enable and start the service:
|
||
|
|
||
|
```sh
|
||
|
sudo systemctl enable git-webhooks.service
|
||
|
sudo systemctl start git-webhooks.service
|
||
|
```
|
||
|
|
||
|
Your webhooks server should now be operational!
|