From 3c20cca9151c4aa4ecec93056a0241aa3c068029 Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Sat, 19 Oct 2024 11:41:21 +0200 Subject: [PATCH] Update prod documentation --- docs/SETUP_PROD.md | 68 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 67 insertions(+), 1 deletion(-) diff --git a/docs/SETUP_PROD.md b/docs/SETUP_PROD.md index 91443de..341a230 100644 --- a/docs/SETUP_PROD.md +++ b/docs/SETUP_PROD.md @@ -1,5 +1,7 @@ # Configure project for production +Note: This guide assumes that you use the default hostname, `central.internal` as hostname for your central system. + ## Create production build ### Central @@ -44,6 +46,70 @@ The OTA update is then located in `build/main.bin` * A server running a recent Linux (Debian / Ubuntu preferred) with `central` as hostname * DHCP configured on the network +## Configure DNS server + +If you need to setup a DNS server / proxy to point `central.internal` to the central server IP, you can follow this guide. + +### Retrieve DNS server binary +Use [DNSProxy](https://gitlab.com/pierre42100/dnsproxy) as DNS server. Get and compile the sources: + +```bash +git clone https://gitlab.com/pierre42100/dnsproxy +cd dnsproxy +cargo build --release +scp target/release/dns_proxy USER@CENTRAL_IP:/home/USER +``` + +Then, on the target server, install the binary to its final destination: + +```bash +sudo mv dns_proxy /usr/local/bin/ +``` + +### Configure DNS server +Configure the server as a service `/etc/systemd/system/dns.service`: + +```conf +[Unit] +Description=DNS server +After=syslog.target +After=network.target + +[Service] +RestartSec=2s +Type=simple +User=root +Group=root +WorkingDirectory=/tmp +ExecStart=/usr/local/bin/dns_proxy -l "CENTRAL_IP:53" -c "central.internal. A CENTRAL_IP" +Restart=always + +[Install] +WantedBy=multi-user.target +``` + +Enable and start the new service: + +```bash +sudo systemctl enable dns +sudo systemctl start dns +``` + +Check that it works correctly: + +```bash +dig central.internal. @CENTRAL_IP +``` + +You should get an entry like this if it works: + +``` +;; ANSWER SECTION: +central.internal. 0 IN A CENTRAL_IP +``` + +Then, in your DHCP service, define the central as the DNS server. + ## Configure server ### Create a user dedicated to the central @@ -82,7 +148,7 @@ COOKIE_SECURE=true LISTEN_ADDRESS=0.0.0.0:443 ADMIN_USERNAME=admin ADMIN_PASSWORD=FIXME -HOSTNAME=central.local +HOSTNAME=central.internal STORAGE=/home/central/storage FRONIUS_ORIG=http://10.0.0.10 ```