Friday 26 July 2013

Moved to my own wordpress installation

This blog has now been moved with all history to my own Wordpress installation, at http://www.pokorra.de/blog/

This way I can include more plugins, for example for formatting source code.

Friday 12 July 2013

Notify all users logged in over X2Go on their graphical desktop

I am providing now a server for development of OpenPetra, with X2Go desktop remoting.
See more details at https://sourceforge.net/apps/mediawiki/openpetraorg/index.php?title=Hosted_development_workstation

To save costs, I am running the server on a jiffybox, which costs less when you freeze it.

So I am providing a php script that allows starting the machine, and to refresh it. After the last start or refresh, the machine will be stopped and frozen.

Now it would be good to remind the users once in an hour to do visit the refresh link.
I am using zenity to display the message.
This script will get all users logged in over X2Go, and display the message on their desktops:

message="Server will shutdown soon, please refresh if you still need it by visiting http://jb.solidcharity.com"
for display in `ps xaf | grep x2goagent | grep -v grep | awk '{ print ( $(NF) ) }'`
do
  user=`ps xaf | grep x2goagent | grep -v grep | grep "$display$" | awk ' { print ( $(NF-5) ) }' | awk ' { print ( $3 ) }' FS='/'`
  echo "$user $display"
  su - $user -c "zenity --info --display=$display --text='$message'&"

