Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Vagrantfile and Dockerfile for Sirius, open-source end-to-end standalone intelligent personal assistant (IPA) service. Dockerfile and start-qa-server.patch MUST be moved ./docker directory.
FROM ubuntu:trusty
# forked from https://github.com/jhauswald/sirius/pull/55
MAINTAINER kyama <yamasaki.k.1101@gmail.com>
# for Ubuntu 14.04
RUN apt-get update && apt-get install -y \
software-properties-common
RUN apt-get update && apt-get install -y \
wget \
git \
vim
RUN cd /opt \
&& mkdir sirius \
&& cd sirius \
&& git clone https://github.com/jhauswald/sirius.git
RUN cd /opt/sirius/sirius/sirius-application \
&& tar xzf question-answer.tar.gz \
&& ./get-dependencies.sh \
&& ./get-opencv.sh
&& ./get-kaldi.sh
RUN ldconfig
# build sirius applications.
RUN cd /opt/sirius/sirius/sirius-application \
&& export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64/jre \
&& export JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF8 \
&& /bin/bash ./compile-sirius-servers.sh
# build image matching db.
RUN cd /opt/sirius/sirius/sirius-application/image-matching \
&& ./make-db.py landmarks matching/landmarks/db/ \
&& ./make-db.py buildings matching/buildings/db_big/ \
&& ./make-db.py buildings matching/buildings/db_small
# write setup script.
RUN echo "cd /tmp/shared && ./setup_wiki_indri_index.sh" >> ~/.bashrc
# apply patch.
RUN mkdir /opt/sirius/tmp
ADD start-qa-server.patch /opt/sirius/tmp/
RUN cd /opt/sirius/sirius/sirius-application/run-scripts \
&& patch -p0 start-qa-server.sh < /opt/sirius/tmp/start-qa-server.patch
CMD ["/bin/bash"]
#!/bin/sh
readonly WORKDIR=/vagrant/data
readonly ARCHIVE_FILE_BASENAME=wiki_indri_index
readonly DOWNLOAD_URL=http://web.eecs.umich.edu/~jahausw/download/wiki_indri_index.tar.gz
cd ${WORKDIR}
if [ ! -e ${ARCHIVE_FILE_BASENAME}.tar.gz ]; then
echo "download ${ARCHIVE_FILE_BASENAME}.tar.gz"
wget -q -O ${ARCHIVE_FILE_BASENAME}.tar.gz ${DOWNLOAD_URL}
else
echo "skip downloading ${ARCHIVE_FILE_BASENAME}.tar.gz"
fi
if [ ! -e ${ARCHIVE_FILE_BASENAME} ]; then
echo "extract ${ARCHIVE_FILE_BASENAME}.tar.gz"
tar xzf ${ARCHIVE_FILE_BASENAME}.tar.gz
else
echo "skip extracting ${ARCHIVE_FILE_BASENAME}.tar.gz"
fi
#!/bin/sh
# -*- coding: utf-8-unix -*-
readonly WORKDIR=/tmp/shared/data
readonly ARCHIVE_FILE_BASENAME=wiki_indri_index
cd /opt/sirius/sirius/sirius-application/question-answer
if [ ! -e ${ARCHIVE_FILE_BASENAME} ]; then
echo "generate symbolic link ${ARCHIVE_FILE_BASENAME}."
ln -s ${WORKDIR}/${ARCHIVE_FILE_BASENAME}/ ${ARCHIVE_FILE_BASENAME}
else
echo "skip generating symbolic link ${ARCHIVE_FILE_BASENAME}."
fi
diff --git a/sirius-application/run-scripts/start-qa-server.sh b/sirius-application/run-scripts/start-qa-server.sh
index 3bea960..cf3c70b 100755
--- a/sirius-application/run-scripts/start-qa-server.sh
+++ b/sirius-application/run-scripts/start-qa-server.sh
@@ -35,6 +35,9 @@ export CLASSPATH=bin:lib/ml/maxent.jar:lib/ml/minorthird.jar:lib/nlp/jwnl.jar:li
export INDRI_INDEX=`pwd`/wiki_indri_index/
export THREADS=$(cat /proc/cpuinfo | grep processor | wc -l)
+if [ ${THREADS} -lt 4 ]; then
+ export THREADS=4
+fi
java -Djava.library.path=lib/search/ -server -Xms1024m -Xmx2048m \
info.ephyra.OpenEphyraServer $ip $port
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure(2) do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
# https://docs.vagrantup.com.
# Every Vagrant development environment requires a box. You can search for
# boxes at https://atlas.hashicorp.com/search.
config.vm.box = "ubuntu/trusty64"
# Disable automatic box update checking. If you disable this, then
# boxes will only be checked for updates when the user runs
# `vagrant box outdated`. This is not recommended.
# config.vm.box_check_update = false
# Create a forwarded port mapping which allows access to a specific port
# within the machine from a port on the host machine. In the example below,
# accessing "localhost:8080" will access port 80 on the guest machine.
# config.vm.network "forwarded_port", guest: 80, host: 8080
# Create a private network, which allows host-only access to the machine
# using a specific IP.
# config.vm.network "private_network", ip: "192.168.33.10"
# Create a public network, which generally matched to bridged network.
# Bridged networks make the machine appear as another physical device on
# your network.
config.vm.network "public_network", ip: "192.168.0.16", netmask: "255.255.255.0"
config.vm.hostname = "sirius.carmesi"
# Share an additional folder to the guest VM. The first argument is
# the path on the host to the actual folder. The second argument is
# the path on the guest to mount the folder. And the optional third
# argument is a set of non-required options.
# config.vm.synced_folder "../data", "/vagrant_data"
# Provider-specific configuration so you can fine-tune various
# backing providers for Vagrant. These expose provider-specific options.
# Example for VirtualBox:
#
config.vm.provider "virtualbox" do |vb|
# Display the VirtualBox GUI when booting the machine
vb.gui = false
vb.name = "Sirius CI TestVM"
# Customize the amount of memory on the VM:
vb.memory = "2048"
vb.customize ["modifyvm", :id, "--ostype", "Ubuntu_64"]
end
config.vm.provision "shell", inline: <<-SHELL
cd /vagrant && ./download_wiki_indri_index.sh
SHELL
config.vm.provision "docker" do |d|
d.build_image "/vagrant/docker", args: "-t kyama/sirius-ci-test-image"
d.run "kyama/sirius-ci-test-image", args: "-d -t -v /vagrant:/tmp/shared -e JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64/jre -e JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF8"
end
# View the documentation for the provider you are using for more
# information on available options.
# Define a Vagrant Push strategy for pushing to Atlas. Other push strategies
# such as FTP and Heroku are also available. See the documentation at
# https://docs.vagrantup.com/v2/push/atlas.html for more information.
# config.push.define "atlas" do |push|
# push.app = "YOUR_ATLAS_USERNAME/YOUR_APPLICATION_NAME"
# end
# Enable provisioning with a shell script. Additional provisioners such as
# Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
# documentation for more information about their specific syntax and use.
# config.vm.provision "shell", inline: <<-SHELL
# sudo apt-get update
# sudo apt-get install -y apache2
# SHELL
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment