Skip to content

Commit

Permalink
Merge pull request #3 from Willem-Dekker/mkdocks
Browse files Browse the repository at this point in the history
Mkdocks
  • Loading branch information
Willem-Dekker authored Apr 19, 2020
2 parents 55542d4 + 96454c9 commit 171283a
Show file tree
Hide file tree
Showing 34 changed files with 141 additions and 109 deletions.
7 changes: 4 additions & 3 deletions docs/Accessing-your-Device-from-the-internet.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# accessing your device from the internet
The challenge most of us face with remotely accessing your home network is that you don't have a static IP. From time to time the IP that your ISP assigns to you changes and it's difficult to keep up. Fortunately, there is a solution, a DynamicDNS. The section below shows you how to set up an easy to remember address that follows your public IP no matter when it changes.

Secondly, how do you get into your home network? Your router has a firewall that is designed to keep the rest of the internet out of your network to protect you. Here we install a VPN and configure the firewall to only allow very secure VPN traffic in.

# DuckDNS
## DuckDNS
If you want to have a dynamic DNS point to your Public IP I added a helper script.
Register with duckdns.org and create a subdomain name. Then edit the `nano ~/IOTstack/duck/duck.sh` file and add your

Expand All @@ -20,7 +21,7 @@ paste the following in the editor `*/5 * * * * sudo ~/IOTstack/duck/duck.sh >/de

Your Public IP should be updated every five minutes

# PiVPN
## PiVPN
pimylifeup.com has an excellent tutorial on how to install [PiVPN](https://pimylifeup.com/raspberry-pi-vpn-server/)

In point 17 and 18 they mention using noip for their dynamic DNS. Here you can use the DuckDNS address if you created one.
Expand All @@ -31,7 +32,7 @@ Once you activate your VPN (from your phone/laptop/work computer) you will effec

I personally use the VPN any time I'm on public wifi, all your traffic is secure.

# Zerotier
## Zerotier
https://www.zerotier.com/

Zerotier is an alternative to PiVPN that doesn't require port forwarding on your router. It does however require registering for their free tier service [here](https://my.zerotier.com/login).
Expand Down
5 changes: 3 additions & 2 deletions docs/Adminer.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# References
# Adminer
## References
- [Docker](https://hub.docker.com/_/adminer)
- [Website](https://www.adminer.org/)

# About
## About

This is a nice tool for managing databases. Web interface has moved to port 9080. There was an issue where openHAB and Adminer were using the same ports. If you have an port conflict edit the docker-compose.yml and under the adminer service change the line to read:
```
Expand Down
25 changes: 13 additions & 12 deletions docs/Backups.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# Backups
Because containers can easily be rebuilt from docker hub we only have to back up the data in the "volumes" directory.

