Skip to content

Instantly share code, notes, and snippets.

@tpokorra
Last active December 19, 2015 13:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tpokorra/020015a7c72318c5c0f3 to your computer and use it in GitHub Desktop.
Save tpokorra/020015a7c72318c5c0f3 to your computer and use it in GitHub Desktop.
reinstall OpenPetra Server with Postgresql database on CentOS 5, 32 bit
#config
pwd=abcTODO
version=13.1
dir=downloadOpenPetra
mkdir -p $dir
rm -Rf %dir/*
cd $dir
#uninstall
service lighttpd stop
service openpetra-server stop
service postgresql-9.2 stop
killall mono
yum -y remove openpetra-server-postgresql postgresql92 postgresql92-server lighttpd lighttpd-fastcgi
rm -Rf /var/lib/pgsql/9.2
rm -Rf /usr/local/openpetraorg
rm -Rf /etc/lighttpd
rm -Rf /home/openpetra*
rm -Rf /var/www/html/*
#install
wget http://yum.postgresql.org/9.2/redhat/rhel-5-i386/pgdg-centos92-9.2-6.noarch.rpm
rpm -Uhv pgdg-*
wget http://download.opensuse.org/repositories/home:/tpokorra:/openpetra/CentOS_CentOS-5/home:tpokorra:openpetra.repo -O /etc/yum.repos.d/openpetra.repo
wget http://dl.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm
rpm -Uhv epel-release-5-4.noarch.rpm
if [ -z $version ]
then
yum install -y openpetra-server-postgresql
else
wget https://tpokorra:$pwd@api.opensuse.org/build/home:tpokorra:openpetra/CentOS_CentOS-5/i586/openpetra-server-postgresql/openpetra-server-postgresql-2013.4.1-$version.i386.rpm
yum install -y openpetra-server-postgresql-2013.4.1-$version.i386.rpm
fi
cd -
service openpetra-server init
# need to confirm with yes
service openpetra-server start
chkconfig openpetra-server on
# test: should show several users, at least DEMO and SYSADMIN
su - postgres -c "psql openpetra -c 'SELECT * FROM s_user'"
# test: can restart the server?
service openpetra-server restart
# test: http://localhost/openpetra9000/serverSessionManager.asmx
on build.solidcharity.com:
cd ~/git/openpetragit.remoting/
git status
# On branch feature2013_04_remoting
nant buildLinuxSourceforgeRelease -D:ReleaseID=2013.4.1
echo "put delivery/openpetraorg-*-MyOpenPetra-2013.4.1.tar.gz" | sftp pokorra@frs.sourceforge.net:/home/frs/project/openpetraorg/openpetraorg/openpetra.org_2013.04
# TODO: windows client
cd "~/osc/home:tpokorra:openpetra/openpetra-client"
# modify _service, add/remove empty line, to trigger new download
osc commit
cd "~/osc/home:tpokorra:openpetra/openpetra-server-postgresql"
# modify _service, add/remove empty line, to trigger new download
osc commit
// compile with: mcs /out:test.dll /target:library test.cs /r:System.Web.Services /r:System.Web.Extensions.dll /r:System.Web
// /var/www/html/test.asmx: <%@ WebService Language="C#" Class="PetraWebService.Test" %>
using System.Web;
using System.Web.Services;
using System.Web.Script.Services;
using System;
using System.Threading;
namespace PetraWebService
{
[WebService(Namespace = "http://www.openpetra.org/webservices/")]
[ScriptService]
public class Test : WebService
{
private string username;
private static string userstatic= string.Empty;
/// this method shows: only one appdomain, for all clients
/// one thread per client, but threads are being reused between all clients
/// static variables are shared
/// local variables are gone after the request
/// session variables are bound to the client
[WebMethod(EnableSession = true)]
public string HelloWorld(string AUserName)
{
if (AUserName.Length == 0 && Session["username"] != null)
{
AUserName = Session["username"].ToString();
}
Session["username"] = AUserName;
this.username = AUserName;
if (userstatic == string.Empty)
{
userstatic = AUserName;
}
try
{
Thread.CurrentThread.Name = AUserName + DateTime.Now.ToString();
}
catch (InvalidOperationException)
{
// can only set the name once
}
Thread.Sleep(AUserName.Length * 1000);
return Environment.NewLine +
"Hello " + AUserName + Environment.NewLine +
"class property: " + username + Environment.NewLine +
"static variable: " + userstatic + Environment.NewLine +
"Session Name: " + Session["username"].ToString() + Environment.NewLine +
"commandline: " + Environment.CommandLine + Environment.NewLine +
"username from env: " + Environment.UserName + Environment.NewLine +
"appdomain name: " + AppDomain.CurrentDomain.FriendlyName + Environment.NewLine +
"Thread name: " + Thread.CurrentThread.Name + Environment.NewLine +
"Waited seconds: (length of username)" + AUserName.Length.ToString();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment