3 Commits

Author SHA1 Message Date
b3edfb05d9 Update Rust crate anyhow to v1.0.90
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-10-19 00:29:11 +00:00
ec594c0e4d Fix typo
All checks were successful
continuous-integration/drone/push Build is passing
2024-10-18 20:53:50 +02:00
fdfbdf093f Create production installation guide
All checks were successful
continuous-integration/drone/push Build is passing
2024-10-18 20:41:08 +02:00
2 changed files with 80 additions and 3 deletions

View File

@@ -492,9 +492,9 @@ dependencies = [
[[package]] [[package]]
name = "anyhow" name = "anyhow"
version = "1.0.89" version = "1.0.90"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "86fdf8605db99b54d3cd748a44c6d04df638eb5dafb219b135d0149bd0db01f6" checksum = "37bf3594c4c988a53154954629820791dde498571819ae4ca50ca811e060cc95"
[[package]] [[package]]
name = "asn1" name = "asn1"

View File

@@ -45,4 +45,81 @@ The OTA update is then located in `build/main.bin`
* DHCP configured on the network * DHCP configured on the network
## Configure server ## Configure server
TODO
### Create a user dedicated to the central
```bash
sudo adduser --disabled-login central
```
### Install binary
You can use `scp` to copy the binary to the target server:
```bash
scp central_backend/target/release/central_backend pierre@central:/home/pierre
```
Then the executable must be installed system-wide:
```bash
sudo mv central_backend /usr/local/bin/
```
### Create configuration file
Create a configuration file in `/home/central/config.yaml`:
```bash
sudo touch /home/central/config.yaml
sudo chown central:central /home/central/config.yaml
sudo chmod 400 /home/central/config.yaml
sudo nano /home/central/config.yaml
```
Sample configuration:
```conf
SECRET=RANDOM_VALUE
COOKIE_SECURE=true
LISTEN_ADDRESS=0.0.0.0:443
ADMIN_USERNAME=admin
ADMIN_PASSWORD=FIXME
HOSTNAME=central.local
STORAGE=/home/central/storage
FRONIUS_ORIG=http://10.0.0.10
```
### Test configuration
Run the following command to check if the configuration is working:
```bash
sudo -u central central_backend -c /home/central/config.yaml
```
### Create systemd unit file
Once you confirmed the configuration is working, you can configure a system service, in `/etc/systemd/system/central.service`:
```conf
[Unit]
Description=Central backend server
After=syslog.target
After=network.target
[Service]
RestartSec=2s
Type=simple
User=central
Group=central
WorkingDirectory=/home/central
ExecStart=/usr/local/bin/central_backend -c /home/central/config.yaml
Restart=always
Environment=USER=central
HOME=/home/central
[Install]
WantedBy=multi-user.target
```
Enable & start service:
```bash
sudo systemctl enable central
sudo systemctl start central
```