Webapp installation tutorial

Hi,

I just succeeded to install webapp from the start, and I thought it might help to post how I did.

  1. Download Apache Tomcat 8 and install it to C:/apache-tomcat-8
    To verify that it got installed successfully, try to go to http://127.0.0.1:8080

  2. Download mtangorest.server-rc4-0.1.jar and put it in C:/apache-tomcat-8/webapps (from https://bitbucket.org/hzgwpn/mtangorest.server/downloads/)

  3. Follow the installation on : https://bitbucket.org/hzgwpn/mtangorest.server/wiki/Home. (for .jar). (For information my tango host is on local)
    TANGO_ACCESS → tango://127.0.0.1:20000/sys/access_control/1
    TANGO_DB → tango://127.0.0.1:20000/sys/database/2
    TOMCAT_PORT -->8844

  4. Export DatabaseDS, and load it to create a TangoAccessControl server
    TangoAccessControl
    1
    TangoAccessControl
    sys/access_control/1
    (For this step, you will need to update “database” by “tangoAccessControl”).

  5. On jive, click on edit, then create free property named “CtrlSystem”. Then go to property (last tab), click on CtrlSystem, add a new property named “Services” with the value
    AccessControl/tango:sys/access_control/1

  6. Download TangoWebapp.war on GitHub - scientific-software-hub/waltz: A general purpose web application that provides the interface between SCADA(s) system and the scientific users who define and calibrate their experiments then put it to C://apache-tomcat-8/webapp. (When you will start the Apache server, it will create a TangoWebapp folder).

  7. define a tomcat user in C://apache-tomcat-8/conf :

  8. Go to $Tango_home/bin and launch with a command line “TangoAccessControl.exe 1”

  9. Go to C://apache-tomcat-8/webapp and launch with a command line “java -jar -DTANGO_HOST=127.0.0.1:20000 mtango.server-rc4-0.4.jar test”

  10. Open Jive, then open an atk panel on TangoControlAccess DS, then test device, and execute the AddDeviceForUser command with “[“tango-cs”,“sys/database/2”, “write”]” as parameter.
    Also, add a new environment variable name SUPER_TANGO with the value true.
    Then go on Astor, tool and open AccessControl HMI. Add ... as allowed address for the user tango-cs.

  11. Try your mtango server instance by the URL : http://127.0.0.1:8844/tango/rest (enter username: tango-cs, password : tango if necessary).

  12. Time to try the tango webapp. try to go to the URL : http://127.0.0.1:8080/TangoWebapp. Get logged, then at the top enter as rest host : http://127.0.0.1:8844. (http:// is important), and as host : $Tango_host. Then refresh the page via f5. You should have an access to the device tree.

This worked for me :-).

Regards,

Florian Pourchayre,
Thales Group

Hi Florian,

Nice tutorial!

This must be added to tango-controls.readthedocs.io into the tutorials section: tutorials! That is for sure!!!

Should I do it? Or maybe you would like to make a PR (this will reflect your contribution to documentation)?

Cheers,

Hi Igor,

Thank you! I let you do it, I just hope it will help the community !

Regards :-),

Florian Pourchayre,
Thales Group

Hi

I want to try tango webapp,but can’t install it because of Tango Access Control

Based on TangoWebapp installation tutorial from http://tango-controls.readthedocs.io/en/latest/tutorials-and-howtos/tutorials/install-tango-webapp.html

After i complete step 5, then can not start TangoAccessControl server (step 8):

[ics@localhost ~]$ TangoAccessControl 1
Tango exception
Severity = ERROR
Error reason = API_ReadOnlyMode
Desc : Command DbExportDevice on device sys/database/2 is not authorized because an error occurs while talking to the Controlled Access Service
Origin : Connection::command_inout()

Tango exception
Severity = ERROR
Error reason = API_CommandFailed
Desc : Failed to execute command_inout on device sys/database/2, command DbExportDevice
Origin : Connection::command_inout()

Received a CORBA_Exception
Exiting

because i can not start TangoAccessControl server, so jive also report error!

In step 4, [quote](For this step, you will need to update “database” by “tangoAccessControl”).[/quote], i want to know what is it meaning?
Thank you in advance for help.

