This project creates a virtual machine with LINDAT version of the Kontext (see [1]) web interface of Manatee (see [1]). A bare OS is downloaded, provisioned with basic software by puppet. Afterwards, Kontext and its requirements are installed by a shell script.
The contents of the projects
directory is shared between your OS and the guest VM created by this project.
In addition to the default vagrant use cases, this project simplifies remote debugging and contains a few additional software packages commonly used during debugging.
Prerequisites: Vagrant, virtualbox, (optional) PyCharm 4.+.
-
clone this project
git clone https://github.com/ufal/lindat-kontext-vagrant
-
get test kontext data
cd lindat-kontext-vagrant/projects/config/kontext && git clone https://github.com/ufal/lindat-kontext-ovm data
-
(optional) copy
pycharm-debug.egg
from Pycharm installation (see [2]) toprojects/debug/
-
create the VM by executing the following command from lindat-kontext-vagran directory
vagrant up
-
go to http://localhost:9999/ and test Kontext - there should be exactly one available corpora
-
(optional) login to the VM
vagrant ssh
-
(optional) configure remote debug server (see [2]) in PyCharm so that Kontext from the VM can connect to it. This means that you should be able to reach your OS from the created VM (see [3]). Finally, add the following python code (change host/port to match your setup) to the place where you would like to start debugging e.g., /opt/lindat/kontext/public/run.cgi
import pydevd pydevd.settrace( "192.168.2.4", port=11111, suspend=False, stdoutToServer=False, stderrToServer=False, trace_only_current_thread=True, overwrite_prev_trace=False)
and add the following to the end of the file otherwise the run.cgi
will not finish (see [4])
when invoked from apache and the output contents (http contents) will not get to the user.
python pydevd.stoptrace()
Note: You can change the location of the executed kontext script in order to directly work on the same sources.
Change /etc/apache/sites-enabled/000-default.conf
to point to /home/vagrant/projects/libs/current/kontext/public
.
The projects/libs/current
directory (on your OS) should be a copy of the /opt/lindat/
directory (on the created VM)
after execution of projects/setup.kontext.sh.
However, it will not help with cgi scripts executed by apache.
Vagrant uses Vagrantfile, which reads configuration from config/default.yaml, puppet prerequisites are installed by puppet-librarian using projects/Puppetfile, puppet uses projects/puppet-setup.pp to install basic software including phpmyadmin and munin which can help during debugging. Afterwards, munin is configured using projects/setup.munin.sh.
Finally, kontext is installed by projects/setup.kontext.sh.
Configuration files are in projects/config, web directory contents in projects/www.
[1] Kontext is a fork of Bonito 2.68 to the corpus management tool Manatee.
[2] See https://www.jetbrains.com/pycharm/help/remote-debugging.html
[3] Log in to the create VM and test connection to your OS using e.g., telnet (ping is not enough)
[4] Simply put, debugging threads are not correctly terminated.