done
(for better layout, see https://gist.github.com/tpokorra/5984248#file-zenity-sh)

The crontab looks like this, to run it every hour:
0 */1 * * * /root/zenity.sh

The php script looks like this:

see https://gist.github.com/tpokorra/5984248#file-_jiffybox-php
The script is installed on a separate machine, that is always running.
The users can call jiffybox.php/?operation=refresh to start or refresh the machine.
The cronjob for stopping the machine looks like this:
*/15 * * * * cd ~/subs/jb; php jiffybox.php


Wednesday 29 May 2013

Install Kolab3 on Jiffybox

When running setup-kolab, after a timeout during the set up of the 389 Directory Server, see /var/log/kolab/setup.error.log:
Failed to create semaphore for stats file (/var/run/dirsrv/slapd-kolab.stats). Error 13.(Permission denied)
There was already a mounted tmpfs, but the directory /dev/shm was not writeable for user nobody.

So, before you run setup-kolab, you might want to run:
chmod a+rwx /dev/shm

Monday 27 February 2012

Ubuntu Oneiric and X2Go with LXDE for Remote Desktop

For OpenPetra, we want to provide a preconfigured Linux machine, so that interested developers can have a quick start, and don't need to spend so much time on installing a development environment.

I looked at FreeNX, NeatX, OpenNX, and X2Go.
NeatX does not seem to be continued.

FreeNX with OpenNX works, but I had problems with the sound.
To install FreeNX on Ubuntu Oneiric, follow the instructions at Ubuntu Forums. This avoids the problem with esound and libesd0 packages.


Finally, I have to say that X2Go works best for me. Sound is played, and access from Windows and Linux works fine to my Linux Remote Desktop.


To install the X2Go server on Ubuntu Oneiric:

 apt-add-repository ppa:x2go/stable
 add universe to /etc/apt/sources.list
 apt-get update
 apt-get install x2goserver


You get the client from http://code.x2go.org/releases/binary-win32/x2goclient/


One thing I had problems with: there was a blank or black screen, after logging in.
To debug this: I searched the log files, but could not find any clues. Then I remembered this: use the terminal as login shell, which works. There you can start your desktop manager, in my case /usr/bin/startlxde.
The error that came up was: missing libNX_Xext.so.6
I then found on the mailing list a discussion: http://www.mail-archive.com/x2go-dev@lists.berlios.de/msg03254.html
So I added the line 

 LD_LIBRARY_PATH=/usr/lib/nx/X11



at the top of /usr/bin/startlxde, and everything works now.


I also installed libjpeg-turbo, which should make the remote desktop even faster:

wget 'http://sourceforge.net/projects/libjpeg-turbo/files/1.2.0/libjpeg-turbo_1.2.0_i386.deb/download' -O libjpeg-turbo_1.2.0_i386.deb
dpkg -i ...
rm /usr/lib/i386-linux-gnu/libjpeg.so.62
ln -s /opt/libjpeg-turbo/lib/libjpeg.so.62.0.0 /usr/lib/i386-linux-gnu/libjpeg.so.62



One useful key combination is ctrl alt t, which allows you to terminate or to suspend the current session.
It seems ctrl alt k does not work with X2Go, which would allow the task switching with Alt Tab to be inside the Linux workstation.
The shortcuts available from NoMachine are listed here: http://www.nomachine.com/ar/view.php?ar_id=AR03C00172


By the way, I got X2Go work fine on virtual machines running on VMWare ESXi, and also on OpenVZ.

Friday 3 February 2012

Ext.Net 1.2 and Mono 2.10 on Ubuntu Oneiric

We have upgraded all the code of OpenPetra to .net 4.0.
We also upgraded to Ext.Net 1.2.

There were two bugs in Mono 2.10, which were show-stoppers:
http://bugzilla.xamarin.com/show_bug.cgi?id=2505 was a problem with the mono compiler, in Mono 2.10.x
This was fixed in mono master.

So I tried to build mono from master, but then I had problems with fastcgi, while xsp4 was serving the content correctly:
http://bugzilla.xamarin.com/show_bug.cgi?id=2876
This was also fixed in mono master.

Below is a link to a tar.gz file, that contains the build of Mono, with mod_mono and xsp, at the beginning of February 2012.

I wanted to use lighttpd and fastcgi with Mono and Ext.Net, but that did not work.
The error that I got was similar as to described here, but without a solution that works for me:
http://forums.ext.net/showthread.php?14040-All-DirectEvents-Is-Error
It works fine with xsp4.

I then tried with mod_mono and apache2:
I came across this issue http://forums.ext.net/showthread.php?12348-404-Not-Found-for-a-few-resources-requests, that the resources cannot be loaded. The solution from that thread also helped me:
Add CleanResourceUrl = "false" to your .aspx file:
<ext:ResourceManager  runat="server" CleanResourceUrl="false" />

So here are my configuration steps for Ext.Net with Mono and Apache2:

This works with Ubuntu Oneiric 64 bit (11.04). But it might work on other Ubuntu/Debian version as well. I have also used it on CentOS.

apt-get install apache2
cd /opt
wget http://download.pokorra.de/mono/ubuntu/mono.tar.gz
for 32 bit: wget http://download.pokorra.de/mono/ubuntu32/mono.tar.gz
tar xzf mono.tar.gz
cd /usr/lib/apache2/modules/
wget http://download.pokorra.de/mono/ubuntu/mod_mono.so
for 32 bit: wget http://download.pokorra.de/mono/ubuntu32/mod_mono.so
cd /etc/apache2/mods-enabled
wget http://download.pokorra.de/mono/ubuntu/mod_mono.conf
# note that mod_mono.conf contains this line:
# MonoServerPath /opt/mono-2.10-git/bin/mod-mono-server4
vi /etc/init.d/apache2
# search for LANG, and replace with this line:
ENV="env -i LANG=en_GB PATH=/opt/mono-2.10-git/bin:/usr/local/bin:/usr/bin:/bin"
Mono will create a directory /var/www/.mono which should not be public.
In your apache site configuration file, add just before  <Directory /var/www/>
<directorymatch \.mono>

           Deny from all
</directorymatch>
cd /var/www
wget http://download.pokorra.de/mono/ubuntu/extnet-sample-mono.tar.gz
tar xzf extnet-sample-mono.tar.gz
chown -R www-data:www-data /var/www
/etc/init.d/apache2 restart

See the result here:
http://demo.openpetra.org/DemoDesktop

This is the demo for the Desktop from Ext.Net 1.2, with a slight modification in Default.aspx and Desktop.aspx for the ResourceManager as described above.

Friday 11 November 2011

Windows Installer for NAnt

In the OpenPetra project, we completely depend on NAnt, which works out very well for us.
But we have had now several problems with permissions for executing nant on Windows, from the Program Files directory. Also the creation of the nant.bat was not trivial, and could cause problems with permissions.

The easy solution was to create a small InnoSetup Installer.
You can download it from our files section at SourceForge: http://sourceforge.net/projects/openpetraorg/files/openpetraorg/Tools/NAnt-Setup-0.91.exe/download

The script file for InnoSetup looks like this:

[Setup]
AppName=NAnt
AppVerName=NAnt 0.91
DefaultDirName={pf}\NAnt
DefaultGroupName=NAnt
LicenseFile=nant-0.91\COPYING.txt
OutputBaseFilename=NAnt-Setup-0.91
[Files]
Source: nant-0.91\*.*; DestDir: {app}; Flags: recursesubdirs createallsubdirs
[Code]
procedure CurStepChanged(CurStep: TSetupStep);
begin
  if CurStep=ssPostInstall then
  begin
    SaveStringToFile(ExpandConstant('{win}/nant.bat'), ExpandConstant('@"{app}\bin\NAnt.exe" %*'), False);
  end;
end;
If you have trouble with your old NAnt installation, you should delete the folder first from the Program Files, before you run the installer!

Thursday 29 September 2011

Use Case OpenPetra for TeenStreet 2011


Intro

For TeenStreet 2011 in Germany, we have extended and used OpenPetra.
TeenStreet (http://www.teenstreet.om.org/) is an International Christian Teenager Event that happens all over the world.
Teenagers, group leaders (aka coaches) and service crew from about 18 European countries, and even further abroad, register for the TeenStreet conference in Germany. The registration is processed through the home office of each country. The home office is responsible for payment and accepting or denying registrations.
The organising office does all the logistics for the conference, eg. printing the badges.
The software ran fine on a Debian Linux on a virtual server. We have had about 3600 applications altogether.

Development

Functionality

The functionality can be separated into the part that was seen by the participants, and the part that was used by the registration offices and the organising office.

Registration

  • There is a base yaml file with general data, eg. photo upload
  • A javascript file contains all the texts, and should be translated by the home office.
  • There are several roles, eg. Teenagers, Coaches, Service people. The questions and fields to fill in are different for each role.
  • The home office can request customizations for the yaml file, which is derived from the base yaml file.
  • An Email is sent to the home office and the applicant, when the registration is submitted. A PDF file is generated and provided as a download and as an attachment to that email.
    • the email and the pdf are based on HTML templates. The PDF can also embed other PDF files, which is helpful for more detailed questionnaires for the adults.
  • The applicant has to print the PDF, sign the paper, teenagers have to let the parents sign as well.
    • If payment is done by direct debit, there is an additional signature for that on the paper as well.
    • the paper is sent as a normal letter to the home office

Backend

  • The home office receives the letter, searches for the applicant, and reviews the application. If the applicant is accepted, the state of the application is changed from "On Hold" to "Accepted". The acceptance date is recorded.
  • If an applicant is cancelled and the application status is set to cancelled, the cancellation date will be recorded.
  • Early applicants will receive a free T-Shirt. There is a special report that tells how many T-Shirts and sizes need to be ordered.
  • Badges can be printed for all applicants, with different layout, defined in HTML, for each role. Photos for the applicants and bar codes can be printed.
    • Lost Badges can be reprinted on demand.
  • Export all data of participants to an Excel file to process the data further.
  • Print reports for medical needs, vegetarians for the kitchen.
  • Print a report to know how many people are on site on each day.
  • Print a report for the children and families on the site, for their special programme.
  • Print reports for the home offices. They tick off who has actually arrived.
  • Print reports for the service crew, or other teams, to know who is supposed to be on their team.
  • Rebukes: allow the "Boundaries Team" to make notes for applicants who violate the rules on site, and print reports for the coaches or home office representatives
  • Medical team: the medical people can see the relevant information and emergency contact information of the participants, and store information about diagnosis and therapy.
  • Import applications from Petra 2.x for offices that did not take part in the online registration.
  • Late and manual registrations have also been processed through the backend.
  • Export applicants into the local Petra 2.x for the home offices.
  • Export gift batches for Petra 2.x to easily process the application and registration fee. This has only been used by the German office this year.
  • Print reports for the organising finance office, to charge the home offices for the participants that come from their country. Consider siblings, and early/late/accepted cancellations. Order participants by role.
  • User management is currently not done in the web interface, but through the OpenPetra fat client. Everything else runs in a web interface.
  • User rights can be limited for the home office representatives to the applicants for their country. The medical team and the boundaries team and the finance office get special permissions.

possible improvements

  • For next year, the applicants should be able to retrieve and update the information they have entered last year
  • Allow applicants to login later again, and register for workshops and seminars
  • Provide a list of all people that are currently on site. Need to record the actual arrival date.
  • Group assignments for the fellowship groups need to be semi automated.
  • The administration of users should be available in the web interface as well.
  • When creating the gift batch file, also create a DTAUS file at the same time.
  • head set distribution for the translation, scan the badges, home offices can get a report to see who has used a headset. check which headsets were not returned after the session.
  • upgrade ext.net and ext.js to the latest version, so that IE 9 can be fully supported