Difference between revisions of "Remote Experiment Controller"

From wwwelab
Jump to navigation Jump to search
 
(24 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
= Pre-requisites =
 
= Pre-requisites =
 
  
 
== Build environment ==
 
== Build environment ==
  
* Maven 3.6.3
+
* Git (2.30.2+)
 +
* Ant (1.10.9+)
 +
* Maven (3.6.3+)
 
* OpenJDK 11 (11.0.8+)
 
* OpenJDK 11 (11.0.8+)
 
* Docker (20.10+)
 
* Docker (20.10+)
Line 18: Line 19:
 
* OpenJDK 11 (11.0.8+)
 
* OpenJDK 11 (11.0.8+)
  
== rec.web (recommended only for testing locally)==
+
= Preparation steps =
 +
 
 +
Setup JAVA_HOME environment variable pointing to a valid openjdk11 installation:
 +
 
 +
    $ export JAVA_HOME=/path/to/openjdk11
  
* Docker (20.10+)
+
Setup ~/.m2/toolchains.xml pointing to a valid openjdk11 installation:
* docker-compose (1.25.4+)
 
  
= Preparation steps =
+
    <toolchains>
 +
        <toolchain>
 +
            <type>jdk</type>
 +
                <provides>
 +
                    <vendor>openjdk</vendor>
 +
                    <version>11</version>
 +
                </provides>
 +
            <configuration>
 +
                <jdkHome>/path/to/openjdk/jdk11.0.8</jdkHome>
 +
            </configuration>
 +
        </toolchain>
 +
    </toolchains>
  
 
First checkout the project from github:
 
First checkout the project from github:
Line 63: Line 78:
 
* '''deployment.subdir''': Sub directory where Multicast Controller is going to be installed (default: /rec-deployment)
 
* '''deployment.subdir''': Sub directory where Multicast Controller is going to be installed (default: /rec-deployment)
  
'''docker-compose-pendulum.yml''':
+
'''deployment/compose/src/main/docker/docker-compose-pendulum.yml''':
  
 
* '''WEBSWING_PUBLIC_URL''': URL where webswing is accessible (e.g. https://elab-dev.vps.tecnico.ulisboa.pt/)
 
* '''WEBSWING_PUBLIC_URL''': URL where webswing is accessible (e.g. https://elab-dev.vps.tecnico.ulisboa.pt/)
  
Package
+
'''experiments/{experiment}/etc/build.properties'''
     $ mvn clean package -Dmaven.test.skip=true -Djarsigner.alias="REC" -Dbuild.environment=pendulum -Dpack.docker.images
+
 
 +
* '''experiment.driver.device''': Serial port device (e.g. /dev/ttyS0)
 +
 
 +
Package everything:
 +
     $ mvn clean package -Dmaven.test.skip=true -Djarsigner.alias="REC" -Dbuild.environment=pendulum -Dpack.docker.images -Dpublic.repo=docker.io
 +
 
 +
Copy resulting packages to destination servers:
 +
 
 +
* Multicast Server
 +
    $ scp deployment/images/target/reverse-proxy.tar multicast-server-name:/tmp/
 +
    $ scp deployment/images/target/multicast.tar multicast-server-name:/tmp/
 +
    $ scp deployment/images/target/webswing-admin.tar multicast-server-name:/tmp/
 +
    $ scp deployment/images/target/webswing.tar multicast-server-name:/tmp/
 +
    $ scp deployment/compose/target/docker-compose-runner.yml multicast-server-name:/tmp/docker-compose.yml
  
Copy to destination servers:
+
* Hardware Server
    $ scp deployment/images/target/*.tar multicast-server-name:/tmp/
 
    $ scp deployment/compose/target/docker-compose-{pendulum,template}.yml multicast-server-name:/tmp/
 
 
     $ scp dist/java/*HardwareServer*.zip hardware-server-name:/tmp/
 
     $ scp dist/java/*HardwareServer*.zip hardware-server-name:/tmp/
  
 
= Install =
 
= Install =
  
== ReC, Webswing and Multicast Controller ==
+
== ReC Client and Multicast Controller==
 +
 
 +
* Create user elab
 
     $ sudo useradd --create-home --shell /bin/false --expiredate 1 elab
 
     $ sudo useradd --create-home --shell /bin/false --expiredate 1 elab
 +
 +
* Add user to docker group
 
     $ sudo usermod -a -G docker elab
 
     $ sudo usermod -a -G docker elab
     $ sudo -u elab docker load --input /tmp/webswing.tar
+
 
     $ sudo -u elab docker load --input /tmp/multicast.tar
+
* Load Docker images (only if building outside target deployment server)
     $ sudo -u elab docker load --input /tmp/webswing-admin.tar
+
     $ sudo -u elab docker load --input /tmp/webswing.tar # ReC client image
     $ sudo -u elab docker load --input /tmp/reverse-proxy.tar
+
     $ sudo -u elab docker load --input /tmp/multicast.tar # Multicast Controller image
     $ sudo -u elab cp /tmp/docker-compose-{pendulum,template}.yml /home/elab/
+
     $ sudo -u elab docker load --input /tmp/webswing-admin.tar # ReC client admin console image
     $ sudo -u elab docker-compose -f /home/elab/docker-compose-template.yml -f /home/elab/docker-compose-pendulum.yml up -d
+
     $ sudo -u elab docker load --input /tmp/reverse-proxy.tar # Reverse Proxy image
 +
 
 +
* Copy docker-compose.yml file to elab user home
 +
     $ sudo -u elab cp /tmp/docker-compose.yml /home/elab/
 +
 
 +
* Start all services
 +
     $ sudo -u elab docker-compose -f /home/elab/docker-compose.yml up -d
  
 
== Hardware Server ==
 
== Hardware Server ==
    # Replace wpexperiment with your experiment name
+
 
 +
* Replace wpexperiment with your experiment name
 
     $ export experiment=wpexperiment
 
     $ export experiment=wpexperiment
 +
 +
* Create user elab
 
     $ sudo useradd --create-home --shell /bin/false --expiredate 1 elab
 
     $ sudo useradd --create-home --shell /bin/false --expiredate 1 elab
 +
 +
* Create experiment directory
 
     $ sudo -u elab mkdir /home/elab/rec-deployment/${experiment}
 
     $ sudo -u elab mkdir /home/elab/rec-deployment/${experiment}
 +
 +
* Unpack experiment package to experiment directory
 
     $ sudo -u elab unzip /tmp/${experiment}HardwareServer*.zip -d  /home/elab/rec-deployment/${experiment}
 
     $ sudo -u elab unzip /tmp/${experiment}HardwareServer*.zip -d  /home/elab/rec-deployment/${experiment}
 +
 +
* Start experiment
 
     $ sudo -u elab /home/elab/rec-deployment/${experiment}/${experiment}Daemon.sh start
 
     $ sudo -u elab /home/elab/rec-deployment/${experiment}/${experiment}Daemon.sh start
  
Steps to build and deploy ReC at target environments:
+
= Test =
  
# TODO Steps
+
* Direct access to experiment:
 +
 
 +
Access configured URL at WEBSWING_PUBLIC_URL property (e.g. https://elab.my.url.com) + experiment name (e.g. wpalentejo)
 +
 
 +
https://elab.my.url.com/wpalentejo
 +
 
 +
* Webswing and administration console
 +
 
 +
Access configured URL at WEBSWING_PUBLIC_URL property (e.g. https://elab.my.url.com)
 +
 
 +
https://elab.my.url.com/
 +
 
 +
User: admin
 +
Pass: pwd
 +
 
 +
= Operations =
 +
 
 +
== Hardware Server ==
 +
 
 +
* Startup
 +
    $ sudo -u elab /home/elab/rec-deployment/${experiment}/${experiment}Daemon.sh start
 +
 
 +
* Shutdown
 +
    $ sudo -u elab /home/elab/rec-deployment/${experiment}/${experiment}Daemon.sh stop
 +
 
 +
* Logs
 +
    $ /home/elab/rec-deployment/${experiment}/*.log
 +
 
 +
== ReC Client and Multicast Controller ==
 +
 
 +
* Startup
 +
    $ sudo -u elab docker-compose -f /home/elab/docker-compose.yml up -d
 +
 
 +
* Shutdown
 +
    $ sudo -u elab docker-compose -f /home/elab/docker-compose.yml down
 +
 
 +
* Logs:
 +
    $ docker logs rec.client # ReC client logs (webswing)
 +
    $ docker logs rec.multicast # ReC Multicast Controller logs
 +
    $ docker logs rec.proxy # ReC Proxy logs
 +
    $ docker logs rec.client-admin # ReC client Administration Console logs (webswing)
  
 
Steps to connect to IST environment:
 
Steps to connect to IST environment:
  
 
# TODO Steps
 
# TODO Steps
 +
 +
 +
{|
 +
|[[FREE - Framework for Remote Experiments in Education |Previous Page (FREE - Framework for Remote Experiments in Education)]]
 +
|}
 +
{|
 +
|[[Precision Pendulum Assembly: Apparatus description |Next Page (Apparatus description)]]
 +
|}
 +
 +
==Links==
 +
 +
*[[Controlador de Experiências Remotas | Portuguese version (Versão em português)]]
 +
*[[Controlador remoto del experimento  | Spanish version (Versión en español)]]

Latest revision as of 14:12, 26 August 2021

Pre-requisites

Build environment

  • Git (2.30.2+)
  • Ant (1.10.9+)
  • Maven (3.6.3+)
  • OpenJDK 11 (11.0.8+)
  • Docker (20.10+)
  • docker-compose (1.25.4+)

Multicast Controller and rec.client

  • Docker (20.10+)
  • docker-compose (1.25.4+)

Hardware Server

  • OpenJDK 11 (11.0.8+)

Preparation steps

Setup JAVA_HOME environment variable pointing to a valid openjdk11 installation:

   $ export JAVA_HOME=/path/to/openjdk11

Setup ~/.m2/toolchains.xml pointing to a valid openjdk11 installation:

   <toolchains>
       <toolchain>
           <type>jdk</type>
               <provides>
                   <vendor>openjdk</vendor>
                   <version>11</version>
               </provides>
           <configuration>
               <jdkHome>/path/to/openjdk/jdk11.0.8</jdkHome>
           </configuration>
       </toolchain>
   </toolchains>

First checkout the project from github:

   $ git clone https://github.com/linkareti/rec-project.git

(FIXME) Then we need to switch to jdk11-migration branch:

   $ git checkout jdk11-migration

To create a pendulum experiment, the script create_pendulum_experiment.sh helps to create a base experiment for a brand new pendulum

experiments/create_pendulum_experiment.sh

   Mandatory arguments:
   * 1st argument: Name of the experiment (e.g. worldpendulum)
   * 2nd argument: ID of the experiment (e.g. ELAB_WORLD_PENDULUM)
   * 3rd argument: Pendulum location (e.g. Faro)
   Optional arguments:
   * 4th argument: URL to the video (e.g. rtsp://elabmc.ist.utl.pt:80/wp_ccalg.sdp)
   * 5th argument: Pendulum serial device location (default: /dev/ttyS0)

Sample script execution to create pendulum:

   $ ./create_pendulum_experiment.sh wpalentejo ELAB_WP_ALENTEJO Alentejo rtsp://elabmc.ist.utl.pt:80/wp_alentejo.sdp /dev/ttyS0

Build

Configure the following properties based on your environment:

build_pendulum.properties:

  • pendulum.experiment.list: Name of the experiment(s) to build, comma (,) delimited.
  • pendulum.multicast.controller.host: Hostname where Multicast controller is going to be installed (default: elab-multicast)
  • pendulum.multicast.controller.port: Listen CORBA port used to recieve connections from Hardware Server, rec.web and rec.client (default: 9001)
  • pendulum.rec.multicastcontroller.jmxremote.port: Listen JMX port used to recieve connections from rec.web (default: 25001)
  • install.dir: Base directory where Multicast Controller is going to be installed (default: /home/elab)
  • deployment.subdir: Sub directory where Multicast Controller is going to be installed (default: /rec-deployment)

deployment/compose/src/main/docker/docker-compose-pendulum.yml:

experiments/{experiment}/etc/build.properties

  • experiment.driver.device: Serial port device (e.g. /dev/ttyS0)

Package everything:

   $ mvn clean package -Dmaven.test.skip=true -Djarsigner.alias="REC" -Dbuild.environment=pendulum -Dpack.docker.images -Dpublic.repo=docker.io

Copy resulting packages to destination servers:

  • Multicast Server
   $ scp deployment/images/target/reverse-proxy.tar multicast-server-name:/tmp/
   $ scp deployment/images/target/multicast.tar multicast-server-name:/tmp/
   $ scp deployment/images/target/webswing-admin.tar multicast-server-name:/tmp/
   $ scp deployment/images/target/webswing.tar multicast-server-name:/tmp/
   $ scp deployment/compose/target/docker-compose-runner.yml multicast-server-name:/tmp/docker-compose.yml
  • Hardware Server
   $ scp dist/java/*HardwareServer*.zip hardware-server-name:/tmp/

Install

ReC Client and Multicast Controller

  • Create user elab
   $ sudo useradd --create-home --shell /bin/false --expiredate 1 elab
  • Add user to docker group
   $ sudo usermod -a -G docker elab
  • Load Docker images (only if building outside target deployment server)
   $ sudo -u elab docker load --input /tmp/webswing.tar # ReC client image
   $ sudo -u elab docker load --input /tmp/multicast.tar # Multicast Controller image
   $ sudo -u elab docker load --input /tmp/webswing-admin.tar # ReC client admin console image
   $ sudo -u elab docker load --input /tmp/reverse-proxy.tar # Reverse Proxy image
  • Copy docker-compose.yml file to elab user home
   $ sudo -u elab cp /tmp/docker-compose.yml /home/elab/
  • Start all services
   $ sudo -u elab docker-compose -f /home/elab/docker-compose.yml up -d

Hardware Server

  • Replace wpexperiment with your experiment name
   $ export experiment=wpexperiment
  • Create user elab
   $ sudo useradd --create-home --shell /bin/false --expiredate 1 elab
  • Create experiment directory
   $ sudo -u elab mkdir /home/elab/rec-deployment/${experiment}
  • Unpack experiment package to experiment directory
   $ sudo -u elab unzip /tmp/${experiment}HardwareServer*.zip -d  /home/elab/rec-deployment/${experiment}
  • Start experiment
   $ sudo -u elab /home/elab/rec-deployment/${experiment}/${experiment}Daemon.sh start

Test

  • Direct access to experiment:

Access configured URL at WEBSWING_PUBLIC_URL property (e.g. https://elab.my.url.com) + experiment name (e.g. wpalentejo)

https://elab.my.url.com/wpalentejo

  • Webswing and administration console

Access configured URL at WEBSWING_PUBLIC_URL property (e.g. https://elab.my.url.com)

https://elab.my.url.com/

User: admin Pass: pwd

Operations

Hardware Server

  • Startup
   $ sudo -u elab /home/elab/rec-deployment/${experiment}/${experiment}Daemon.sh start
  • Shutdown
   $ sudo -u elab /home/elab/rec-deployment/${experiment}/${experiment}Daemon.sh stop
  • Logs
   $ /home/elab/rec-deployment/${experiment}/*.log

ReC Client and Multicast Controller

  • Startup
   $ sudo -u elab docker-compose -f /home/elab/docker-compose.yml up -d
  • Shutdown
   $ sudo -u elab docker-compose -f /home/elab/docker-compose.yml down
  • Logs:
   $ docker logs rec.client # ReC client logs (webswing)
   $ docker logs rec.multicast # ReC Multicast Controller logs
   $ docker logs rec.proxy # ReC Proxy logs
   $ docker logs rec.client-admin # ReC client Administration Console logs (webswing)

Steps to connect to IST environment:

  1. TODO Steps


Previous Page (FREE - Framework for Remote Experiments in Education)
Next Page (Apparatus description)

Links