Install apache and fastcgi with apt-get:
sudo apt-get install apache2 libapache2-mod-fastcgi
Here is a sample Apache2 virtual host below to handle the MOLTO TT back end services from port 8888 (the default). The back end server is supposed to be in the same domain as the editor to avoid cross-domain scripting violations. Copy the text below to /etc/apache2/sites-available/default
<VirtualHost *:8888> ServerAdmin webmaster@localhost DocumentRoot /var/www AddDefaultCharset UTF-8 <Directory /> Options FollowSymLinks AllowOverride None </Directory> <Directory /var/www/> Options Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny allow from all </Directory> # Allow fastcgi services from fcgi-bin. <Directory "/var/www/fcgi-bin/"> Options +ExecCGI AddDefaultCharset UTF-8 SetHandler fastcgi-script </Directory> # Identify pgf-service as a fastcgi server FastCgiServer /var/www/fcgi-bin/pgf-service # Identify content-service as a fastcgi server FastCgiServer /var/www/fcgi-bin/content-service # Make action pgf-service handle pgf files Action pgf-service /fcgi-bin/pgf-service AddHandler pgf-service .pgf AddCharset UTF-8 .pgf </VirtualHost>
After you have copied the above to /etc/apache2/sites-available/default
, activate the changes:
sudo a2enmod fastcgi sudo a2enmod actions
Finally, restart apache by typing sudo service apache2 restart
.
sudo chown -R root:www-data /var/www/
(the name of the group might vary, you can see yours by seeing which group has /var/www; do grep "/var/www" /etc/passwd
).Get the latest sources for GF from darcs repository. The instructions are here: http://www.grammaticalframework.org/download/index.html
Assuming you have the source files, go to src/server
and type sudo cabal install -f content --global
. It is important to use the option --global
, because by default they are installed in the home directory, and that doesn't go well with Apache. The binaries will be installed in /usr/local/bin
. Because of Apache, you need to set their owner group to the apache group (depending on machine, e.g. www-data
or apache
).
The next step is to link the binaries to /var/www/fcgi-bin
.
/var/www$ sudo ln -s /usr/local/bin/content-service fcgi-bin/ /var/www$ sudo ln -s /usr/local/bin/pgf-service fcgi-bin/
gf-server-1.0 depends on fastcgi-3001.0.2.3 which failed to install.
sudo apt-get install libfcgi-dev
), then try again to install PGF service and content service: sudo cabal install -f content --global
This applies only if you want to use the editor from Eclipse. Otherwise you don't need any of this.
To test the TT editor under eclipse using GWT devMode, we found it necessary to recompile content-service to add the gwt code server port parameter to page URLs. To do so activate the following lines in ContentService.hs . We have been using eclipse 3.6 JEE with Google Web Toolkit version 2.3.1.
-- devModeScriptName = (liftM2 (++)) (getVarWithDefault "SCRIPT_NAME" "") (return "?gwt.codesvr=127.0.0.1:9997") -- path <- devModeScriptName
A corresponding change is neeeded in the client code. Activate the following line in TT-0.9/src/org/grammaticalframework/ui/gwt/client/SettingsPanel.java
// String defaultUrl = "/fcgi-bin/content-service?gwt.codesvr=127.0.0.1:9997";
Launch settings for building and testing under devMode under eclipse (in $HOME/workspace/.metadata/.plugins/org.eclipse.debug.core/.launches
):
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <launchConfiguration type="com.google.gdt.eclipse.suite.webapp"> <booleanAttribute key="com.google.gdt.eclipse.core.RUN_SERVER" value="false"/> <stringAttribute key="com.google.gdt.eclipse.core.SERVER_PORT" value="80"/> <stringAttribute key="com.google.gdt.eclipse.suiteMainTypeProcessor. PREVIOUSLY_SET_MAIN_TYPE_NAME" value="com.google.gwt.dev.DevMode"/> <booleanAttribute key="com.google.gdt.eclipse. suiteWarArgumentProcessor.IS_WAR_FROM_PROJECT_PROPERTIES" value="true"/> <listAttribute key="com.google.gwt.eclipse.core.ENTRY_POINT_MODULES"> <listEntry value="org.grammaticalframework.ui.gwt.EditorApp"/> </listAttribute> <stringAttribute key="com.google.gwt.eclipse.core.URL" value="editor"/> <listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS"> <listEntry value="/TT-0.9-ORIGINAL"/> </listAttribute> <listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES"> <listEntry value="4"/> </listAttribute> <stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="com.google.gwt.eclipse.core.moduleClasspathProvider"/> <stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.google.gwt.dev.DevMode"/> <stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-startupUrl editor -war $HOME/workspace/TT-0.9/www/editor \ -noserver -remoteUI "${gwt_remote_ui_server_port}:${unique_id}" \ -logLevel INFO -codeServerPort 9997 \ org.grammaticalframework.ui.gwt.EditorApp"/> <stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="TT-0.9"/> <stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xmx512m"/> </launchConfiguration>
First you need to install HSQL. It's in hackage, so it can be installed by typing sudo cabal install hsql --global
.
The public version of the Haskell MySQL package hsql-mysql-1.8.1
used by the TT content service appears to have a bug that prevents multiple successive mysql procedure calls. A debugged version of the package can be found at http://tfs.cc/molto/hsql-mysql-1.8.1-molto.zip
.
Install the debugged version:
hsql-mysql-1.8.1-molto.zip
hsql-mysql.cabal
sudo cabal install --global
sudo cabal install hsql-1.8.1 --global
or downloading the version from hackage. In addition to the above, you need a mysql server. You can install one by typing sudo apt-get install mysql-server
.
Content-service uses a mysql database to store users, grammars and documents.
To create the database connection you need to do the following steps:
host db user pwd
in format known to haskell readFile.content-service fpath
Now create the database:
$ mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. ... mysql> CREATE DATABASE moltodb; CREATE USER moltouser IDENTIFIED BY 'moltopass'; GRANT ALL on moltodb.* to moltouser; Query OK, 1 row affected (0.02 sec) mysql> Query OK, 0 rows affected (0.00 sec) mysql> Query OK, 0 rows affected (0.00 sec) mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | moltodb | +--------------------+ 2 rows in set (0.00 sec) mysql> quit Bye
Next, create the database files.
/usr/local/bin$ ./content-service fpath
And then log in to mysql with the user moltouser.
mysql -u moltouser -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. mysql> use moltodb; Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Database changed mysql> show tables; +-------------------+ | Tables_in_moltodb | +-------------------+ | Documents | | GrammarUsers | | Grammars | | Users | +-------------------+ 4 rows in set (0.00 sec)
If so the tables got created ok.
There is nothing yet in the tables. After you first sign in with your google account, then your user account will be in the table Users. You can query any of the tables by writing select * from <table>
.
To install the tabular equivalents editor source, do this:
https://svn.it.helsinki.fi/repos/molto/trunk/molto_term_editor/
and put it in any place where the apache server can reach, i.e. /var/www/
.
http://extjs.cachefly.net/ext-4.0.2a-gpl.zip
, and uncompress it as extjs-4.0.3
under the directory molto_term_editor/
.
http://localhost/molto_term_editor/editor_sparql.html
, if you put the source code under /var/www/
.
The GlobalSight installation values are kept in $HOME/workspace/GS-8.2.2.1/main6/tools/build/dist/GlobalSight/install/data/installValues.properties
. The following shows settings used for a MOLTO GlobalSight eclipse installation (with $HOME replacing the installation directory and PASSWORD the password/s) :
#Mon May 28 22:52:03 EEST 2012 mailserver=mail.domain.com system_log_directory_forwardslash=$HOME/workspace/GS-8.2.2.1/main6/tools/build/dist/GlobalSight/logs install_data_dir_forwardslash=$HOME/workspace/GS-8.2.2.1/main6/tools/build/dist/GlobalSight/install/data server_host=localhost database_password=PASSWORD database_server=localhost database_username=globalsight ldap_password=PASSWORD ldap_install_dir=/var/lib/ldap server_port=9090 ldap_host=localhost gs_home=$HOME/workspace/GS-8.2.2.1/main6/tools/build/dist/GlobalSight ldap_username=ldap_connection admin_email=WelocalizeAdmin@domain.com system4_admin_username=gsAdmin ldap_base=globalsight.com ldap_port=389 GS_HOME=$HOME/workspace/GS-8.2.2.1/main6/tools/build/dist/GlobalSight cap_login_url=http\://127.0.1.1\:9090/globalsight