Skip to content

Instantly share code, notes, and snippets.

@Kugelschieber
Last active October 5, 2022 14:12
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Kugelschieber/84fe1417535576fafd4645c4817a016e to your computer and use it in GitHub Desktop.
Save Kugelschieber/84fe1417535576fafd4645c4817a016e to your computer and use it in GitHub Desktop.
Pirsch Go Proxy Setup

Pirsch Go Proxy Setup

This guide will help you to set up a self-hosted proxy for Pirsch behind Caddy as a reverse proxy to schedule an SSL certificate. It assumes that you're using Ubuntu Linux or similar with systemd.

Make sure you adjust the paths if you modify things in the steps described here.

Installing the Proxy

  1. download the latest release from https://github.com/pirsch-analytics/pirsch-go-proxy
  2. put it onto your server (for example in a new folder /root/pirsch)
  3. adjust the configuration to your needs (see the readme in the repository, this guides assumes it will be running on localhost:8080)
  4. add a systemd unit file for it /etc/systemd/system/pirsch.service (see below)
  5. use systemctl enable pirsch.service to enable the systemd service
  6. start the service using systemctl start pirsch.service (you can check that it is running using systemctl status pirsch.service)

Installing Caddy

  1. use apt install caddy to install Caddy
  2. adjust the configuration to your needs /etc/caddy/Caddyfile (see below)
  3. use systemctl enable caddy.service to enable the systemd service
  4. start the service using systemctl start caddy.service (you can check that it is running using systemctl status caddy.service)

And that's it! You can now start using the Pirsch JS snippet for your own domain. Please refer to the Usage section of the readme.

# Uncomment everything not specified here and change the domain.
proxy.yourdomain.com:443 {
reverse_proxy localhost:8080
}
[Unit]
Description=Pirsch Proxy
[Service]
Type=simple
Environment="PATH=/root:$PATH"
ExecStart=/root/pirsch/pirsch-proxy
WorkingDirectory=/root/pirsch
[Install]
WantedBy=multi-user.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment