== The Sensei Virtual Machine == The Sensei Virtual Machine is a host that provides all basic functionalities of the Sensei Framework. The VM comes in two flavors: '''Xen VM''' and '''VMWare VM'''. [[PageOutline(2-3,Table of Contents,inline)]] === Where to get it === * You can download the Sensei Virtual Machine from http://storage.grid.pub.ro/Sensei/v2/ (very large, provided as chunked RARs) * This Virtual Machine is in VMWare format. You can use VM Player to run this virtual machine. * The hostname configured for this VM is '''sensei-demo.grid.pub.ro''', all services configured on this machine assume this hostname. Because SSL certificates depend on the servers hostname, changing the hostname of the VM will impact all SSL applications like AAA and Billing. You must generate and install new a host certificate because all SSL use trusted links. Use this [[SpVirtualMachine#SSLCertificates| link]] to find out how. * In case you do not wish to change the hostname, please configure its new ip in ''/etc/hosts'' on both the VM and you client. If you are using Windows, this file is located in ''C:\Windows\System32\drivers\etc\hosts''. Example: {{{ # Copyright (c) 1993-2009 Microsoft Corp. # # This is a sample HOSTS file used by Microsoft TCP/IP for Windows. 192.168.0.100 sensei-demo.grid.pub.ro }}} * after you boot up, all services should run automatically. === Environment Setup === This is the list of the main components and their configuration ==== Resource Directory ==== Install Directory: ''/opt/sensei/RDv2''[[BR]] Requires: ''mysql daemon started, database sensei_rd2''[[BR]] Database configuration file: ''/opt/sensei/RDv2/build/database/ConnectionPool.properties''[[BR]] !HowTo Run: [[BR]] * you can use the service startup script like this: {{{ #!sh [root@sensei-dev1 RDv2]# pwd /opt/sensei/RDv2 [root@sensei-dev1 RDv2]# ./sensei-rd-2.sh start [root@sensei-dev1 RDv2]# }}} * or you can startup manually like {{{ #!sh nohup java -Xms32m -Xmx384m -classpath .:build:lib/commons-cli-1.2.jar:lib/com.springsource.org.apache.commons.logging-1.1.1.jar:lib/com.springsource.slf4j.api-1.5.10.jar:lib/com.springsource.slf4j.jcl-1.5.10.jar:lib/mysql-connector-java-5.1.7-bin.jar:lib/org.restlet.jar:lib/SenseiFederationBroker-api-1.0-SNAPSHOT.jar:lib/slf4j-api-1.5.10.jar:lib/standalone-1.2.0-SNAPSHOT-jar-with-dependencies.jar restlet_server.RESTLET_Server -host 141.85.224.221 & }}} * Check the service: {{{ #!sh [root@sensei-dev1 RDv2]# netstat -anp | grep :8184 tcp 0 0 :::8184 :::* LISTEN 29572/java }}} ==== Advanced Resource Description Repository ==== Install Directory: ''/opt/sensei/RESTArdRepov2''[[BR]] Requires: ''sedna database arddb started''[[BR]] Database configuration file: ''-''[[BR]] !HowTo Run: [[BR]] {{{ #!sh [root@sensei-dev1 RESTArdRepov2]# cd /opt/sedna/bin/ [root@sensei-dev1 bin]# ./se_gov GOVERNOR has been started in the background mode [root@sensei-dev1 bin]# ./se_sm arddb Starting database recovery or hot-backup restoration... Database recovery in progress... SM has been started in the background mode [root@sensei-dev1 bin]# cd /opt/sensei/RESTArdRepov2 [root@sensei-dev1 RESTArdRepov2]# nohup ant runARDRepoServer & }}} * Check the service: {{{ #!sh [root@sensei-dev1 RESTArdRepov2]# netstat -anp | grep :8185 tcp 0 0 :::8185 :::* LISTEN 29971/java }}} ==== Entity Directory ==== Install Directory: ''/opt/sensei/RESTEoiRepov3''[[BR]] Requires: ''sedna database eoidb started''[[BR]] Configuration file: ''EOI.properties''[[BR]] !HowTo Run: [[BR]] {{{ #!sh [root@sensei-dev1 RESTArdRepov2]# cd /opt/sedna/bin/ [root@sensei-dev1 bin]# ./se_gov GOVERNOR has been started in the background mode [root@sensei-dev1 bin]# ./se_sm eoidb Starting database recovery or hot-backup restoration... Database recovery in progress... SM has been started in the background mode [root@sensei-dev1 bin]# cd /opt/sensei/RESTEoiRepov3 [root@sensei-dev1 RESTEoiRepov3]# nohup java -jar RestEoiv3.jar }}} * Check the service: {{{ #!sh [root@sensei-dev1 RESTEoiRepov3]# netstat -anp | grep :8182 tcp 0 0 :::8182 :::* LISTEN 30133/java }}} ==== SQR Directory ==== Install Directory: ''/opt/sensei/SQRv2''[[BR]] Requires: ''-''[[BR]] Configuration file: ''SQR.properties''[[BR]] !HowTo Run: [[BR]] {{{ #!sh [root@sensei-dev1 SQRv2]# nohup ant runSQRv2Server & }}} * Check the service: {{{ #!sh [root@sensei-dev1 SQRv2]# netstat -anp | grep :8186 tcp 0 0 :::8186 :::* LISTEN 30404/java }}} ==== Others (AAA & Billing+Privacy) ==== They are web-applications. You must only start the application server. All databases are in-memory.[[BR]] Install Directory: ''/opt/apache-tomcat-6.0.20/webapps''[[BR]] !HowTo Run: [[BR]] {{{ #!sh [root@sensei-dev1 webapps]# cd /opt/apache-tomcat-6.0.20/bin/ [root@sensei-dev1 bin]# ./startup.sh Using CATALINA_BASE: /opt/apache-tomcat-6.0.20 Using CATALINA_HOME: /opt/apache-tomcat-6.0.20 Using CATALINA_TMPDIR: /opt/apache-tomcat-6.0.20/temp Using JRE_HOME: /usr [root@sensei-dev1 bin]# }}} * Check the service: {{{ #!sh [root@sensei-dev1 bin]# netstat -anp | grep :8080 tcp 0 0 :::8080 :::* LISTEN 2238/java [root@sensei-dev1 bin]# netstat -anp | grep :8443 tcp 0 0 :::8443 :::* LISTEN 2238/java [root@sensei-dev1 bin]# }}} === Networking Setup === This information is needed usually for debugging and tracking purposes. - Dns nameserver: 141.85.241.15 [[BR]] - IPv4 gateway: 141.85.224.1 (for the 141.85.224.0/24 range) [[BR]], 141.85.241.1 (for the 141.85.224.0/24 range) [[BR]] - IPv6 gateway: 141.85.224.33 (2001:5c0:1502:5300::1/64) {{{ #!sh [root@star bin]# ping6 ipv6.google.com PING ipv6.google.com(2a00:1450:8007::68) 56 data bytes 64 bytes from 2a00:1450:8007::68: icmp_seq=0 ttl=55 time=59.5 ms 64 bytes from 2a00:1450:8007::68: icmp_seq=2 ttl=55 time=59.9 ms 64 bytes from 2a00:1450:8007::68: icmp_seq=3 ttl=55 time=58.5 ms }}} == Third party components == This section is "good to know" for debugging services and configurations on the Sensei VM. The usual requirements for hosting our services are: - a linux machine (we use RHEL-flavored operating systems, but any system should do) - Sun Java JDK 6.0 - Apache Tomcat v.6.0.20 - Mysql 5 - IPv6 - SSL Certificates for AAA and Privacy & Billing IPv6 is needed for communicating with the nodes. For this, you can use a native IPv6 network or IPv6-over-IPv4 tunnels. The current Sensei network uses !GoGo6 (http://www.gogo6.com/) for Ipv6 tunneling. === Sun Java 6.0 JDK and Apache Ant === You can download the sdk from http://java.sun.com (direct link: http://www.oracle.com/technetwork/java/javase/downloads/index.html). Due to the fact that we'll be using java from the command line you should also set the necesarry environment variables JAVA_HOME and JDK_HOME. It is advisable to use the bin version of the archive and install it in /opt/java for example. Download java to /opt/java, make the file executable (chmod +x filename) and run it. In our example, java will be installed in ''/opt/java/jdk1.6.0_20''. Other locations possible to find the java instalation would be ''/usr/java'', ''/usr/lib/jvm'' (depending of the OS flavor). Put Java in the Environment Path by adding the following file to ''/etc/profile.d'': (filename ex: java.sh) {{{ export JAVA_HOME=/opt/java/jdk1.6.0_20 export JDK_HOME=/opt/java/jdk1.6.0_20 export ANT_HOME=/opt/apache-ant-1.8.1 export PATH=/opt/java/jdk1.6.0_20/bin:/opt/apache-ant-1.8.1/bin:$PATH }}} Several components might use compiling. If you do not have access to a GUI, then you can use Apache Ant (http://ant.apache.org/). Just download it and install it in ''/opt/apache-ant-1.8.1''. === Apache Tomcat & Mysql === You can use any application server you like. The one we used was Apache Tomcat 6.0.20. Just download it and unpack it in ''/opt/apache-tomcat-6.0.20''. For ease of development, we recommend using the tar.bz2 version for apache tomcat and the operating system provided mysql. To install mysql on a RHEL-flavored machine and configure it to run at startup: {{{ yum -y install mysql mysql-server chkconfig mysqld on }}} === IPv6 Connectivity === You may get IPv6 addresses from your ISP or you can tunnel IPv6 over an IPv4 network. If you want to use the setup for local development (nodes included) and do not need internet access through Ipv6, you can use '''radvd''', a linux IPv6 Router Daemon advertiser. For the address space, just go to http://www.simpledns.com/private-ipv6.aspx and get your own random private ipv6 address space. Theese networks will not get routed in the internet and you can use them locally. For Gogo6 you must go to http://www.gogo6.com/ and create yourself an account. (there is a the posbility of anonymous use also). You must download the FreeNet 6 client and run it. The client is named '''gw6c''' and we install it in ''/opt/gw6c''. The is a sample configuration file you must edit, gw6c.conf. The most important settings are: {{{ # userid= passwd= #server=anonymous.freenet6.net server=authenticated.freenet6.net # host_type= # host_type=router }}} To run it, run ''gw6c'' and it will daemonize by itself. To test your ipv6 setup just {{{ ping6 ipv6.google.com }}} If you need a static address, just configure it from ''/etc/sysconfig/network'' {{{ NETWORKING=yes NETWORKING_IPV6=yes HOSTNAME=sensei-dev1.grid.pub.ro }}} and ''/etc/sysconfig/network-scripts/ifcfg-eth0'' {{{ # Broadcom Corporation NetXtreme BCM5721 Gigabit Ethernet PCI Express DEVICE=eth0 BOOTPROTO=none HWADDR=00:14:5E:30:9A:40 IPADDR=141.85.224.33 NETMASK=255.255.255.0 NETWORK=141.85.224.0 ONBOOT=yes GATEWAY=141.85.224.1 TYPE=Ethernet IPV6INIT=yes #IPV6ADDR=2607:f0d0:1002:0011:0000:0000:0000:0001 #IPV6_DEFAULTGW=2607:f0d0:1002:0011:0000:0000:0000:0001 }}} === SSL Certificates === This is the most important step for security services. Not only you got to have an ssl certificate, it must be '''trusted''' by all partners. You can get free SSL certificates at StartSSL for free, but for development you might consider to generate on youself. We will not cover this section here, you can use for example the CA.pl perl script in the openssl-perl package to create yourself a Cerificate Authority that will sign you cert, or you can use openssl directly. The important step is to tell tomcat an java about the certificates. To configure Tomcat you must follow these steps: http://tomcat.apache.org/tomcat-6.0-doc/ssl-howto.html The tricky bit is getting Java JRE to trust this certificate. The easyest way is to use this Java program. [to add link and howto] == Compiling Sensei Services using a CLI (Command Line Interface) == In case you need to compile the services you can use ant. Each project has a *.properties file for customizations. To build a service: {{{ ant build }}} To run a service. Just check the build target and run it: {{{ [root@sensei-dev1 SQRv2]# ant -p Buildfile: build.xml Sensei SQRv2 Main targets: TestSQRLookup Run ARD Server all Clean build and dist, then compile build Build everything clean Delete old build and dist directories dist Dependency jar runSQRv2Server Run ARD Server Default target: build [root@sensei-dev1 SQRv2]# ant runSQRv2Server }}} In case you need as a daemon (close the terminal session and still have the service running, just use nohup. {{{ [root@sensei-dev1 SQRv2]# nohup ant runSQRv2Server & }}} This will create a nohup.out file with all the output. == Running Sensei Services in the CLI == For running a service, you can use ant and nohup (in case you have source code access), or java directly {{{ nohup java -jar RestEoiv3.jar & }}} To check the service is running, look at the output file and/or check that the serivice is running on the specified port. {{{ [root@sensei-dev1 RESTEoiRepov3]# netstat -anp | grep java | grep LISTEN tcp 0 0 :::9000 :::* LISTEN 2669/java tcp 0 0 :::42896 :::* LISTEN 2669/java }}} We have two services running on ports 9000 and 42896.