# Cloud Backups
## Dropbox-Uploader
## Cloud Backups
### Dropbox-Uploader
This a great utility to easily upload data from your Pi to the cloud. https://magpi.raspberrypi.org/articles/dropbox-raspberry-pi. It can be installed from the Menu under Backups.
## rclone (Google Drive)
### rclone (Google Drive)
This is a service to upload to Google Drive. The config is described [here]( https://medium.com/@artur.klauser/mounting-google-drive-on-raspberry-pi-f5002c7095c2). Install it from the menu then follow the link for these sections:
* Getting a Google Drive Client ID
* Setting up the Rclone Configuration
Expand All @@ -15,10 +16,10 @@ When naming the service in `rclone config` ensure to call it "gdrive"
If you want your Google Drive to mount on every boot then follow the instructions at the bottom of the wiki page


# Influxdb
## Influxdb
`~/IOTstack/scripts/backup_influxdb.sh` does a database snapshot and stores it in ~/IOTstack/backups/influxdb/db . This can be restored with the help a script (that I still need to write)

# Docker backups
## Docker backups
The script `~/IOTstack/scripts/docker_backup.sh` performs the master backup for the stack.

This script can be placed in a cron job to backup on a schedule.
Expand All @@ -27,20 +28,20 @@ Then add `0 23 * * * ~/IOTstack/scripts/docker_backup.sh >/dev/null 2>&1` to hav

This script cheats by copying the volume folder live. The correct way would be to stop the stack first then copy the volumes and restart. The cheating method shouldn't be a problem unless you have fast changing data like in influxdb. This is why the script makes a database export of influxdb and ignores its volume.

## Cloud integration
### Cloud integration
The docker_backup.sh script now no longer requires modification to enable cloud backups. It now tests for the presence of and enable file in the backups folder
### Drobox-Uploader
#### Drobox-Uploader
The backup tests for a file called `~/IOTstack/backups/dropbox`, if it is present it will upload to dropbox. To disable dropbox upload delete the file. To enable run `sudo touch ~/IOTstack/backups/dropbox`
### rclone
#### rclone
The backup tests for a file called `~/IOTstack/backups/rclone`, if it is present it will upload to google drive. To disable rclone upload delete the file. To enable run `sudo touch ~/IOTstack/backups/rclone`

### Pruning online backups
#### Pruning online backups
@877dev has added functionality to prune both local and cloud backups. For dropbox make sure you dont have any files that contain spaces in your backup directory as the script cannot handle it at this time.

## Restoring a backup
### Restoring a backup
The "volumes" directory contains all the persistent data necessary to recreate the container. The docker-compose.yml and the environment files are optional as they can be regenerated with the menu. Simply copy the volumes directory into the IOTstack directory, Rebuild the stack and start.

# Added your Dropbox token incorrectly or aborted the install at the token screen
## Added your Dropbox token incorrectly or aborted the install at the token screen

Make sure you are running the latest version of the project [link](https://github.com/gcgarner/IOTstack/wiki/Updating-the-Project).

Expand Down Expand Up @@ -70,7 +71,7 @@ Ensure you **are not** running as sudo as this will store your api in the /root

If you ran the command with sudo the remove the old token file if it exists with either `sudo rm /root/.dropbox_uploader` or `sudo ~/Dropbox-Uploader/dropbox_uploader.sh unlink`

# Auto-mount Gdrive with rclone
## Auto-mount Gdrive with rclone

To enable rclone to mount on boot you will need to make a user service. Run the following commands

Expand Down
15 changes: 8 additions & 7 deletions docs/Blynk_server.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Blynk server
This is a custom implementation of Blynk Server

```yml
Expand All @@ -21,30 +22,30 @@ When setting up the application on your mobile be sure to select custom setup [h

Writeup From @877dev

**Getting started:**
## Getting started
Log into admin panel at https://youripaddress:9443/admin
(Use your Pi's IP address, and ignore Chrome warning).

Default credentials:
user:[email protected]
pass:admin

**Change username and password:**
## Change username and password
Click on Users > "email address" and edit email, name and password.
Save changes
Restarting the container using Portainer may be required to take effect.

**Setup gmail:**
## Setup gmail
Optional step, useful for getting the auth token emailed to you.
(To be added once confirmed working....)

**iOS/Android app setup:**
## iOS/Android app setup
Login the app as per the photos [HERE](https://github.com/blynkkk/blynk-server#app-and-sketch-changes)
Press "New Project"
Give it a name, choose device "Raspberry Pi 3 B" so you have plenty of [virtual pins](http://help.blynk.cc/en/articles/512061-what-is-virtual-pins) available, and lastly select WiFi.
Create project and the [auth token](https://docs.blynk.cc/#getting-started-getting-started-with-the-blynk-app-4-auth-token) will be emailed to you (if emails configured). You can also find the token in app under the phone app settings, or in the admin web interface by clicking Users>"email address" and scroll down to token.

**Quick usage guide for app:**
## Quick usage guide for app
Press on the empty page, the widgets will appear from the right.
Select your widget, let's say a button.
It appears on the page, press on it to configure.
Expand All @@ -55,7 +56,7 @@ To start the project running, press top right Play button.
You will get an offline message, because no devices are connected to your project via the token.
Enter node red.....

**Node red:**
## Node red
Install node-red-contrib-blynk-ws from pallette manager
Drag a "write event" node into your flow, and connect to a debug node
Configure the Blynk node for the first time:
Expand All @@ -64,7 +65,7 @@ Enter your [auth token](https://docs.blynk.cc/#getting-started-getting-started-w
When you deploy the flow, notice the app shows connected message, as does the Blynk node.
Press the button on the app, you will notice the payload is sent to the debug node.

**What next?**
## What next?
Further information and advanced setup:
https://github.com/blynkkk/blynk-server

Expand Down
1 change: 1 addition & 0 deletions docs/Custom.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Custom container
If you have a container that you want to stop and start with the stack you can now use the custom container option. This you can use for testing or in prep for a Pull Request.

You will need to create a directory for your container call `IOTstack/services/<container>`
Expand Down
3 changes: 2 additions & 1 deletion docs/Docker-commands.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Aliases
# Docker commands
## Aliases

I've added bash aliases for stopping and starting the stack. They can be installed in the docker commands menu. These commands no longer need to be executed from the IOTstack directory and can be executed in any directory

Expand Down
1 change: 1 addition & 0 deletions docs/EspruinoHub.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Espruinohub
This is a testing container

I tried it however the container keeps restarting `docker logs espruinohub` I get "BLE Broken?" but could just be i dont have any BLE devices nearby
Expand Down
29 changes: 15 additions & 14 deletions docs/Getting-Started.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Download the project
# Getting started
## Download the project

On the lite image you will need to install git first
```
Expand All @@ -14,28 +15,28 @@ To enter the directory run:
```
cd ~/IOTstack
```
# The Menu
## The Menu
I've added a menu to make things easier. It is good however to familiarise yourself with how things are installed.
The menu can be used to install docker and then build the docker-compose.yml file necessary for starting the stack and it runs a few common commands. I do recommend you start to learn the docker and docker-compose commands if you plan using docker in the long run. I've added several helper scripts, have a look inside.

Navigate to the project folder and run `./menu.sh`

## Installing from the menu
### Installing from the menu
Select the first option and follow the prompts

## Build the docker-compose file
### Build the docker-compose file
docker-compose uses the `docker-compose.yml` file to configure all the services. Run through the menu to select the options you want to install.

## Docker commands
### Docker commands
This menu executes shell scripts in the root of the project. It is not necessary to run them from the menu. Open up the shell script files to see what is inside and what they do

## Miscellaneous commands
### Miscellaneous commands
Some helpful commands have been added like disabling swap

# Running Docker commands
## Running Docker commands
From this point on make sure you are executing the commands from inside the project folder. Docker-compose commands need to be run from the folder where the docker-compose.yml is located. If you want to move the folder make sure you move the whole project folder.

## Starting and Stopping containers
### Starting and Stopping containers
to start the stack navigate to the project folder containing the docker-compose.yml file

To start the stack run:
Expand All @@ -49,13 +50,13 @@ To remove the stack:

The first time you run 'start' the stack docker will download all the images for the web. Depending on how many containers you selected and your internet speed this can take a long while.

## Persistent data
### Persistent data
Docker allows you to map folders inside your containers to folders on the disk. This is done with the "volume" key. There are two types of volumes. Any modification to the container reflects in the volume.

### Sharing files between the Pi and containers
#### Sharing files between the Pi and containers
Have a look a the wiki on how to share files between Node-RED and the Pi. [Wiki](https://github.com/gcgarner/IOTstack/wiki/Node-RED#sharing-files-between-node-red-and-the-host)

## Updating the images
### Updating the images
If a new version of a container image is available on docker hub it can be updated by a pull command.

Use the `docker-compose stop` command to stop the stack
Expand All @@ -68,14 +69,14 @@ Start the new stack based on the updated images

`docker-compose up -d`

## Node-RED error after modifications to setup files
### Node-RED error after modifications to setup files
The Node-RED image differs from the rest of the images in this project. It uses the "build" key. It uses a dockerfile for the setup to inject the nodes for pre-installation. If you get an error for Node-RED run `docker-compose build` then `docker-compose up -d`

## Deleting containers, volumes and images
### Deleting containers, volumes and images

`./prune-images.sh` will remove all images not associated with a container. If you run it while the stack is up it will ignore any in-use images. If you run this while you stack is down it will delete all images and you will have to redownload all images from scratch. This command can be helpful to reclaim disk space after updating your images, just make sure to run it while your stack is running as not to delete the images in use. (your data will still be safe in your volume mapping)

## Deleting folder volumes
### Deleting folder volumes
If you want to delete the influxdb data folder run the following command `sudo rm -r volumes/influxdb/`. Only the data folder is deleted leaving the env file intact. review the docker-compose.yml file to see where the file volumes are stored.

You can use git to delete all files and folders to return your folder to the freshly cloned state, AS IN YOU WILL LOSE ALL YOUR DATA.
Expand Down
7 changes: 4 additions & 3 deletions docs/Grafana.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
# References
# Grafana
## References
- [Docker](https://hub.docker.com/r/grafana/grafana)
- [Website](https://grafana.com/)

# Security
## Security
Grafana's default credentials are username "admin" password "admin" it will ask you to choose a new password on boot. Go to `<yourIP>:3000` in your web browser.

# Overwriting grafana.ini settings
## Overwriting grafana.ini settings

A list of the settings available in grafana.ini are listed [here](https://grafana.com/docs/installation/configuration/)

Expand Down
9 changes: 5 additions & 4 deletions docs/Home-Assistant.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
# References
# Home assistant
## References
- [Docker](https://hub.docker.com/r/homeassistant/home-assistant/)
- [Webpage](https://www.home-assistant.io/)

Hass.io is a home automation platform running on Python 3. It is able to track and control all devices at home and offer a platform for automating control. Port binding is `8123`.
Hass.io is exposed to your hosts' network in order to discover devices on your LAN. That means that it does not sit inside docker's network.

# Menu installation
## Menu installation
Hass.io now has a seperate installation in the menu. The old version was incorrect and should be removed. Be sure to update you project and install the correct version.

You will be asked to select you device type during the installation. Hass.io is no longer dependant on the IOTstack, it has its own service for maintaining its uptime.

# Installation
## Installation
The installation of Hass.io takes up to 20 minutes (depending on your internet connection). Refrain from restarting your Pi until it had come online and you are able to create a user account

# Removal
## Removal

To remove Hass.io you first need to stop the service that controls it. Run the following in the terminal:

Expand Down
1 change: 1 addition & 0 deletions docs/How-the-script-works.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# How the script works
The build script creates the ./services directory and populates it from the template file in .templates . The script then appends the text withing each service.yml file to the docker-compose.yml . When the stack is rebuild the menu doesn not overwrite the service folder if it already exists. Make sure to sync any alterations you have made to the docker-compose.yml file with the respective service.yml so that on your next build your changes pull through.

The .gitignore file is setup such that if you do a `git pull origin master` it does not overwrite the files you have already created. Because the build script does not overwrite your service directory any changes in the .templates directory will have no affect on the services you have already made. You will need to move your service folder out to get the latest version of the template.
Expand Down
5 changes: 3 additions & 2 deletions docs/InfluxDB.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# References
# InfluxDB
## References
- [Docker](https://hub.docker.com/_/influxdb)
- [Website](https://www.influxdata.com/)

# Security
## Security
The credentials and default database name for influxdb are stored in the file called influxdb/influx.env . The default username and password is set to "nodered" for both. It is HIGHLY recommended that you change them. The environment file contains several commented out options allowing you to set several access options such as default admin user credentials as well as the default database name. Any change to the environment file will require a restart of the service.

To access the terminal for influxdb execute `./services/influxdb/terminal.sh`. Here you can set additional parameters or create other databases.
10 changes: 5 additions & 5 deletions docs/MariaDB.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
# Source
## Source
* [Docker hub](https://hub.docker.com/r/linuxserver/mariadb/)
* [Webpage](https://mariadb.org/)

# About
## About

MariaDB is a fork of MySQL. This is an unofficial image provided by linuxserver.io because there is no official image for arm

# Conneting to the DB
## Conneting to the DB

The port is 3306. It exists inside the docker network so you can connect via `mariadb:3306` for internal connections. For external connections use `<your Pis IP>:3306`

![image](https://user-images.githubusercontent.com/46672225/69734358-7f030800-1137-11ea-9874-7d2c86b3d239.png)

# Setup
## Setup

Before starting the stack edit the `./services/mariadb/mariadb.env` file and set your access details. This is optional however you will only have one shot at the preconfig. If you start the container without setting the passwords then you will have to either delete its volume directory or enter the terminal and change manually

The env file has three commented fields for credentials, either **all three** must be commented or un-commented. You can't have only one or two, its all or nothing.

# Terminal
## Terminal

A terminal is provided to access mariadb by the cli. execute `./services/maraidb/terminal.sh`. You will need to run `mysql -uroot -p` to enter mariadbs interface
5 changes: 3 additions & 2 deletions docs/Mosquitto.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# References
# Mosquitto
## References
- [Docker](https://hub.docker.com/_/eclipse-mosquitto)
- [Website](https://mosquitto.org/)

[Setting up passwords](https://www.youtube.com/watch?v=1msiFQT_flo)

# Security
## Security
By default, the Mosquitto container has no password. You can leave it that way if you like but its always a good idea to secure your services.

Step 1
Expand Down
13 changes: 7 additions & 6 deletions docs/MotionEye.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
# References
# MotionQye
## References

* [Website](https://github.com/ccrisan/motioneye/wiki/Install-In-Docker)

# About
## About

MotionEye is a camera/webcam package. The port is set to 8765

# Config
## Config

This is the yml entry. Notice that the devices is commented out. This is because if you don't have a camera attached then it will fail to start. Uncomment if you need to. This is for a Pi camera, you will need to add additional lines for usb cameras

Expand All @@ -26,18 +27,18 @@ This is the yml entry. Notice that the devices is commented out. This is because
# - "/dev/video0:/dev/video0"
```

# Login Details
## Login Details

On first login you will be asked for login details. The default user is `admin` (all lowercase) with no password

# Storage
## Storage

By default local camera data will be stored in `/var/lib/motioneye/camera_name` in the container which equates to the following:

![image](https://user-images.githubusercontent.com/46672225/69735730-df934480-1139-11ea-833b-705c40ee4f8e.png)

![image](https://user-images.githubusercontent.com/46672225/69735408-4fed9600-1139-11ea-8618-f5b6c0064f27.png)

## Remote motioneye
### Remote motioneye

If you have connected to a remote motion eye note that the directory is on that device and has nothing to do with the container.
Loading

0 comments on commit 171283a

Please sign in to comment.