Start the PullRequest Proxy

Configure the PullRequest Proxy service to run.

At this point, we have configured the PullRequest proxy enough where it can connect to the PullRequest application and to your source control provider. You can now go ahead and save the .env file you've been editing up until now. You no longer need to be logged in as the pullrequest user at this point.

exit

Configuring the pullrequest-proxy service

For this step, we are assuming that the application is running on a Linux instance with systemd as the init process. These steps can be modified for things like supervisord or old-style init.d, as well.

First, let's open up a new service file under multi-user.target.wants.

vim /etc/systemd/system/multi-user.target.wants/pullrequest-proxy.service

Now, paste the following in:

[Unit]
Description=PullRequest Proxy
Documentation=https://docs.pullrequest.com/on-premise-server/

[Service]
EnvironmentFile=/home/pullrequest/pullrequest_proxy/.env
ExecStart=/home/pullrequest/pullrequest_proxy/launcher.sh
WorkingDirectory=/home/pullrequest/pullrequest_proxy
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=pullrequest-proxy
Restart=always
Type=simple
User=pullrequest

[Install]
WantedBy=multi-user.target

If you know what you're doing, you can go ahead and modify any of these options to match how you like your services to run.

The Restart=always configuration option is important for the auto-upgrade feature as described later. For this feature, the new proxy binary is installed, and the old process exits. The restart pulls in the new version.

The following command should pull this configuration in to your running systemd instance.

systemctl daemon-reload

Now, go ahead and enable the service to start automatically on boot and start it.

systemctl enable pullrequest-proxy
systemctl start pullrequest-proxy

To check on the status, run the following:

systemctl status pullrequest-proxy

To stop or restart the service, the stop and restart commands can be used, respectively.

Configuring Logs

In the previous section, we configured the PullRequest Proxy service to run and started it. However, the configuration itself outputs logs to the running syslog service. Normally, these logs will be output to the /var/log/messages file. In order to output these logs to a different file, go ahead and open up a new configuration file under /etc/rsyslog.d.

vim /etc/rsyslog.d/pullrequest-proxy.conf

Put the following in that file:

if $programname == 'pullrequest-proxy' then /var/log/pullrequest-proxy.log
& stop

Now, restart rsyslog to pull in the new configuration:

systemctl restart rsyslog

Last updated