Hi,

The TangoAccessControl device server should ideally be started from a script.
For instance, with the Tango source distribution, there is a script named tango_wca (located in /usr/local/bin by default) which will start MySQL, the DatabaseDs and TangoAccessControl device server.

This script will do an

export SUPER_TANGO=true

before starting the TangoAccessControl device server, this is essential to avoid the errors you are currently seeing.

The other device servers must be started without this SUPER_TANGO environment variable defined.

[quote=“Jimmy”]In step 4,

(For this step, you will need to update “database” by “tangoAccessControl”).[/quote]

I agree with you about step 4. I don’t understand this sentence.

Kind regards,
Reynald

Hi Reynald

Thank you!

Before run TangoAccessControl, jive ,etc, I set SUPER_TANGO environment variable to true.

As I wrote this environment variable should be set to true only when TangoAccessControl is started.
When running jive or any other device server or client, it should not be set if you want the Tango Access Control to work as expected.
Of course, you need to configure the access permissions in Tango Access Control for the different users properly using Astor, as explained on this page: http://tango-controls.readthedocs.io/en/latest/administration/services/access-control.html

@Jimmy, if you want just to give a try. You may skip TangoAccessControl in your deployment at all. Just set TANGO_ACCESS TangoRestServer’s device property to “none”:

Hi everyone,

Sorry if I wasn’t clear enough for my step 4.

I meant you have to export your database DS (Right click on your server name / Serve server data), then edit it with some edit and replace “Database” by “access_control”.

As it’s not so easy, I joined my access control device.

Hope it will help you

Regards,

Florian Pourchayre
Thales Group

OK, I understand better now…

So basically, step 4 is to define TangoAccessControl device server and its devices in the Tango database.
This could be done by loading a file from jive as you are suggesting, or can be done via Jive → Edit menu → Create Server, as described on this documentation page:
http://tango-controls.readthedocs.io/en/latest/tools-and-extensions/jive/servers.html

Kind regards,
Reynald

Hi

[quote=“Reynald”]As I wrote this environment variable should be set to true only when TangoAccessControl is started.
When running jive or any other device server or client, it should not be set if you want the Tango Access Control to work as expected.[/quote]

I find why i have to set SUPER_TANGO to true before run jive, it’s hostname’s format.

On my CentOS 7 (tango 9.2.5 + omniorb 4.2.1 + zmq 4.2.1), i define hostname as “localhost.localdomain” in /etc/hosts, and define TANGO_HOST in /etc/tangorc by hostname

/etc/hosts:

127.0.0.1   localhost localhost4 localhost4.localdomain4
172.16.84.196 localhost.localdomain

/etc/tangorc:

TANGO_HOST=localhost.localdomain:10000

In this environment, if i complete step 5 ( http://tango-controls.readthedocs.io/en/latest/tutorials-and-howtos/tutorials/install-tango-webapp.html ) and not define SUPER_TANGO, the jive can’t correctly run:

[ics@localhost ~]$ jive
Host name/address cannot be determined !

then in jive, can’t access any device information (seemly jive not correctly retrieve data from tango DB). if I don’t configure TAC, everything is ok!
If i edit hostname in /etc/hosts and /etc/tangorc
/etc/hosts:

127.0.0.1   localhost localhost4 localhost4.localdomain4
172.16.84.196 centos7

/etc/tangorc:

TANGO_HOST=centos7:10000

then i don’t define SUPER_TANGO, jive can correctly run.

so i think for tango, hostname must have some specified requirements!

i set TANGO_ACCESS to none, then start mtangorest.server-rc4-2.4-SNAPSHOT.jar successfully.

Hi Jimmy,
besides the issues with the TANGO_HOST env variable, the /etc/hosts file content you’re showing looks wrong. Hosts file is supposed to contain one line for each host, with the following information:

Internet-address OfficialHostname Aliases

The official hostname may or may not include the complete domain name.
But… your first configuration is basically assigning two different IP addresses to localhost, which won’t work.
(and localhost s really just for 127.0.0.1).
Cheers,
Lorenzo