Docs website with mkdocs (#100)

* Fix build workflow

* Docs website with mkdocs (#99)

* Fix docs workflow

* Move mkdocs Docker file

* Ignore docs in build workflow

* Update workflows

* Update links

* Move upgrade notes to documentation

Co-authored-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax
2020-06-19 22:47:17 +00:00
committed by GitHub
parent b5c584eca1
commit db2bce3bb3
77 changed files with 1695 additions and 924 deletions

89
docs/install/binary.md Normal file
View File

@@ -0,0 +1,89 @@
# Installation from binary
## Download
Diun binaries are available on [releases]({{ config.repo_url }}releases) page.
Choose the archive matching the destination platform:
* [diun_{{ app.version }}_darwin_i386.tar.gz]({{ config.repo_url }}releases/download/v{{ app.version }}/diun_{{ app.version }}_darwin_i386.tar.gz)
* [diun_{{ app.version }}_darwin_x86_64.tar.gz]({{ config.repo_url }}/releases/download/v{{ app.version }}/diun_{{ app.version }}_darwin_x86_64.tar.gz)
* [diun_{{ app.version }}_freebsd_i386.tar.gz]({{ config.repo_url }}/releases/download/v{{ app.version }}/diun_{{ app.version }}_freebsd_i386.tar.gz)
* [diun_{{ app.version }}_freebsd_x86_64.tar.gz]({{ config.repo_url }}/releases/download/v{{ app.version }}/diun_{{ app.version }}_freebsd_x86_64.tar.gz)
* [diun_{{ app.version }}_linux_arm64.tar.gz]({{ config.repo_url }}/releases/download/v{{ app.version }}/diun_{{ app.version }}_linux_arm64.tar.gz)
* [diun_{{ app.version }}_linux_armv6.tar.gz]({{ config.repo_url }}/releases/download/v{{ app.version }}/diun_{{ app.version }}_linux_armv6.tar.gz)
* [diun_{{ app.version }}_linux_armv7.tar.gz]({{ config.repo_url }}/releases/download/v{{ app.version }}/diun_{{ app.version }}_linux_armv7.tar.gz)
* [diun_{{ app.version }}_linux_i386.tar.gz]({{ config.repo_url }}/releases/download/v{{ app.version }}/diun_{{ app.version }}_linux_i386.tar.gz)
* [diun_{{ app.version }}_linux_x86_64.tar.gz]({{ config.repo_url }}/releases/download/v{{ app.version }}/diun_{{ app.version }}_linux_x86_64.tar.gz)
* [diun_{{ app.version }}_windows_i386.zip]({{ config.repo_url }}/releases/download/v{{ app.version }}/diun_{{ app.version }}_windows_i386.zip)
* [diun_{{ app.version }}_windows_x86_64.zip]({{ config.repo_url }}/releases/download/v{{ app.version }}/diun_{{ app.version }}_windows_x86_64.zip)
And extract diun:
```shell
$ wget -qO- {{ config.repo_url }}releases/download/v{{ app.version }}/diun_{{ app.version }}_linux_x86_64.tar.gz | tar -zxvf - diun
```
After getting the binary, it can be tested with [`./diun --help`](../get-started.md#diun-cli) command and moved to a permanent location.
## Server configuration
Steps below are the recommended server configuration.
### Prepare environment
Create user to run diun (ex. `diun`)
```shell
$ groupadd diun
$ useradd -s /bin/false -d /bin/null -g diun diun
```
### Create required directory structure
```shell
$ mkdir -p /var/lib/diun
$ chown diun:diun /var/lib/diun/
$ chmod -R 750 /var/lib/diun/
$ mkdir /etc/diun
$ chown diun:diun /etc/diun
$ chmod 770 /etc/diun
```
### Configuration
Create your first [configuration](../config/index.md) file in `/etc/diun/diun.yml` and type:
```shell
$ chown diun:diun /etc/diun/diun.yml
$ chmod 644 /etc/diun/diun.yml
```
!!! note
Not required if you want to only rely on environment variables
### Copy binary to global location
```shell
$ cp diun /usr/local/bin/diun
```
## Running Diun
After the above steps, two options to run Diun:
### 1. Creating a service file (recommended)
See how to create [Linux service](linux-service.md) to start Diun automatically.
### 2. Running from terminal
```shell
$ DIUN_DB_PATH=/var/lib/diun/diun.db /usr/local/bin/diun --config /etc/diun/diun.yml
```
## Updating to a new version
You can update to a new version of Diun by stopping it, replacing the binary at `/usr/local/bin/diun` and restarting the instance.
If you have carried out the installation steps as described above, the binary should have the generic name `diun`. Do not change this, i.e. to include the version number.

85
docs/install/docker.md Normal file
View File

@@ -0,0 +1,85 @@
# Installation with Docker
Diun provides automatically updated Docker :whale: images within [Docker Hub](https://hub.docker.com/r/crazymax/diun).
It is possible to always use the latest stable tag or to use another service that handles updating Docker images.
Following platforms for this image are available:
```shell
$ docker run --rm mplatform/mquery crazymax/diun:latest
Image: crazymax/diun:latest
* Manifest List: Yes
* Supported platforms:
- linux/amd64
- linux/arm/v6
- linux/arm/v7
- linux/arm64
- linux/386
- linux/ppc64le
- linux/s390x
```
## Volumes
| Path | Description |
|--------------------|---------------|
| `/data` | Contains bbolt database which retains Docker images manifests |
## Usage
Docker compose is the recommended way to run this image. Copy the following `docker-compose.yml` in `/opt/diun/` on your host for example:
```yaml
version: "3.5"
services:
diun:
image: crazymax/diun:latest
container_name: diun
volumes:
- "./data:/data"
- "/var/run/docker.sock:/var/run/docker.sock"
environment:
- "TZ=Europe/Paris"
- "LOG_LEVEL=info"
- "LOG_JSON=false"
- "DIUN_WATCH_WORKERS=20"
- "DIUN_WATCH_SCHEDULE=*/30 * * * *"
- "DIUN_PROVIDERS_DOCKER=true"
labels:
- "diun.enable=true"
- "diun.watch_repo=true"
restart: always
```
Edit this example with your preferences and run the following commands to bring up Diun:
```shell
$ docker-compose up -d
$ docker-compose logs -f
```
Or use the following command:
```shell
$ docker run -d --name diun \
-e "TZ=Europe/Paris" \
-e "LOG_LEVEL=info" \
-e "LOG_JSON=false" \
-e "DIUN_WATCH_WORKERS=20" \
-e "DIUN_WATCH_SCHEDULE=*/30 * * * *" \
-e "DIUN_PROVIDERS_DOCKER=true" \
-e "DIUN_PROVIDERS_DOCKER_WATCHSTOPPED=true" \
-v "$(pwd)/data:/data" \
-v "/var/run/docker.sock:/var/run/docker.sock" \
-l "diun.enable=true" \
-l "diun.watch_repo=true" \
crazymax/diun:latest
```
To upgrade your installation to the latest release:
```shell
$ docker-compose pull
$ docker-compose up -d
```

View File

@@ -0,0 +1,43 @@
# Run as service on Debian based distro
## Using systemd
!!! warning
Make sure to follow the instructions to [install from binary](binary.md) before.
To create a new service, paste this content in `/etc/systemd/system/diun.service`:
```
[Unit]
Description=Diun
Documentation={{ config.site_url }}
After=syslog.target
After=network.target
[Service]
RestartSec=2s
Type=simple
User=diun
Group=diun
ExecStart=/usr/local/bin/diun --config /etc/diun/diun.yml --log-level info
Restart=always
Environment=DIUN_DB_PATH=/var/lib/diun/diun.db
[Install]
WantedBy=multi-user.target
```
Change the user, group, and other required startup values following your needs.
Enable and start Diun at boot:
```shell
$ sudo systemctl enable diun
$ sudo systemctl start diun
```
To view logs:
```shell
$ journalctl -fu diun.service
```