2017-03-05 20:59:03 +01:00
|
|
|
# Howto install Yanic
|
|
|
|
|
|
|
|
## go
|
2017-12-31 05:28:03 +01:00
|
|
|
|
2017-03-05 20:59:03 +01:00
|
|
|
### Install
|
|
|
|
```sh
|
|
|
|
cd /usr/local/
|
2019-10-13 10:48:44 +02:00
|
|
|
wget https://dl.google.com/go/go1.13.1.linux-amd64.tar.gz -O go-release-linux-amd64.tar.gz
|
2017-12-31 05:28:03 +01:00
|
|
|
tar xvf go-release-linux-amd64.tar.gz
|
|
|
|
rm go-release-linux-amd64.tar.gz
|
2017-03-05 20:59:03 +01:00
|
|
|
```
|
|
|
|
|
2017-10-31 14:34:01 +01:00
|
|
|
### Configure go
|
2017-11-02 21:43:33 +01:00
|
|
|
Add these lines in your root shell startup file (e.g. `/root/.bashrc`):
|
2017-03-05 20:59:03 +01:00
|
|
|
```sh
|
|
|
|
export GOPATH=/opt/go
|
|
|
|
export PATH=$PATH:/usr/local/go/bin:$GOPATH/bin
|
|
|
|
```
|
|
|
|
|
|
|
|
## Yanic
|
|
|
|
|
|
|
|
### Compile
|
2017-10-31 14:34:01 +01:00
|
|
|
As root:
|
2017-03-05 20:59:03 +01:00
|
|
|
```sh
|
2022-04-14 00:28:34 +02:00
|
|
|
go install github.com/FreifunkBremen/yanic@latest
|
2017-03-05 20:59:03 +01:00
|
|
|
```
|
|
|
|
|
2023-09-20 11:18:07 +02:00
|
|
|
or to install a different checkout for example for development run:
|
|
|
|
|
|
|
|
```sh
|
|
|
|
git clone https://github.com/FreifunkBremen/yanic
|
|
|
|
cd yanic
|
|
|
|
go install .
|
|
|
|
```
|
|
|
|
|
|
|
|
Now you can use the binary in `~/go/bin/yanic`.
|
|
|
|
If you specified `export GOPATH=/opt/go` the binary is located at `/opt/go/bin/yanic`.
|
|
|
|
|
2017-04-10 18:54:12 +02:00
|
|
|
#### Work with other databases
|
2017-10-31 14:34:01 +01:00
|
|
|
If you like to use another database solution than influxdb, Pull Requests are
|
|
|
|
welcome. Just fork this project and create another subpackage within the folder
|
|
|
|
`database/`. Take this folder as example: `database/logging/`.
|
2017-04-10 18:54:12 +02:00
|
|
|
|
2017-10-31 14:34:01 +01:00
|
|
|
### Configure Yanic
|
2017-03-05 20:59:03 +01:00
|
|
|
```sh
|
|
|
|
cp /opt/go/src/github.com/FreifunkBremen/yanic/config_example.toml /etc/yanic.conf
|
|
|
|
```
|
2017-10-31 14:34:01 +01:00
|
|
|
For an easy startup you only need to edit the `interfaces` in section
|
|
|
|
`[respondd]` in file `/etc/yanic.conf`.
|
|
|
|
|
2017-11-02 21:43:33 +01:00
|
|
|
Then create the following files and folders:
|
2017-03-05 20:59:03 +01:00
|
|
|
```sh
|
2017-10-01 11:13:26 +02:00
|
|
|
mkdir -p /var/lib/yanic
|
2017-03-05 20:59:03 +01:00
|
|
|
mkdir -p /var/www/html/meshviewer/data
|
2017-11-02 21:43:33 +01:00
|
|
|
touch /var/log/yanic.log
|
|
|
|
chown yanic /var/log/yanic.log /var/lib/yanic /var/www/html/meshviewer/data
|
2017-03-05 20:59:03 +01:00
|
|
|
```
|
|
|
|
|
|
|
|
#### Standalone
|
2017-10-31 14:34:01 +01:00
|
|
|
If you like to run a standalone meshviewer, just set `enable` in section
|
|
|
|
`[webserver]` to `true`.
|
|
|
|
|
|
|
|
##### Configure the [meshviewer](https://github.com/ffrgb/meshviewer):
|
|
|
|
set `dataPath` in `config.json` to `/data/` and make the `build` directory
|
|
|
|
accessible under `/var/www/html/meshviewer`.
|
2017-03-05 20:59:03 +01:00
|
|
|
|
|
|
|
#### With webserver (Apache, nginx)
|
2017-10-31 14:34:01 +01:00
|
|
|
The meshviewer needs the output files like `nodes_path` and `graph_path` inside
|
|
|
|
the same directory as the `dataPath`. Change the path in the section
|
2017-05-20 14:46:29 +02:00
|
|
|
`[[nodes.output.meshviewer]]` accordingly.
|
2017-03-05 20:59:03 +01:00
|
|
|
|
|
|
|
### Service
|
2017-11-02 21:43:33 +01:00
|
|
|
```sh
|
2017-12-31 05:28:03 +01:00
|
|
|
cp /opt/go/src/github.com/FreifunkBremen/yanic/contrib/init/linux-systemd/yanic.service /lib/systemd/system/yanic.service
|
2017-03-05 20:59:03 +01:00
|
|
|
systemctl daemon-reload
|
2019-10-13 10:48:44 +02:00
|
|
|
```
|
|
|
|
|
|
|
|
Before start, you should configure yanic by the file `/etc/yanic.conf`:
|
|
|
|
```sh
|
2017-03-05 20:59:03 +01:00
|
|
|
systemctl start yanic
|
2019-10-13 10:48:44 +02:00
|
|
|
```
|
|
|
|
|
|
|
|
Enable to start on boot:
|
|
|
|
```sh
|
2017-03-05 20:59:03 +01:00
|
|
|
systemctl enable yanic
|
|
|
|
```
|
2017-11-02 21:43:33 +01:00
|
|
|
|
|
|
|
### Update
|
|
|
|
For an update just stop yanic and then call the same `go` command again (again as root):
|
|
|
|
```sh
|
|
|
|
systemctl stop yanic
|
|
|
|
go get -v -u github.com/FreifunkBremen/yanic
|
|
|
|
```
|
|
|
|
Then update the config file, for example look at the diff with the new example:
|
|
|
|
```sh
|
|
|
|
diff /opt/go/src/github.com/FreifunkBremen/yanic/config_example.toml /etc/yanic.conf
|
|
|
|
```
|