Installing Leanote Docker Container on Synology NAS

Ensure you can log on to your NAS using SSH as we will be using commands to set up docker instances, which give more fine-tuned control.

Create a shared folder docker to store all Docker related files. Add subfolders mongo and leanote.

Download the Leanote docker configuration file app.conf from the URL below.

https://github.com/leanote/leanote/raw/master/conf/app.conf

Open the file in a text editor and edit the db.host property to equal mongo, and set the site.url property to your NAS IP address followed by port 9090. Down in the revel configuration section, set the http.addr property to the same value as your site.url property. The file should now read:


http.port=9000

site.url=192.168.178.68:9090 # or http://x.com:8080, http://www.xx.com:9000

# admin username
adminUsername=admin

# mongdb
db.host=mongo
db.port=27017

# lines omitted

http.addr=192.168.178.68:9090

Save this file on your NAS in the /docker/leanote directory. Do not rename the file. We require the latest MongoDB docker image as well as furiousgeorge/leanote and furiousgeorge/leanote-populatedb. The latter is an installation script which initializes the Mongo database. These will be downloaded automatically when we run other commands below. Alternatively, if you want to leave the downloads while you’re away, download the docker files using the Docker Registry as shown below.

Mongo Download Mongo Download

Create a Mongo Container

The following command sets up a Mongo instance with a link to the docker/mongo' directory.

docker run --name mongo -v /docker/mongo:/data/db -d mongo:3.2.3

In DSM, stop the Mongo container if it is running and click on the “Edit” button to view its options. Under the Volume tab there should be a link to /docker/mongo (the directory we set up before), pointing to the container directory /data/db. If this link is not there, use the Add Folder button to create it.

Mongo Volume Settings Mongo Volume Settings

Populate the Database

Next, we have to use Furiousgeorge’s script to populate the leanote database.

docker run --rm --link mongo:mongo furiousgeorge/leanote-populatedb

Create a Leanote Container

The command below creates a container running Leanote server, linking the configuration file, estabilishing a connection to the MongoDB container as well as mapping the local port 9090 to the container port 9000, which allows us to access the Leanote server on port 9090.

docker run --name=leanote -d -v /docker/leanote/app.conf:/src/leanote/conf/app.conf --link mongo:mongo -p 9090:9000 furiousgeorge/leanote

Double check your settings in DSM to make sure they match the ones in the screenshots below.

Leanote Volume Settings Leanote Volume Settings

Leanote Port Settings Leanote Port Settings