Skip to content

Latest commit

 

History

History
163 lines (85 loc) · 426 KB

Docker Installation Instructions.md

File metadata and controls

163 lines (85 loc) · 426 KB

These instructions demonstrate how to get the things system running in a Docker container. This is a way to give it a spin without installing the components natively on your host system. It could also be used as a way to easily bring up a things system using Amazon Web Services<TBD>, but that use case is described elsewhere</TBD>.

The instructions assume that you have installed Docker according to the instructions for Ubuntu linux. For Windows the sequence of steps is similar: commands can be entered at the Kitematic Command Line Interface (CLI) prompt. <TBD>Mac ??</TBD> The commands shown as examples below further assume that you are a member of the docker group which obviates the need to preface each command with sudo.

Pull or Build the Image

A pre-built image is available at https://hub.docker.com/r/derrickoswald/things/. This can be downloaded to your host sytem using the command:

docker pull derrickoswald/things

Or, if you want to do it the hard way, you can clone the project and run the Dockerfile yourself with the commands:

git clone https://github.com/derrickoswald/things.git

cd things/docker_run

docker build --tag=things .

In this case, alter references to derrickoswald/things to just things in the instructions below.

Start the Container

It is recommended to try using the system once interactively as practice. This involves establishing an interactive shell (--tty --interactive) without persisting the disk contents (--rm). The web server ports for CouchDB and deluge-web need to be published outside of the container. It is recommended to use non-standard port numbers to avoid conflict with host installed servers. The mapping shown below arbitrarily adds 1000 to the standard port numbers, 5984 and 8112 respectively (--publish=6984:5984 –publish=9112:8112), but other choices would also be possible. The entire command is (all one line):

docker run --tty --interactive --rm --name things --publish=6984:5984 --publish=9112:8112 derrickoswald/things

You should be presented with a prompt for a bash shell inside the container: something similar to root@c7808a2e633e:~# where the hexadecimal numbers are the host name and correspond to the CONTAINER ID shown by the command docker ps (run in another terminal on the host system).

Install things and Configure CouchDB

From the container prompt, you may perform operations understood by Ubuntu linux. You are the root user. To start the system execute the command:

/scripts/run.sh

This starts the deluged daemon, deluge-web server and CouchDB. CouchDB in turn starts the nodejs user_manager program and the java lucene search engine.

After the script is run, you can get back to the bash prompt using Ctrl-Z and then send the paused command to the background with bg:

^Z

bg

When the command is run for the first time, which is determined by the presence of the file /.firstrun, the most current version of the things system is replicated from http://thingtracker.no-ip.org and low level configuration is applied to the CouchDB instance. By “low level”, we mean changes to the CouchDB local.ini file. The location of the CouchDB initialization files can be found from the command:

couchdb -c

All of the configuration could be done using the things web interface, but then many details of the Docker container would need to be known and entered manually.

The installation is successful when you can browse from your host to the things system in the container:

http://localhost:6984/things/_design/things/_rewrite/

which should show a configuration not found alert in front of the startup screen:

configuration not found

This is the indication that the configuration database does not exist. This will be created in the next step.

You should also be able to browse to the deluge web interface:

http://localhost:9112/

which will show a password dialog (the password is the default: deluge).

NOTE: For Windows, you will need to use the IP address shown by the docker-machine ip command, e.g. 192.168.99.100, rather than localhost:

docker-machine ip default

Configure things

Clicking OK on the configuration not found alert box will take you to the Configurator wizard. Here you will need to follow the instructions on screen for the first two steps, Personalization:

personalization

and Databases:

databases

The remaining steps have already been configured by the firstrun.sh script.

Shutting Down

To stop the container simply enter the exit command at the prompt:

exit

Alternatively you can shut down the container from the host system using the docker rm command using the CONTAINER ID or the name (specified when the container was created using -name things) :

docker rm --force things

Stable Execution

Once you are comfortable and familiar with the things system, you can set up a persistent container with the command (all one line):

sudo docker run --detach --name things --publish=6984:5984 --publish=9112:8112 derrickoswald/things /scripts/run.sh

This performs the same operations that were performed manually in the previous steps, but detaches the container (--detach) and executes the startup script automatically (/scripts/run.sh).

You will need to configure the things system as before, but the changes will be persistent in the CouchDB data files.

The host locations of the CouchDB data files and deluge torrent files can be determined from the docker inspect command:

docker inspect things

This will dump a lot of information as a JSON structure. The Mounts section is the one with the details of where the data files can be accessed by the host system. For example, this output:

...

"Mounts": [

{

"Name": "a48cb4ec4ad1948173490f6651aad8fd7caff62d2634c4d2aee1065fa667a8d1",

"Source": "/var/lib/docker/volumes/a48cb4ec4ad1948173490f6651aad8fd7caff62d2634c4d2aee1065fa667a8d1/_data",

"Destination": "/torrents",

"Driver": "local",

"Mode": "",

"RW": true

},

...

{

"Name": "ffee07324b5a2c7d072dc52297aeb83babce48d05fd9f82b8576b4b008365d84",

"Source": "/var/lib/docker/volumes/ffee07324b5a2c7d072dc52297aeb83babce48d05fd9f82b8576b4b008365d84/_data",

"Destination": "/data",

"Driver": "local",

"Mode": "",

"RW": true

}

],

indicates that the torrents downloaded by the deluge daemon can be access by the host at

/var/lib/docker/volumes/a48c...a8d1/_data

and the databases created and maintained by CouchDB are accessible from the host at:

/var/lib/docker/volumes/ffee...5d84/_data

See further Docker documentation for managing images, containers and volumes.