-
Notifications
You must be signed in to change notification settings - Fork 3
Home
Step-by-step guideline on how to install Tango REST API server and TangoWebapp (client) on Windows can be found here: Tango Controls tutorial
Define TangoRestServer device in the Tango DB:
Device may have the following properties:
[](Jive propeties)
TANGO_DB defines which database will be exported through this server
TANGO_ACCESS defines which TangoAccessControl device will be used for authentication
TOMCAT_PORT -- a port on which embedded tomcat will run
TOMCAT_AUTH_CONFIG_CLASS defines which class will be used to set up tomcat's authentication. Default one just adds tango-cs:tango user
Unzip and place it into your servlet container's webapps folder ({CATALINA_HOME}/webapps
). Restart the container. If everything is fine you should notice something like the following output in the log:
TangoRestServer has been initialized.
[2015-03-05 03:54:31,112] Artifact tango:war: Artifact is deployed successfully
[2015-03-05 03:54:31,113] Artifact tango:war: Deploy took 2 338 milliseconds
To be 100% sure that mtango.server is properly deployed open your browser and type in the address bar http://localhost:8080/tango/rest
. An authorization popup will appear, to pass the authorization you should define user(s) with role(s) mtango-rest, mtango-admin *)
in the servlet container (see {CATALINA_HOME}/conf/tomcat-users.xml). You should see a list of supported Tango REST API versions list:
#!json
{
"rc3":"http://localhost:8080/tango/rest/rc3"
}
*) This one is used to access mTango admin panel. If you do not plan to use it (it is not required for this tutorial) just skip this role.
Download the latest mtango.server .jar.
To run the server simply execute the following: java -jar mtango.server.jar $INSTANCE
,
where $INSTANCE is a desired Tango device instance name, e.g. test
Or create the following bash script and place it near to the jar (possibly where Starter device can find it):
#!bash
#!/bin/bash
echo "Using TANGO_HOST=$TANGO_HOST"
INSTANCE_NAME=$1
echo "Using INSTANCE_NAME=$INSTANCE_NAME"
#-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005
JAVA_OPTS="-Xmx4G -Xshare:off -XX:+UseG1GC -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5009"
echo "Using JAVA_OPTS=$JAVA_OPTS"
/usr/bin/java -jar $JAVA_OPTS -DTANGO_HOST=$TANGO_HOST /usr/lib/tango/server/mtango.server-rc2-0.2.jar $INSTANCE_NAME org.tango.TangoRestServer $INSTANCE_NAME &
Now it is the time to test it. Use tango-cs/tango as username/password when prompted. The result must be like this one:
When started mTangoREST server deploys a Tango device:
this device exports the following attributes:
aliveProxies -- currently used proxies
cacheEnabled -- indicates whether HTTP cache-control headers are added to responses
attributeValueExpirationDelay -- defines the value for the Expires header for attribute values
staticValueExpirationDelay -- defines the value for the Expires header for static values (aka device info)
proxyKeepAliveDelay -- defines how long the server will keep TangoProxy instance
and the following commands:
setProxiesSource([devices,values]) -- sets proxy source value for each passed device (DeviceProxy.set_source)
NOTE: when .war file is deployed Tango device instance name is defined in web.xml:
#!xml
<context-param>
<param-name>tango.rest.server.instance</param-name>
<param-value>development</param-value>
</context-param>
There is embedded Groovy console:
To access it user must have mtango-groovy role.