From ed23c395001ed84217fbc065ce709bc966be791b Mon Sep 17 00:00:00 2001 From: Justin Partain Date: Fri, 31 Jul 2020 00:51:55 -0500 Subject: [PATCH] Major Initial Push This is the first push with most of the edits/variables in place. Most of whats left is filling out the `README.md` file for the variables and what they mean and/or need. - Moved most of the editable/user configurable options to variables inside of the `docker-compose.example.env` file - Wrote the explainer for the directory creation and the user creation that is necessary --- init/synology-docker-compose/README.md | 25 +++++++++++++++++++ .../docker-compose.example.env | 7 ++++++ .../docker-compose.yml | 24 ++++++++---------- 3 files changed, 43 insertions(+), 13 deletions(-) diff --git a/init/synology-docker-compose/README.md b/init/synology-docker-compose/README.md index 471637ca..6b6253ed 100644 --- a/init/synology-docker-compose/README.md +++ b/init/synology-docker-compose/README.md @@ -1 +1,26 @@ # Synology Docker Compose Example + +This folder is an example `docker-compose.yml` file and a `.env` file for using docker through a Synology Server. + +## Directions +First, create the directories where you want the containers to save everything. I use the same base directory for them, like: `/volume1/Docker/grafana`, then inside the `./grafana` directory: `./grafana` and `./influxdb`. Its best to use the command line over SSH to create these directories, AFTER you have the primary shared directory already created. (`Control Panel -> Shared Folder -> Create`) + +`sudo mkdir -p /volume[#]/[Shared Directory]/Grafana/{grafana,influxdb}` + +Where `/volume[#]` is the volume number, +`[Shared Directory]` is the shared directory from above, and then +`{grafana,influxdb}` needs to be copied as-is, curly brackets and all. + +You still have to [do this prep work](https://github.com/unifi-poller/unifi-poller/wiki/Synology-HOWTO#method-2) creating the `unifipoller` user, which I'll re-iterate here: + +#. Create a new user account on the Synology from the Control Panel: + - Name the user `grafana` + - Set the password (you don't need to logon as grafana and change it) + - `Disallow Password Change` + - Assign them to the user group `users` + - Give them `r/w` permission to the folder you created e.g. `/docker/grafana` + - Don't assign them **anything** else - the point of this user is for security's sake. +#. SSH into your Synology +#. Run the following command to find the PID of the user you created and set the variable `GRAFANA_LOCAL_USERID` in your `.env` file: + - `sudo id grafana` + - `GRAFANA_LOCAL_USERID=1026` diff --git a/init/synology-docker-compose/docker-compose.example.env b/init/synology-docker-compose/docker-compose.example.env index 9020e114..6a426746 100644 --- a/init/synology-docker-compose/docker-compose.example.env +++ b/init/synology-docker-compose/docker-compose.example.env @@ -3,10 +3,17 @@ INFLUXDB_HTTP_AUTH_ENABLED=true INFLUXDB_ADMIN_USER=unifi-poller INFLUXDB_ADMIN_PASSWORD=changeme INFLUXDB_DB=unifi +INFLUXDB_LOCAL_VOLUME=/local/storage/location/influxdb #grafana GRAFANA_USERNAME=grafana_username GRAFANA_PASSWORD=changeme +GRAFANA_NETWORK=Grafana_Net +GRAFANA_LOCAL_VOLUME=/local/storage/location/grafana +GRAFANA_LOCAL_USERID=1026 +GRAFANA_SERVER_DOMAIN=boards.url.com +GF_RENDERING_CALLBACK_URL=boards.url.com +GF_RENDERING_SERVER_URL=boards.url.com #unifi-poller POLLER_TAG=latest diff --git a/init/synology-docker-compose/docker-compose.yml b/init/synology-docker-compose/docker-compose.yml index 67aeeba9..f5c0fe0e 100644 --- a/init/synology-docker-compose/docker-compose.yml +++ b/init/synology-docker-compose/docker-compose.yml @@ -4,36 +4,34 @@ services: influxdb: restart: always image: influxdb:latest - ports: - - '3456:8086' volumes: - - /volume2/General/influxdb:/var/lib/influxdb + - ${INFLUXDB_LOCAL_VOLUME}:/var/lib/influxdb environment: - INFLUXDB_DATA_DIR=/var/lib/influxdb/data - INFLUXDB_DATA_WAL_DIR=/var/lib/influxdb/wal - - INFLUXDB_DATA_META_DIR=/var/lib/influxdb/meta + - INFLUXDB_DATA_META_DIR=/var/lib/influxdb/meta networks: - - Grafana_Net + - ${GRAFANA_NETWORK} grafana: image: grafana/grafana:latest restart: always ports: - '3000:3000' volumes: - - /volume2/General/grafana:/var/lib/grafana + - ${GRAFANA_LOCAL_VOLUME}:/var/lib/grafana depends_on: - influxdb - user: "1029" + user: "${GRAFANA_LOCAL_USERID}" environment: - GF_SECURITY_ADMIN_USER=${GRAFANA_USERNAME} - GF_SECURITY_ADMIN_PASSWORD=${GRAFANA_PASSWORD} - GF_INSTALL_PLUGINS=grafana-clock-panel,natel-discrete-panel,grafana-piechart-panel - - GF_SERVER_DOMAIN=boards.jpcdi.com + - GF_SERVER_DOMAIN=${GRAFANA_SERVER_DOMAIN} - GF_ENFORCE_DOMAIN=true - - GF_RENDERING_CALLBACK_URL=boards.jpcdi.com - - GF_RENDERING_SERVER_URL=boards.jpcdi.com + - GF_RENDERING_CALLBACK_URL=${GF_RENDERING_CALLBACK_URL} + - GF_RENDERING_SERVER_URL=${GF_RENDERING_SERVER_URL} networks: - - Grafana_Net + - ${GRAFANA_NETWORK} unifi-poller: restart: always image: golift/unifi-poller:latest @@ -47,6 +45,6 @@ services: - UP_POLLER_DEBUG=${POLLER_DEBUG} - UP_UNIFI_DEFAULT_SAVE_DPI=${POLLER_SAVE_DPI} networks: - - Grafana_Net + - ${GRAFANA_NETWORK} networks: - Grafana_Net: + ${GRAFANA_NETWORK}: