From 8d99963fb8692c89a63bc564b41bcc3f20a75bbd Mon Sep 17 00:00:00 2001 From: Justin Partain Date: Thu, 30 Jul 2020 15:30:44 -0500 Subject: [PATCH 1/9] Update for 07-30-2020 15-30-44 --- init/synology-docker-compose/README.md | 1 + .../docker-compose.example.env | 17 ++++++ .../docker-compose.yml | 52 +++++++++++++++++++ 3 files changed, 70 insertions(+) create mode 100644 init/synology-docker-compose/README.md create mode 100644 init/synology-docker-compose/docker-compose.example.env create mode 100644 init/synology-docker-compose/docker-compose.yml diff --git a/init/synology-docker-compose/README.md b/init/synology-docker-compose/README.md new file mode 100644 index 00000000..471637ca --- /dev/null +++ b/init/synology-docker-compose/README.md @@ -0,0 +1 @@ +# Synology Docker Compose Example diff --git a/init/synology-docker-compose/docker-compose.example.env b/init/synology-docker-compose/docker-compose.example.env new file mode 100644 index 00000000..9020e114 --- /dev/null +++ b/init/synology-docker-compose/docker-compose.example.env @@ -0,0 +1,17 @@ +#influxdb +INFLUXDB_HTTP_AUTH_ENABLED=true +INFLUXDB_ADMIN_USER=unifi-poller +INFLUXDB_ADMIN_PASSWORD=changeme +INFLUXDB_DB=unifi + +#grafana +GRAFANA_USERNAME=grafana_username +GRAFANA_PASSWORD=changeme + +#unifi-poller +POLLER_TAG=latest +POLLER_DEBUG=false +POLLER_SAVE_DPI=false +UNIFI_USER=unifipoller +UNIFI_PASS=set_this_on_your_controller +UNIFI_URL=https://127.0.0.1:8443 diff --git a/init/synology-docker-compose/docker-compose.yml b/init/synology-docker-compose/docker-compose.yml new file mode 100644 index 00000000..67aeeba9 --- /dev/null +++ b/init/synology-docker-compose/docker-compose.yml @@ -0,0 +1,52 @@ +# This is for unifi-poller v2. +version: '3' +services: + influxdb: + restart: always + image: influxdb:latest + ports: + - '3456:8086' + volumes: + - /volume2/General/influxdb:/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 + networks: + - Grafana_Net + grafana: + image: grafana/grafana:latest + restart: always + ports: + - '3000:3000' + volumes: + - /volume2/General/grafana:/var/lib/grafana + depends_on: + - influxdb + user: "1029" + 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_ENFORCE_DOMAIN=true + - GF_RENDERING_CALLBACK_URL=boards.jpcdi.com + - GF_RENDERING_SERVER_URL=boards.jpcdi.com + networks: + - Grafana_Net + unifi-poller: + restart: always + image: golift/unifi-poller:latest + environment: + - UP_INFLUXDB_USER=${INFLUXDB_ADMIN_USER} + - UP_INFLUXDB_PASS=${INFLUXDB_ADMIN_PASSWORD} + - UP_INFLUXDB_URL=http://influxdb:8086 + - UP_UNIFI_DEFAULT_USER=${UNIFI_USER} + - UP_UNIFI_DEFAULT_PASS=${UNIFI_PASS} + - UP_UNIFI_DEFAULT_URL=${UNIFI_URL} + - UP_POLLER_DEBUG=${POLLER_DEBUG} + - UP_UNIFI_DEFAULT_SAVE_DPI=${POLLER_SAVE_DPI} + networks: + - Grafana_Net +networks: + Grafana_Net: From ed23c395001ed84217fbc065ce709bc966be791b Mon Sep 17 00:00:00 2001 From: Justin Partain Date: Fri, 31 Jul 2020 00:51:55 -0500 Subject: [PATCH 2/9] 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}: From 6e6596985ee4abffa503977993901a94573f78b1 Mon Sep 17 00:00:00 2001 From: Justin Partain Date: Fri, 31 Jul 2020 00:53:47 -0500 Subject: [PATCH 3/9] Updated Spacing --- init/synology-docker-compose/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/init/synology-docker-compose/README.md b/init/synology-docker-compose/README.md index 6b6253ed..d8e0aedc 100644 --- a/init/synology-docker-compose/README.md +++ b/init/synology-docker-compose/README.md @@ -3,6 +3,7 @@ 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}` From 4b432b455231d3ba9df4dd41c74de8c06101dcb7 Mon Sep 17 00:00:00 2001 From: Justin Partain Date: Fri, 31 Jul 2020 01:16:53 -0500 Subject: [PATCH 4/9] Fixed Variables and Network Name - Fixed the variable names for the rendering callback url and rendering server url --- init/synology-docker-compose/docker-compose.example.env | 4 ++-- init/synology-docker-compose/docker-compose.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/init/synology-docker-compose/docker-compose.example.env b/init/synology-docker-compose/docker-compose.example.env index 6a426746..759c574b 100644 --- a/init/synology-docker-compose/docker-compose.example.env +++ b/init/synology-docker-compose/docker-compose.example.env @@ -12,8 +12,8 @@ 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 +GRAFANA_RENDERING_CALLBACK_URL=boards.url.com +GRAFANA_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 f5c0fe0e..a281d76a 100644 --- a/init/synology-docker-compose/docker-compose.yml +++ b/init/synology-docker-compose/docker-compose.yml @@ -28,8 +28,8 @@ services: - GF_INSTALL_PLUGINS=grafana-clock-panel,natel-discrete-panel,grafana-piechart-panel - GF_SERVER_DOMAIN=${GRAFANA_SERVER_DOMAIN} - GF_ENFORCE_DOMAIN=true - - GF_RENDERING_CALLBACK_URL=${GF_RENDERING_CALLBACK_URL} - - GF_RENDERING_SERVER_URL=${GF_RENDERING_SERVER_URL} + - GF_RENDERING_CALLBACK_URL=${GRAFANA_RENDERING_CALLBACK_URL} + - GF_RENDERING_SERVER_URL=${GRAFANA_RENDERING_SERVER_URL} networks: - ${GRAFANA_NETWORK} unifi-poller: From cc7d85a9c95fef048dcf16a8b6b7a856de2115a6 Mon Sep 17 00:00:00 2001 From: Justin Partain Date: Fri, 31 Jul 2020 14:31:33 -0500 Subject: [PATCH 5/9] Completed README - Finished writing `README.md` --- init/synology-docker-compose/.gitignore | 1 + init/synology-docker-compose/README.md | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 init/synology-docker-compose/.gitignore diff --git a/init/synology-docker-compose/.gitignore b/init/synology-docker-compose/.gitignore new file mode 100644 index 00000000..4c49bd78 --- /dev/null +++ b/init/synology-docker-compose/.gitignore @@ -0,0 +1 @@ +.env diff --git a/init/synology-docker-compose/README.md b/init/synology-docker-compose/README.md index d8e0aedc..5ac60d2e 100644 --- a/init/synology-docker-compose/README.md +++ b/init/synology-docker-compose/README.md @@ -25,3 +25,23 @@ You still have to [do this prep work](https://github.com/unifi-poller/unifi-poll #. 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` + +##Variables + +For all of the variables used in the docker-compose file, make sure to not only read over but make important edits to the `docker-compose.example.env file. As well as making a copy and naming it `.env` + +For the `/local/storage/location/` lines, change those to match your directories. + +```bash +#influxdb +INFLUXDB_ADMIN_PASSWORD=changeme +INFLUXDB_LOCAL_VOLUME=/local/storage/location/influxdb + +#grafana +GRAFANA_USERNAME=grafana_username +GRAFANA_PASSWORD=changeme +GRAFANA_LOCAL_USERID=1026 + +UNIFI_PASS=set_this_on_your_controller +UNIFI_URL=https://127.0.0.1:8443 +``` From 17f9be2cf63733f8bf9dfe94179e368566b982ff Mon Sep 17 00:00:00 2001 From: Justin Partain Date: Thu, 13 Aug 2020 20:40:44 -0500 Subject: [PATCH 6/9] First Round Updates Here are some of the higher-level, more basic updates that you guys mentioned so far: - Added a small part about the `.env` file and what its for - Changed the various references to directories from `grafana` to `unifi-poller` as the base - Changed the user name to create in the GUI from `grafana` to `unifi-poller`. - Thought this might be more streamlined(?) - Might want to look into changing that on the docker instructions, too, if we prefer this - You have to keep the `sudo id` bit later, as we can't tell the GUI to use a specific user ID. Let me know what you think about these minor updates, here. --- init/synology-docker-compose/README.md | 27 ++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/init/synology-docker-compose/README.md b/init/synology-docker-compose/README.md index 5ac60d2e..01423dda 100644 --- a/init/synology-docker-compose/README.md +++ b/init/synology-docker-compose/README.md @@ -2,28 +2,35 @@ This folder is an example `docker-compose.yml` file and a `.env` file for using docker through a Synology Server. +The `.env` file is a special environment/variable file that `docker-compose` automatically uses to make configuration of your containers easier. + ## 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`) +First, create the directories where you want the containers to save everything. I use the same base directory for them, like: `/volume1/Docker/unifi-poller`, then inside the `./unifi-poller` directory: `./grafana` and `./influxdb`. -`sudo mkdir -p /volume[#]/[Shared Directory]/Grafana/{grafana,influxdb}` + NOTE: Its best to use the command line over SSH to create these directories, AFTER you have the root shared directory created. (`Control Panel -> Shared Folder -> Create`) -Where `/volume[#]` is the volume number, +```bash +sudo mkdir -p /volume[#]/[Shared Directory]/unifi-poller/grafana +sudo mkdir -p /volume[#]/[Shared Directory/unifi-poller/influxdbx +``` + +Where `/volume[#]` is the volume number corresponding to your volumes in Synology; `[Shared Directory]` is the shared directory from above, and then -`{grafana,influxdb}` needs to be copied as-is, curly brackets and all. +create the `grafana and influxdb` directories. -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: +You still have to [do this prep work](https://github.com/unifi-poller/unifi-poller/wiki/Synology-HOWTO#method-2) creating the `unifi-poller` 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) + - Name the user `unifi-poller` + - Set the password (you don't need to logon as unifipoller 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` + - Give them `r/w` permission to the folder you created e.g. `/docker/unifi-poller` - 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` + - `sudo id unifi-poller` - `GRAFANA_LOCAL_USERID=1026` ##Variables @@ -38,7 +45,7 @@ INFLUXDB_ADMIN_PASSWORD=changeme INFLUXDB_LOCAL_VOLUME=/local/storage/location/influxdb #grafana -GRAFANA_USERNAME=grafana_username +GRAFANA_USERNAME=unifi-poller_username GRAFANA_PASSWORD=changeme GRAFANA_LOCAL_USERID=1026 From cec13cefd64a1ff9bf55ced3858a2f7601c59f89 Mon Sep 17 00:00:00 2001 From: Justin Partain Date: Mon, 17 Aug 2020 04:58:35 -0500 Subject: [PATCH 7/9] Variable Updates and Instructional Changes Variables: - Removed the `...Rendering_callback_url` references - Removed the `GRAFANA_NETWORK` variables, as the network name can't be a variable. Instructions: - Fixed a few errors - Added the section for running `docker-compose up -d` to start the containers, and then included creating the influx database instructions utilizing the GUI. --- init/synology-docker-compose/README.md | 37 ++++++++++++++++--- .../docker-compose.example.env | 4 -- .../docker-compose.yml | 14 ++++--- 3 files changed, 40 insertions(+), 15 deletions(-) diff --git a/init/synology-docker-compose/README.md b/init/synology-docker-compose/README.md index 01423dda..b2799455 100644 --- a/init/synology-docker-compose/README.md +++ b/init/synology-docker-compose/README.md @@ -12,14 +12,14 @@ First, create the directories where you want the containers to save everything. ```bash sudo mkdir -p /volume[#]/[Shared Directory]/unifi-poller/grafana -sudo mkdir -p /volume[#]/[Shared Directory/unifi-poller/influxdbx +sudo mkdir -p /volume[#]/[Shared Directory]/unifi-poller/influxdbx ``` Where `/volume[#]` is the volume number corresponding to your volumes in Synology; `[Shared Directory]` is the shared directory from above, and then -create the `grafana and influxdb` directories. +creating the `grafana and influxdb` directories. -You still have to [do this prep work](https://github.com/unifi-poller/unifi-poller/wiki/Synology-HOWTO#method-2) creating the `unifi-poller` user, which I'll re-iterate here: +You still have to [do this prep work](https://github.com/unifi-poller/unifi-poller/wiki/Synology-HOWTO#method-2), creating the `unifi-poller` user, which I'll re-iterate here: #. Create a new user account on the Synology from the Control Panel: - Name the user `unifi-poller` @@ -33,9 +33,36 @@ You still have to [do this prep work](https://github.com/unifi-poller/unifi-poll - `sudo id unifi-poller` - `GRAFANA_LOCAL_USERID=1026` -##Variables +## Spin Up the Containers -For all of the variables used in the docker-compose file, make sure to not only read over but make important edits to the `docker-compose.example.env file. As well as making a copy and naming it `.env` +At this point, you are able to run `sudo docker-compose up -d` from within the directory that you have the `docker-compose.yml` file and the `.env` file saved on your Synology. + +And now we have to create the Influx Database. + +## Create Influx Database + +#. Click `Containers` and then double click the running `influxdb1` container +#. Switch to the `terminal` tab +#. Click the drop down next to `Create` and select `launch with command` +#. Enter `bash` and click `ok` +#. Select `bash` from the left hand side. You should now see an active `command prompt` +#. In the command prompt, enter these commands: (note: pasting IS possible! You have to right click in the terminal window and select `paste`) + +`influx` +After a couple of seconds you should be in the InfluxDB shell. +Run the following commands in the InfluxDB shell, then close the window: + +``` +CREATE DATABASE unifi +USE unifi +CREATE USER unifipoller WITH PASSWORD 'unifipoller' WITH ALL PRIVILEGES +GRANT ALL ON unifi TO unifipoller +exit +``` + +## Variables + +For all of the variables used in the docker-compose file, you'll find them in the `docker-compose.example.env` file. Please, `cp docker-compose.example.env .env` and open it in your favorite text editor. `nano .env` For the `/local/storage/location/` lines, change those to match your directories. diff --git a/init/synology-docker-compose/docker-compose.example.env b/init/synology-docker-compose/docker-compose.example.env index 759c574b..7c07e100 100644 --- a/init/synology-docker-compose/docker-compose.example.env +++ b/init/synology-docker-compose/docker-compose.example.env @@ -8,12 +8,8 @@ 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 -GRAFANA_RENDERING_CALLBACK_URL=boards.url.com -GRAFANA_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 a281d76a..ca6741c2 100644 --- a/init/synology-docker-compose/docker-compose.yml +++ b/init/synology-docker-compose/docker-compose.yml @@ -1,6 +1,7 @@ # This is for unifi-poller v2. version: '3' services: + influxdb: restart: always image: influxdb:latest @@ -11,7 +12,8 @@ services: - INFLUXDB_DATA_WAL_DIR=/var/lib/influxdb/wal - INFLUXDB_DATA_META_DIR=/var/lib/influxdb/meta networks: - - ${GRAFANA_NETWORK} + - Grafana_Network + grafana: image: grafana/grafana:latest restart: always @@ -28,10 +30,9 @@ services: - GF_INSTALL_PLUGINS=grafana-clock-panel,natel-discrete-panel,grafana-piechart-panel - GF_SERVER_DOMAIN=${GRAFANA_SERVER_DOMAIN} - GF_ENFORCE_DOMAIN=true - - GF_RENDERING_CALLBACK_URL=${GRAFANA_RENDERING_CALLBACK_URL} - - GF_RENDERING_SERVER_URL=${GRAFANA_RENDERING_SERVER_URL} networks: - - ${GRAFANA_NETWORK} + - Grafana_Network + unifi-poller: restart: always image: golift/unifi-poller:latest @@ -45,6 +46,7 @@ services: - UP_POLLER_DEBUG=${POLLER_DEBUG} - UP_UNIFI_DEFAULT_SAVE_DPI=${POLLER_SAVE_DPI} networks: - - ${GRAFANA_NETWORK} + - Grafana_Network + networks: - ${GRAFANA_NETWORK}: + Grafana_Network: From 118605b4383f0c29b974d6396f56f63905e78ce6 Mon Sep 17 00:00:00 2001 From: Justin Partain Date: Thu, 1 Oct 2020 23:39:17 -0500 Subject: [PATCH 8/9] Final Updates --- init/synology-docker-compose/README.md | 44 ++++++++++++++++++++++---- 1 file changed, 37 insertions(+), 7 deletions(-) diff --git a/init/synology-docker-compose/README.md b/init/synology-docker-compose/README.md index b2799455..122896e2 100644 --- a/init/synology-docker-compose/README.md +++ b/init/synology-docker-compose/README.md @@ -6,6 +6,8 @@ The `.env` file is a special environment/variable file that `docker-compose` aut ## Directions +### Directories + First, create the directories where you want the containers to save everything. I use the same base directory for them, like: `/volume1/Docker/unifi-poller`, then inside the `./unifi-poller` directory: `./grafana` and `./influxdb`. NOTE: Its best to use the command line over SSH to create these directories, AFTER you have the root shared directory created. (`Control Panel -> Shared Folder -> Create`) @@ -19,6 +21,8 @@ Where `/volume[#]` is the volume number corresponding to your volumes in Synolog `[Shared Directory]` is the shared directory from above, and then creating the `grafana and influxdb` directories. +### User Accounts + You still have to [do this prep work](https://github.com/unifi-poller/unifi-poller/wiki/Synology-HOWTO#method-2), creating the `unifi-poller` user, which I'll re-iterate here: #. Create a new user account on the Synology from the Control Panel: @@ -33,13 +37,13 @@ You still have to [do this prep work](https://github.com/unifi-poller/unifi-poll - `sudo id unifi-poller` - `GRAFANA_LOCAL_USERID=1026` -## Spin Up the Containers +### Spin Up the Containers -At this point, you are able to run `sudo docker-compose up -d` from within the directory that you have the `docker-compose.yml` file and the `.env` file saved on your Synology. +At this point, you are able to run `sudo docker-compose up -d` from within the directory that you have the `docker-compose.yml` file and the `.env` file saved on your Synology. -And now we have to create the Influx Database. +And now, using your Synology's Web GUI, we have to create the Influx Database. -## Create Influx Database +### Create Influx Database #. Click `Containers` and then double click the running `influxdb1` container #. Switch to the `terminal` tab @@ -47,10 +51,11 @@ And now we have to create the Influx Database. #. Enter `bash` and click `ok` #. Select `bash` from the left hand side. You should now see an active `command prompt` #. In the command prompt, enter these commands: (note: pasting IS possible! You have to right click in the terminal window and select `paste`) - + `influx` -After a couple of seconds you should be in the InfluxDB shell. -Run the following commands in the InfluxDB shell, then close the window: + +After a couple of seconds you should be in the InfluxDB shell. +Run the following commands in the InfluxDB shell, then close the window. The `unifipoller` username is the read-only user you created in the Unifi Web Management page. ``` CREATE DATABASE unifi @@ -60,6 +65,31 @@ GRANT ALL ON unifi TO unifipoller exit ``` +### Grafana Login and Final Setup + +From here, your three containers should show as running, no alerts of auto-restarting or other issues coming from your synology's web GUI. + +Make sure to double check the log output of all three containers. If there are any issues, they **should** appear here. + +Then, in your browser, go to `http://{ip address of your synology}:3000`. The default login is `admin:admin`. But, if you used the `INFLUXDB_ADMIN_USER` and `INFLUXDB_ADMIN_PASSWORD` in the variable file, use that login here. + +#. Click `Add Your First Data Source` on the home page +#. Select the `influxdb` source option +#. Set the following fields: + - Name = `UniFi InfluxDB` (or whatever name you want) and set to default + URL = http://influxdb1:8086 + Database = unifi + Username = unifipoller + Password = unifipoller + +No other fields need to be changed or set on this page. +Click Save & Test + + You should get green banner above the save and test that says 'Data Source is Working' + To return to the homepage click the icon with 4 squares on the left nav-bar and select home + + + ## Variables For all of the variables used in the docker-compose file, you'll find them in the `docker-compose.example.env` file. Please, `cp docker-compose.example.env .env` and open it in your favorite text editor. `nano .env` From 07757b4268540ad6d2eb516cf2661bb7ea57860c Mon Sep 17 00:00:00 2001 From: Justin Partain Date: Thu, 1 Oct 2020 23:44:24 -0500 Subject: [PATCH 9/9] Fixed Numbering Issue --- init/synology-docker-compose/README.md | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/init/synology-docker-compose/README.md b/init/synology-docker-compose/README.md index 122896e2..a74ec046 100644 --- a/init/synology-docker-compose/README.md +++ b/init/synology-docker-compose/README.md @@ -25,15 +25,15 @@ creating the `grafana and influxdb` directories. You still have to [do this prep work](https://github.com/unifi-poller/unifi-poller/wiki/Synology-HOWTO#method-2), creating the `unifi-poller` user, which I'll re-iterate here: -#. Create a new user account on the Synology from the Control Panel: +1. Create a new user account on the Synology from the Control Panel: - Name the user `unifi-poller` - Set the password (you don't need to logon as unifipoller 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/unifi-poller` - 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: +2. SSH into your Synology +3. 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 unifi-poller` - `GRAFANA_LOCAL_USERID=1026` @@ -45,13 +45,13 @@ And now, using your Synology's Web GUI, we have to create the Influx Database. ### Create Influx Database -#. Click `Containers` and then double click the running `influxdb1` container -#. Switch to the `terminal` tab -#. Click the drop down next to `Create` and select `launch with command` -#. Enter `bash` and click `ok` -#. Select `bash` from the left hand side. You should now see an active `command prompt` -#. In the command prompt, enter these commands: (note: pasting IS possible! You have to right click in the terminal window and select `paste`) - +1. Click `Containers` and then double click the running `influxdb1` container +2. Switch to the `terminal` tab +3. Click the drop down next to `Create` and select `launch with command` +4. Enter `bash` and click `ok` +5. Select `bash` from the left hand side. You should now see an active `command prompt` +6. In the command prompt, enter these commands: (note: pasting IS possible! You have to right click in the terminal window and select `paste`) + `influx` After a couple of seconds you should be in the InfluxDB shell.