Skip to content

Instantly share code, notes, and snippets.

@viklas
Last active January 28, 2016 22:19
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save viklas/639d2f49a8ff2819fde4 to your computer and use it in GitHub Desktop.
Save viklas/639d2f49a8ff2819fde4 to your computer and use it in GitHub Desktop.
Starting a dockerized instance of Sirius

##Instructions for setting up sirius from the Emerging Stack dockerfile (end-to-end) ####NOTE: Everything here works on a laptop, but it will run out of disk space in all likelihood, requiring an annoying boot2docker hack. It's easier and faster in the cloud. You can copy/paste each of the commands below...without the dollar or hash symbol. Remember, if you terminate your DigitalOcean droplet, you'll have to do all these steps again (but they will survive a server reboot).

####At the end of this process, you will be able to ask Sirius some wikipedia type questions (when, which, where, etc) inside a terminal window...don't expect a fancy user experience, this is raw functionality only.

###Cloud Server Provisioning Stage

  1. Sign in to digitalocean and set up an account, billing, etc

  2. Setup new droplet ($40 month size with Ubuntu 14.04)...wait 1 minute

  3. Click the 'access - console access' button

  4. Copy the IP Address you will see displayed

  5. Open terminal on your computer

  6. Connect to the server via SSH (Let's call this "SessionA" for later reference)

$ ssh root@{public IP addess}
  1. Open the email you got from digital ocean

  2. Copy/paste the password into the terminal window at the password prompt

  3. Change the password when prompted (current/new/confirm) ###Docker Time

  4. Install docker

$ curl -sSL https://get.docker.com/ubuntu/ | sudo sh
  1. Install Git tools
$ apt-get update
$ apt-get install -y git
  1. Clone the 'dockerised' version of sirius
git clone https://github.com/emergingstack/sirius.git

###Alright...time to get sirius... 13) Build the Sirius docker base image

$ cd sirius
$ docker build -t siriusbase:latest .
  1. Wait...about 15 mins...it's grabbing all the dependent software and creating a docker 'gold image' ###Almost finished. Time to compile the Sirius binaries

  2. Start the docker container

$ docker run -it \
    -e JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64/jre \
    -e JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF8 \
    -v /root/sirius/:/opt/sirius \
    -p 8080:8080 \
    -p 8081:8081 \
    -p 8082:8082 \
    siriusbase:latest bash
  1. You're now at a command prompt, inside the sirius docker container, ready to build the binaries
# cd opt/sirius/sirius-application/
# chmod +x start.sh
# ./start.sh
  1. Wait...about 30 minutes for all the binaries to compile...maybe write a blog post or read this one to learn something about chat-bots: http://www.emergingstack.com/blog

17a) (optional) If you're curious to see if the binaries are still compiling....in the "SessionB" window:

# top

Now you can watch the CPUs spin as the binaries finish compiling...or read some stuff on reddit/showerthoughts while you wait...ctrl-c to exit the 'top' utility when you're ready. ###Importing the wikipedia 'brain' for Sirius (these steps come direct from the Sirius instructions online) 18) Open a new terminal window ("SessionB") and SSH into your server again (as per step 6, using your new root password)

  1. Download the wikipedia content (in "SessionB")
# wget http://web.eecs.umich.edu/~jahausw/download/wiki_indri_index.tar.gz
  1. Wait...takes about 5 minutes...

  2. Unzip the wikipedia package

# tar xzvf wiki_indri_index.tar.gz -C /root/sirius/sirius-application/question-answer/
  1. Wait...this takes about 10 minutes to unzip

###Finally, we can now start Sirius (Question and Answer server) 23) Still in the "SessionB" window (where you just unpacked wikipedia)

# docker ps
  1. Look at the "CONTAINER ID". Write this down somewhere, you'll probably need it later.
# docker exec -it {type docker container ID here} bash
# cd /opt/sirius/sirius-application/run-scripts/
# ./start-qa-server.sh

###Sirius is now running and ready to answer some sirius questions 25) Go back to "SessionA" (which should just be sitting there at a command prompt after the "Server Compilation Complete" log entry. To test if it's working:

# cd /opt/sirius/sirius-application/run-scripts/
# ./sirius-qa-test.sh "what is the speed of light"

fin...enjoy!

###Bonus steps - to prevent having to do all that again 26) In "SessionB", hit ctrl-c to shut down the sirius Q&A server application :-(

  1. Exit your docker container sessions (A and B) by typing 'exit'. It will return you to the command prompt on the server.

  2. Good one...you just shut down your container...now if you want to start it again to impress your friends

# docker start {that container ID you wrote down}
  1. Repeat step 24 to restart sirius, and step 25 to run some tests

####Don't forget to go back and delete your droplet when you're done, before you blow too much money on this experiment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment