Automate Docker Image and Container Updates Running on Synology

Updating docker containers is as easy as pulling the image and drop and re-create the container. This can be automated using watchtower appliance, hosted in a docker container itself.

Watchtower is a process for watching your Docker containers and automatically restarting them whenever their base image is refreshed.

Download the docker image

The image is named: centurylink/watchtower

Create container (using terminal)

I’ve set my instance to only match once a day, with a schedule set to every 23h. It will also ensure old image versions are pruned.

Start a terminal session. Log in as a user and then type sudo -i with the admin password to get the root permissions

As root type following code:

root@synology:~# docker run -d –name watchtower -v /var/run/docker.sock:/var/run/docker.sock centurylink/watchtower –interval 82800 –cleanup

Automatically check and upgrade running containers

Watchtower will periodically check the repos for updates and upgrade when neccessary, pruning old image versions when upgrade completes.

This will also update the Watchtower image.

Sickbeard Custom error when starting the package

Problem:

It displayed the following error when starting the package in the package manager.

Failed to run the package service

Solution:

Change the user in the start-stop-status file of sickbeard-custom to “root”.

Steps:

  1. Log into synology through putty (or similar) as “root”.
    1. first log in as admin with the admin password
    2. then type “sudo -i”
    3. use the admin password again
    4. you are now logged in as root
  2. enter “vi /var/packages/sickbeard-custom/scripts/start-stop-status
  3. Navigate (using arrow keys on keyboard) to line that says “USER=”sickbeard-custom” (about 4 lines down)
  4. Using the Basic commands for the Linux vi Editor http://forum.synology.com/wiki/index.php/Linux_VI_Editor
    • delete (x) the word “sickbeard” and replace/insert (i) it with the word “root”
    • Press ESC to exit insert mode
    • Press SHIFT :wq then enter to save and exit.
  5. Type “vi /var/packages/sickbeard-custom/scripts/start-stop-status” to confirm that the USER has been correctly changed to root.
  6. Close and exit Putty if you desire.
  7. Open sickbeard web management page [http://<Diskstation IP>:8083]

Automatically connect a Raspberry Pi to a Wifi network with a Belkin N300 micro USB dongle

Setting up WiFi connection

Start by booting the Raspberry Pi, connected to a display and a keyboard. Open up the terminal and edit the network interfaces file:

$ sudo nano /etc/network/interfaces

This file contains all known network interfaces, it’ll probably have a line or two in there already.

Change the first line (or add it if it’s not there) to:

auto wlan0

Then at the bottom of the file, add these lines telling the Raspberry Pi to allow wlan as a network connection method and use the /etc/wpa_supplicant/wpa_supplicant.conf as your configuration file.

allow-hotplug wlan0
iface wlan0 inet dhcp
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp

(ctrl-X, then type Y to quit and save)

The next step is to create this configuration file.

Configuring WiFi connection

Open up the wpa_supplicant.conf file in the editor.

$ sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

Again, some lines might already be present, just add the following.

network={
ssid="YOUR_NETWORK_NAME"
psk="YOUR_NETWORK_PASSWORD"
proto=RSN
key_mgmt=WPA-PSK
pairwise=CCMP
auth_alg=OPEN
}

Make sure it works

Reboot the Raspberry Pi and it should connect to the wireless network.

sudo reboot

A static IP

Since the goal of this tutorial is to be able to work with the RPi without external keyboard or display, you want to be ssh into it. The best way is to make sure it’ll always have a static IP on your network.

Doing so is simple. Open the /etc/network/interfaces file again and add the following changes:

Change iface wlan0 inet dhcp into iface wlan0 inet static. This changes the wlan0 interface from DHCP to static.

Add the following lines before the wpa-conf line:

address 192.168.1.155 # Static IP you want 
netmask 255.255.255.0 
gateway 192.168.1.1   # IP of your router

Reboot your Raspberri Pi

sudo reboot

 

Connection MrMC (ATV4) with MySQL database

First export your local database

  • Export your library as a single file to a network location

Setup MySQL Database

  • First SSH into your Synology
ssh root@ipsynology
  • Connect to the database.
mysql -u root -p

Specify MySQL user with -u option. If the user has a password add the -p option. Enter the password used during MySQL configuration when prompted.

  • Create a new database user.
CREATE USER 'mrmc' IDENTIFIED BY '*****';

Username is defined with CREATE USER statement while the password is specified with IDENTIFIED BY statement.

  • Grant permissions on video and music databases to the new user.
GRANT ALL ON `MyVideos%`.* TO 'mrmc';
GRANT ALL ON `MyMusic%`.* TO 'mrmc';

All possible permissions are granted with GRANT ALL ON statement to both Kodi video and music databases. User that is being granted permissions is specified with the TOstatement.

  • Exit the database command line tool.
quit
  • Enable the MySQL and your library will be empty
  • Import your previously exported database in the MySQL database
  • Now connect your other MrMc installations with the MySQL database and everything will be synced

Mount network drives in ClearOS

Create a SSH connection to your ClearOS server with putty or via terminal

1. Create a folder to mount share on

mkdir /mnt/folder

2. Open FSTAB

nano /etc/fstab

3. Add share definition/s to FSTAB, add the following line to the end. Once happy save (CTRL-O)

\\compname\sharenam     /mnt/folder  cifs auto,rw,username=usernamel,password=password 0 0

4.Mount Shares

mount -a

And your done….

Last update Kodi for the Apple TV 2

kodi-helix-14.1

Kodi v14.1 “Helix” is the last update that you can install on the Apple  TV 2

To update follow these steps:

  1. Open up your terminal/ssh application and enter the following command to log in to your ATV2:
    ssh root@YOUR.ATV2.IP.ADDRESS
    EXAMPLE: ssh root@192.168.1.5
  2. You will be asked for a password: default password is alpine
  3. Continue to enter the following commands:
    apt-get update
    apt-get install org.xbmc.kodi-atv2

Raspberry Pi als netwerk – en AirPrint printserver

Raspi_Colour_R

Installatie:

  • download de laatste raspbian wheezy van de download pagina van Raspberry
  • download Win32DiskImager hier en installeer het.
  • Start Win32DiskImageren en gebruik het gedownloade schijfbestand van raspbian. Dit wordt naar dan op de SD kaart geschreven

Eerste boot:

  • Je komt in het configuratiemenu van raspbian. Dit kun je naderhand nog terug oproepen door het commando sudo raspi-config uit te voeren. Hier moet je zeker volgende stappen uitvoeren:
    1. expand-rootfs zo krijg je de volledige schijfruimte terug beschikbaar na de volgende reboot
    2. memory-split hiermee wijs je het nodige geheugen toe aan de GPU, voor server is 16MB voldoende
    3. SSH server activeren
    4. Standaard paswoord wijzigen voor de gebruiker pi
    5. voor de rest kun je nog alle instellingen voor tijd en toetsenbord ook aanpassen
  • druk op Finish en de Raspberry Pi zal herstarten

Static ip adres toewijzen:

  • log in met de gebruikersnaam pi  en je paswoord (standaard raspberry) als de Raspberry is opgestart
  • ifconfig eth0  zal je het DHCP toegewezen ip adres weergeven
  • sudo nano /etc/network/interfaces
  • wijzig iface eth0 init dhcp naar iface eth0 static
  • voeg volgende lijnen toe:
    1. address your.static.ip.address
    2. netmask 255.255.255.0
    3. gateway your.router.ip.address
  • sudo reboot om alle instellingen te activeren

CUPS printer software installeren:

  • de raspbian software updaten
    1. sudo apt-get update
    2. sudo apt-get upgrade
  • installeren van de printersoftware
    • sudo apt-get install avahi-daemon cups cups-pdf cups-driver-gutenprint openprinting-ppds python-cups python-daemon python-pkg-resources
  • na de installatie stellen we toegang van buitenaf in
    1. sudo nano /etc/cups/cupsd.conf
      1. zoek  Listen localhost:631  en verander het in #Listen localhost:631
      2. daaronder voeg je Port 631
      3. Daarna voegen we in de secties , en vlak voor de regel telkens de regel Allow @Local toe om de toegang te beperken tot gebruikers van de Raspberry Pi. Sla je wijzigingen op met Ctrl+O en sluit nano af met Ctrl+X.
        putty-raspberry

Beheerder toevoegen:

  • Herstart de cups server door sudo service cups restart uit te voeren
  • voeg de gebruiker pi toe aan de beheerders van de printserver door sudo adduser pi lpadmin uit te voeren

Bezoek nu in je webbrowser de url https://IP:631/, waarbij IP het IP-adres van je Raspberry Pi is. Als je een waarschuwing krijgt over het beveiligingscertificaat, negeer dat dan

cups_main

Baïkal – Lightweight CalDAV+CardDAV server

You can download and install this package on your synology diskstation.

http://baikal-server.com

Unpack the package and upload it to your web folder on the diskstation.
After the upload go with your web browser to the path.

http://ip.of.your.diskstation/baikal

Complete all required information and then you are ready to use it.

After login you create a new user.

To add your calendar in your calendar software or IOS device you need to enter the caldav information in the program.

On your disk station you need to enable the https and add an non standard https port. This port you need to forward in your router to your disk station ip-address.

server:

https://your.ip.address:httpsport/cal.php/principals/username

your.ip.adress: is the public or private ip address
httpsport: is the custom https port you entered in your synology disk station and in the portforward of the router
username: is the username you created earlier.

if you’ve done everything right, the calendar should show up in your calendar software.

To add your contacts you need to enter the CardDAV information in the program.

server:

https://your.ip.address:httpsport/card.php/principals/username

your.ip.adress: is the public or private ip address
httpsport: is the custom https port you entered in your synology disk station and in the portforward of the router
username: is the username you created earlier.

if you’ve done everything right, the contacts should synchronise between devices where the CardDAV is installed on.