Matt Shore - Docker Dash

Docker Dashboard – Simple Monitor

Simple Docker  Monitoring Dashboard

I’ve spent a couple of weeks learning about the Docker API and decided to create a simple little dashboard. Developed in PHP and still under development but though it would be fun to share in the mean time.

get it on git here: https://github.com/mattshore1987/docker-dash

Prerequisites

  • Apache 2 installed or running from a docker container
  • Docker API port opening https://docs.docker.com/engine/reference/commandline/dockerd/#daemon-socket-option
  • read/write permissions on ‘/hosts’ folder. (I have deliberately created this so no database is needed. All config files are wrote to ‘/hosts’

command line:

cd /var/www/*yourDir*

sudo git clone https://github.com/mattshore1987/docker-dash.git
cd /docker-dash
sudo mkdir hosts

Got to http://yourwebsite/docker-dash/

You should be promoted for your first host’s IP address. I have assumed port 2375 will have been used. If you cannot add a host or get:

Warning: fopen(hosts/host-1.php): failed to open stream: No such file or directory in /var/www/html/test/docker-dash/add_host_post.php on line 16

Notice: Undefined variable: myfile in /var/www/html/test/docker-dash/add_host_post.php on line 16
Cannot open file:

Make sure read/write permissions are available for /hosts/

After successful permissions have been applied you will see:

Now you should be able to see your host details including running containers and memory. Now try adding your next hosts from the navigation bar on the right.

 

Add your second host’s details.

Continue as above for all your hosts. All hosts will be dynamically added to the dashboard. Finally you will be able to monitor all your Docker hosts and containers from just the one page.

Matt Shore - Docker Dash

Gaming Beast

The Gaming Beast…

The Build

Component Selection
CPU
Intel – Core i7-8700K 3.7GHz 6-Core Processor
CPU Cooler
NZXT – Kraken X62 Rev 2 98.2 CFM Liquid CPU Cooler
Motherboard
Asus – ROG Strix Z370-I Gaming Mini ITX LGA1151 Motherboard
Memory
G.Skill – Trident Z 16GB (2 x 8GB) DDR4-3600 Memory
Storage
Samsung – 960 EVO 250GB M.2-2280 Solid State Drive
Samsung – 960 EVO 500GB M.2-2280 Solid State Drive
Crucial – BX100 1TB 2.5″ Solid State Drive
Video Card
Asus – GeForce GTX 1080 Ti 11GB STRIX GAMING Video Card
Case
Phanteks – ENTHOO EVOLV SHIFT X Mini ITX Tower Case
Power Supply
Corsair – 860W 80+ Platinum Certified Fully-Modular ATX Power Supply
Operating System
Microsoft – Windows 10 Pro OEM 64-bit
Monitor
Acer – Predator X34 34.0″ 3440×1440 100Hz Monitor
Keyboard
Asus – STRIX TACTIC PRO Wired Gaming Keyboard
Mouse
Asus – STRIX P302 Wired Optical Mouse
1 x Intel Core i7-8700K LGA1151 3.70GHz OEM Processor

Intel Core i7-8700K LGA1151 3.70GHz OEM Processor

Asus ROG STRIX Z370-I GAMING 1151 DDR4 ATX Motherboard

Asus ROG STRIX Z370-I GAMING 1151 DDR4 ATX Motherboard

G.Skill Trident Z RGB 16GB Kit DDR4 3600MHz RAM

G.Skill Trident Z RGB 16GB Kit DDR4 3600MHz RAM

Asus GTX 1080 Ti ROG Strix OC 11GB GDDR5X Graphics Card

Asus GTX 1080 Ti ROG Strix OC 11GB GDDR5X Graphics Card

NZXT Kraken X62 Liquid Cooler

NZXT Kraken X62 Liquid Cooler

Phanteks Enthoo Evolv Shift X Mini-ITX Tempered Glass Case - Gunmetal Grey

Phanteks Enthoo Evolv Shift X Mini-ITX

P302 ROG Strix Evolve Gaming Mouse

P302 ROG Strix Evolve Gaming Mouse

Corsair AXi 860W Fully Modular 80+ Platinum Power Supply

Corsair AXi 860W Fully Modular 80+ Platinum Power Supply

ASUS ROG Claymore Core Fully Mechanical Gaming Keyboard - MX Red

ASUS ROG Claymore Core Fully Mechanical Gaming Keyboard – MX Red

Ultimate Docker Setup

Ultimate Docker Setup

This iDocker Logos a quick guide to setup the ultimate home server. To include file sharing & synchronising, email and website hosting, media sharing and streaming, and automatic downloads of TV, movies and music.

Firstly install the latest Ubuntu 16 distro (Download from here: https://www.ubuntu.com/download/server )

Installing Docker

 

sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
software-properties-common

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add –
sudo app-get-repository “deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable”
sudo apt-get update
apt-cache policy docker-ce
sudo apt-get install docker-ce
sudo systemctl status docker

Create shares & environment for media server elements

sudo mkdir /shares/
sudo mkdir /shares/tv
sudo mkdir /shares/movies
sudo mkdir /shares/transcode
sudo mkdir /shares/downloads
sudo mkdir /shares/downloads/music
sudo mkdir /shares/downloads/tv
sudo mkdir /shares/downloads/movies
sudo mkdir /shares/downloads/incomplete
sudo mkdir /shares/downloads/complete
sudo mkdir /shares/music

Samba file sharing setup

sudo nano /etc/samba/smb.conf

Edit the file to include:

[shares]
comment = shares
path = /shares/
browsable = yes
guest ok = yes
read only = no
create mask = 0777

press ctrl + x type y

lets now just ensure guest access to the shares on your network will be available:

sudo chmod -R 777 /shares/

 Setting Up Portainer

Lets start deploying some containers. Portainer will allow you to easily manage your Docker host so lets start there:

Portainer Logo

Portainer

sudo docker create –name portainer \
–restart=always \
–net=bridge \
-e PGID=1001 -e PUID=1001 \
-v /home/docker/portainer/config:/config \
-v /var/run/docker.sock:/var/run/docker.sock \
-p 9000:9000 \
portainer/portainer

Setting Up Deluge

Deluge will be our download client:

Deluge Logo

Deluge

sudo docker create –name deluge \
–restart=always \
–net=bridge \
-e PGID=1001 -e PUID=1001 \
-v /home/docker/deluge/config:/config \
-v /shares/tv:/shares/tv \
-v /shares/movies:/shares/movies \
-v /shares/music:/shares/music \
-v /shares/downloads:/shares/downloads \
-p 8112:8112 \
-p 58846:58846 \
linuxserver/deluge

Setting Up Sonarr

Sonaar to find TV shows:

Sonarr Logo

Sonarr

sudo docker create \
–name sonarr \
–restart=always \
-p 8989:8989 \
-e PGID=1001 -e PUID=1001 \
-v /home/docker/sonarr/config:/config \
-v /shares/downloads:/shares/downloads \
-v /shares/tv:/shares/tv \
-e TZ=Europe/London \
-v /shares/tv:/shares/tv \
linuxserver/sonarr

Setting Up Radarr

Radarr Logo

Radarr

Radarr for movies:

sudo docker create \
–name=radarr \
–restart=always \
-v /home/docker/radarr:/config \
-v /shares/downloads/:/shares/downloads/ \
-v /shares/movies:/shares/movies \
-e TZ=Europe/London \
-e PGID=1001 -e PUID=1001 \
-p 7878:7878 \
linuxserver/radarr

Watchtower will ensure all our containers remain updated automatically.

sudo docker create \
–name watchtower \
–restart=always \
-v /var/run/docker.sock:/var/run/docker.sock \
-e TZ=Europe/London \
-e PGID=1001 -e PUID=1001 \
v2tec/watchtower

MySQL to be backend database for WordPress

sudo docker create \
–name=mysql \
–restart=always \
-e MYSQL_ROOT_PASSWORD=password \
-v /home/docker/mysql:/config \
-e TZ=Europe/London \
-e PGID=1001 -e PUID=1001 \
-p 3306:3306 \
mysql

PhpMyAdmin incase you need to manage the database at any point

sudo docker create \
–name=phpmyadmin \
–restart=always \
-v /home/docker/phpmyadmin:/config \
-e TZ=Europe/London \
–link mysql:db \
-e PGID=1001 -e PUID=1001 \
-p 8080:80 \
phpmyadmin/phpmyadmin

Plex to stream and manage your media

sudo docker create \
–name=plex \
–hostname=plex.mattshore.co.uk \
–net=host \
–restart=always \
-e VERSION=latest \
-e PUID=1001 -e PGID=1001 \
-e TZ=Europe/London \
-v /home/docker/plex/config:/config \
-v /shares/:/shares/ \
linuxserver/plex

PosteIO to act as our mail server stack

sudo docker create \
–name=posteIO \
–restart=always \
-p 25:25 \
-p 82:80 \
-p 110:110 \
-p 143:143 \
-p 442:443 \
-p 465:465 \
-p 587:587 \
-p 993:993 \
-p 995:995 \
-e PUID=1001 -e PGID=1001 \
-e TZ=Europe/London \
-v /home/docker/posteIO:/data \
analogic/poste.io

LetEncrypt to give our services some well needed SSL encryption with free certificated.

sudo docker create \
–name=letsencrypt \
–restart=always \
-v /home/docker/nginx:/config \
-e VALIDATION=http,tls-sni,dns \
-e PGID=1001 -e PUID=1001 \
-e [email protected] \
-e URL=url.com \
-e SUBDOMAINS=cloud,www,mail,plex \
-p 80:80 -p 443:443 \
-e TZ=Europe/London \
linuxserver/letsencrypt

NextCloud for sharing files and hosting your own private cloud file services.

sudo docker create \
–name nextcloud \
-p 9443:443 \
-e PUID=1001 -e PGID=1001 \
-v /home/docker/nextcloud/config:/config \
-v /home/docker/nextcloud/data:/data \
linuxserver/nextcloud

Finally HTPC to be a single pane of glass to all the other apps we’ve just installed.

sudo docker create –name=htpcmanager \
-v /home/docker/htpcmanager:/config \
-e PGID=1001 -e PUID=1001 \
-e TZ=Europe/London \
-p 8085:8085 \
linuxserver/htpcmanager

 

Simples… 🙂

Ubuntu Docker

HTPC – Ultimate Media Server on Docker

Notes – Ubuntu and Docker need to be installed first to create this ultimate HTPC server.

Setup the Environment

Lets start by creating some shares for your media server to utilise.

sudo mkdir /shares/tv
sudo mkdir /shares/movies
sudo mkdir /shares/transcode
sudo mkdir /shares/downloads
sudo mkdir /shares/music

Plex Docker Install

sudo docker create \
–name=plex \
–hostname=plex.<domain> \
–net=host \
–restart=always \
-e VERSION=latest \
-e PUID=1001 -e PGID=1001 \
-e TZ=Europe/London \
-v /home/docker/plex/config:/config \
-v /shares/tv:/shares/tv \
-v /shares/movies:/shares/movies \
-v /shares/downloads:/shares/downloads \
-v /shares/transcode:/shares/transcode \
-v /shares/music:/shares/music \
linuxserver/plex

Deluge Docker Install

sudo docker create –name deluge \
–restart=always \
–net=bridge \
-e PGID=1001 -e PUID=1001 \
-v /home/docker/deluge/config:/config \
-v /shares/tv:/shares/tv \
-v /shares/movies:/shares/movies \
-v /shares/music:/shares/music \
-v /shares/downloads:/shares/downloads \
-p 8112:8112 \
-p 58846:58846 \
linuxserver/deluge

Sonarr Docker Install

docker create \
–name sonarr \
–restart=always \
-p 8989:8989 \
-e PGID=1001 -e PUID=1001 \
-v /home/docker/sonarr/config:/config \
-v /shares/downloads:/shares/downloads \
-e TZ=Europe/London \
-v /shares/tv:/shares/tv \
linuxserver/sonarr

Radarr Docker Install

docker create \
–name=radarr \
–restart=always \
-v /home/docker/radarr:/config \
-v /shares/downloads/:/shares/downloads/ \
-v /shares/movies:/shares/movies \
-e TZ=Europe/London \
-e PGID=1001 -e PUID=1001 \
-p 7878:7878 \
linuxserver/radarr

 

Docker

Docker

What is Docker?

I stumbled across Docker a while ago and the concept just intrigued me. The ability to create an application that only ships with the parts it needs. Windows and its applications have often been criticised for their size and bloated overhead on the underlying hardware. This bloat also has security consequences in addition. Imagine, if Windows stopped shipping Windows OS’s without SMB v1 protocol enabled rather than just leaving it to additionally bloat the OS and leave it vulnerable to Petcha and WannaCry.

Docker allows for developers to be more agile and responsive to these modern needs. This is achieved by Dockers smarter architecture to software deployment. Docker manages the following:

  • Images
    • These are the base files for an application to run. Having this base image makes deployment of multiple applications and services quick, manageable and repeatable. For example if you needed multiple web servers you could have a single base image with the entire LAMP (Linux, Apache, MySQL, and PHP/Python/Perl) stack ready to run.
  • Containers
    • Containers are the individual instances of the base image. For example I need to run two separate LAMP stacks with individual content on each. You could rapidly deploy two containers that utilise the same base image.
  • Networks
    • Docker has the ability to manage the network resources for all your containers. This can help dynamically ensure ports are open and the applications are running.
  • Volumes
    • Docker will provision storage pools and manage this process for the containers that need resource. I would advise reading about persistent and non persistent storage when looking into Docker deployments.

Docker ultimately improves all aspects of application deployment, management, and maintenance. You get the very best efficiencies out of the underlying hardware and is a really cool advancement in tech. Docker is the go to system for ‘Micro Services’ but in my opinion they have many uses. From a ‘Micro Service’ perspective, lets say you need to run a mini survey for your company. You could simply spin up a container, collect the data, analyse it then delete it in a very rapid and efficient manner. This is a great way of achieving a businesses needs rapidly but also remove issues around long term retention of data especially with GDPR and other regulations coming on tap.

 

Nextcloud Banner

Nextcloud – Private Cloud

Cloud features without the ‘Cloud Risk’

Cloud gives users the ability to backup and easily share files but with Pecha and other cybersecurity issues is ‘Cloud’ the best place for your data? For me it just isn’t worth the risk of putting my files on someone else’s hardware. Yes, I am a control freak when it comes to technology. Recently I upgraded my home micro server to an Intel NUC see here with this I wanted to sync all my devices and files automatically.

So Why NextCloud?

NextCloud gives me the ability to have cloud like features without handing my data to a cloud provider. An on premise cloud that I control, just makes perfect sense right?

I can now easily share folders and files with colleagues, family and friends at the click of a button. All my devices are automatically synchronised and encryption is a key aspect of the NextCloud philosophy. With SSL enabled as standard and file encryption is enabled with ease, security of those personal files hasn’t ever felt so secure and simple.

I now know that my data is secure, or as secure as it can be and I can access it anywhere. Deployment is relatively straight forward, I personally opted to deploy under a Docker instance:

sudo docker create \
–name nextcloud \
–net=bridge \
–hostname=x.x.com \
-p 443:443\
-e PUID=1001 -e PGID=1001 \
-v /home/docker/nextcloud/config:/config \
-v /home/docker/nextcloud/data:/data \
linuxserver/nextcloud

I created two persistent locations for NextCloud to store its data and config. My database is stored in mySQL on another Docker instance. NextCloud will walk you through this in a few easy steps on initial setup.

A few key items to consider for your environment if you are considering to deploy at home:

  • A Static IP Address
  • Decent internet download/upload bandwidth
  • Domain name

Other than that you should be good to go. Welcome to the cloud business  d(-_-)b