Nov 262014
 

Shipyard is a web based user interface that gives you the ability to manage  Docker resources including containers, hosts and more.  It is a nice UI for Docker when you can get it to run correctly.  The  QuickStart guide on the Shipyard site is missing a few pieces if you are using Ubuntu.  it is also important to follow the guide sequentially.  Here are the steps that it took for me to have a working Shipyard installation.

 

The first step is to install Docker:

root@dockertest:/root# apt-get install docker.io

The next step is to modify the Docker installation to listen on all interfaces.  Edit the /etc/default/docker.io file and add the following line:

DOCKER_OPTS="$DOCKER_OPTS -H tcp://0.0.0.0:2375 -H unix:///var/run/docker.sock"

You will then need to restart the Docker service.  In a shell window as root, execute the following command:

root@dockertest:/root# service docker.io restart

You can now run the three commands (as of Nov 26 2014) from the Shipyard Quickstart guide as root:

docker run -it -d --name shipyard-rethinkdb-data --entrypoint /bin/bash shipyard/rethinkdb -l

docker run -it -P -d --name shipyard-rethinkdb --volumes-from shipyard-rethinkdb-data shipyard/rethinkdb

docker run -it -p 8080:8080 -d --name shipyard --link shipyard-rethinkdb:rethinkdb shipyard/shipyard

You now have two containers running that can be referenced by the names “shipyard/rethinkdb” and “shipyard“.  At this point you can hit the Shipyard UI (http://localhost:8080) and login with the default credentials of admin/shipyard.

The next item will be to add the local machine as an Engine to the Shipyard instance.  The first thing you will need to  do is determine the IP address used for the Docker interface.  Typically this will be an address in the 172.x.x.x network segment.  On Ubuntu Trusty it will be the IP address associated with the “docker0” interface on a default installation.  In my instance the IP address is 172.17.42.1.  This will be the address that you use when adding an Engine to Shipyard.

ShipyardAddEngine

You should now have a working Shipyard setup! ..But wait, I want this to startup when my system boots.  Now we need a set of Upstart configuration files.

 

/etc/init/shipyard.conf

description    "Shipyard Web UI"

start on runlevel [2345]
stop on runlevel [!2345]

respawn

exec /usr/bin/docker start -a shipyard

pre-stop exec /usr/bin/docker stop -t 2 shipyard

/etc/init/shipyard-rethinkdb.conf

description "Shipyard Web UI RethinkDb"

start on starting shipyard
stop on stopping shipyard

respawn

exec /usr/bin/docker start -a shipyard/rethinkdb

pre-stop exec /usr/bin/docker stop -t 2 shipyard/rethinkdb

You will now be able to start and stop Shipyard using the service command.

root@dockertest:/root# service shipyard start

Share and Enjoy

  • Facebook
  • Twitter
  • StumbleUpon
  • Add to favorites
  • Email
  • RSS
 Posted by at 11:48 am
Nov 222014
 

Rebecca and I use a ScanSnap scanner to scan and save our bills and major receipts to PDF files.   The only problem we continued encountering was that we would scan documents, and they would accumulate in a directory on the server to be sorted later.  I took a little time today to write PyFiler to help out.  It’s a simple program that will scan a directory and use a file containing rules on text matched in the PDF file.  If the rules match, the file is moved to the specified directory for you.  It is written in Python and has a single dependency of PDFMiner.

PyFiler reads a CSV rules file to determine if a file should be moved. The first element of the CSV row is the directory to move files when a match occurs. The remaining CSV elements are treated as regular expression patterns for matching against the file’s contents.

All elements must be matched for the file to be moved.

Example CSV file:

/mnt/docs/BankStatements, BankofAmerica, 234923409238409, MyAccountName
/mnt/docs/Utils/Gas, Atmos, 900980928234, ATMOSENERGY
/mnt/docs/Mortgage, wellsfargo.com, WELLSFARGOHOMEMORTGAGE, 4234135-234234

The fields can be a collection of account numbers, names, phone numbers, etc that can be used to distinguish between one PDF file and another.

To help determine what your criteria should be, you can use the pdf2txt executable that comes with PDFMiner. Example:

chris@frosty:/home/chris# pdf2txt -W0 myfile.pdf | less

It is important to use the -W0 to avoid the random spacing that can occur in the output from PDFMiner.

Share and Enjoy

  • Facebook
  • Twitter
  • StumbleUpon
  • Add to favorites
  • Email
  • RSS
 Posted by at 7:49 pm