You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2.2 KiB

Prerequisites

Make sure you have certbot installed and the rust toolchain is available on at least on user.

Install conduit

$ sudo useradd -m conduit
$ sudo -u conduit cargo +nightly install --git "https://git.koesters.xyz/timo/conduit.git"

Get TLS certificate

Remember to change conduit.koesters.xyz to your domain.

$ sudo certbot certonly -d conduit.koesters.xyz
$ sudo chgrp conduit /etc/letsencrypt/live/conduit.koesters.xyz/fullchain.pem
$ sudo chgrp conduit /etc/letsencrypt/live/conduit.koesters.xyz/privkey.pem
$ sudo chmod g+r /etc/letsencrypt/live/conduit.koesters.xyz/fullchain.pem
$ sudo chmod g+r /etc/letsencrypt/live/conduit.koesters.xyz/privkey.pem

Setup systemd service

Run this command, paste the default systemd service below and configure it to fit your setup.

$ sudoedit /etc/systemd/system/conduit.service
[Unit]
Description=Conduit
After=network.target

[Service]
# YOU NEED TO EDIT THESE THREE, OR configure a Rocket.toml in the WorkingDirectory set below:
#Environment="ROCKET_SERVER_NAME=conduit.koesters.xyz"
#Environment="ROCKET_TLS={certs=\"/etc/letsencrypt/live/conduit.koesters.xyz/fullchain.pem\",key=\"/etc/letsencrypt/live/conduit.koesters.xyz/privkey.pem\"}"
#Environment="ROCKET_PORT=14004"

#Environment="ROCKET_REGISTRATION_DISABLED=true"
#Environment="ROCKET_LOG=normal" # Detailed logging

Environment="ROCKET_ENV=production"
User=conduit
Group=conduit
Type=simple
Restart=always
ExecStart=/home/conduit/conduit/target/release/conduit
# The working dir is where the configuration file Rocket.toml should be
WorkingDirectory=/home/conduit

[Install]
WantedBy=multi-user.target

Finally, run

sudo systemctl daemon-reload

Configuration

The file rocket.toml can be used to configure things instead of using environment variables. See the rocket-example.toml file in the repository for inspiration.

You’re done!

Now you can start conduit with

$ sudo systemctl start conduit

and set it to start automatically when your system boots with

$ sudo systemctl enable conduit