Commit e04ea75c authored by Hericourt Pierre's avatar Hericourt Pierre
Browse files

initial commit

parents
======
README
======
Created Monday 07 December 2020
A beginners install guide to Tango Controls & Friends (written by noobs)
Works (Tested) on Mint 20 an Debian 10.
`+Prerequisite <./README/Prerequisite.rst>`_
`+Server <./README/Server.rst>`_
`+Hdb++ <./README/Hdb++.rst>`_
`+First Device Server in Python <./README/First_Device_Server_in_Python.rst>`_
======
Client
======
Created Sunday 13 December 2020
::
./configure --disable-dbserver --enable-java --with-zlib=/usr/lib/x86_64-linux-gnu
make
sudo make install
pip3 install pytango
pip3 install pyqt5-dev pyqt5-dev-tools python3-pyqt5 qt5-default qttools5-dev python3-pyqt5.qtwebkit
pip3 install taurus taurus-pyqtgraph
`README <../README.rst>`_
======
Device
======
Created Monday 14 December 2020
vérifier dns
systemd-resolve --status
./configure --disable-dbserver
make
sudo make install
pip3 install pytango
jouer avec pogo, lancer un device server test
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
`README <../README.rst>`_
=============================
First Device Server in Python
=============================
Created Monday 07 December 2020
::
pip3 install pytango
todo : a short video will be useful to explain pogo & jive
`TOC <../README.rst>`_
=====
Hdb++
=====
Created Saturday 12 December 2020
`+libhdbpp <./Hdb++/libhdbpp.rst>`_
`+libhdbpp-mysql <./Hdb++/libhdbpp-mysql.rst>`_
`+hdbpp-es <./Hdb++/hdbpp-es.rst>`_
`+hdbpp-cm <./Hdb++/hdbpp-cm.rst>`_
`+hdbpp-configurator <./Hdb++/hdbpp-configurator.rst>`_
`+hdbpp-viewer <./Hdb++/hdbpp-viewer.rst>`_
`README <../README.rst>`_
========
hdbpp-cm
========
Created Sunday 13 December 2020
Compilation and Installation :
::
git clone --depth 1 --branch v1.0.0 https://github.com/tango-controls-hdbpp/hdbpp-cm.git
export CPLUS_INCLUDE_PATH=$CPLUS_INCLUDE_PATH:/usr/local/include/tango/:/usr/include/mariadb:../libhdbpp/src/
HdbConfigurationManager.h : remove libhdb++/ at line 42
::
vi src/HdbConfigurationManager.h
cd src
make
sudo make install
Add device server 'hdb++cm-srv cm' with Jive Wizard :
::
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
hdb++cm-srv cm
device path : lab/manager/cm
Lib configuration:
::
libname=/usr/local/lib/libhdb++mysql.so.6.2.3
host=localhost
user=hdbpp
password=hello
dbname=hdbpp
port=3306
json_array=0
Set ArchiverList property with Jive:
::
tango://vtango.local.lab:10000/lab/manager/es
And now ... test !
`hdbpp-configurator <./hdbpp-configurator.rst>`_
`Hdb++ <../Hdb++.rst>`_
`README <../../README.rst>`_
==================
hdbpp-configurator
==================
Created Sunday 13 December 2020
first get and build requirements:
::
git clone https://github.com/tango-controls-hdbpp/hdbpp-configurator.git
mvn package
create a run.sh to run it (care de version) :
::
#!/bin/bash
TANGO_LIBS=/usr/local/share/java
CLASSPATH=$TANGO_LIBS/JTango.jar:$TANGO_LIBS/ATKWidget.jar:$TANGO_LIBS/ATKCore.jar:$TANGO_LIBS/Jive.jar:target/hdbpp-configurator-3.27-SNAPSHOT.jar
export TANGO_HOST=vtango.local.lab:10000
export HdbManager=lab/manager/cm
java -cp $CLASSPATH org.tango.hdb_configurator.configurator.HdbConfigurator
::
chmod +x run.sh
`hdbpp-viewer <./hdbpp-viewer.rst>`_
`Hdb++ <../Hdb++.rst>`_
`README <../../README.rst>`_
========
hdbpp-es
========
Created Saturday 12 December 2020
git clone --depth 1 --branch v1.0.2 `https://github.com/tango-controls-hdbpp/hdbpp-es.git <https://github.com/tango-controls-hdbpp/hdbpp-es.git>`_
vi src/PushThread.h //remove libhdb++/ line 52
export CPLUS_INCLUDE_PATH=$CPLUS_INCLUDE_PATH:/usr/local/include/tango/:/usr/include/mariadb:../libhdbpp/src/
make
sudo make install
run hdb++es-srv, add server with jive wizard : it will be : lab/manager/es
::
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
hdb++es-srv es
Lib configuration:
*****
::
libname=/usr/local/lib/libhdb++mysql.so.6.2.3
host=localhost
user=hdbpp
password=hello
dbname=hdbpp
port=3306
json_array=0
`hdbpp-cm <./hdbpp-cm.rst>`_
`Hdb++ <../Hdb++.rst>`_
`README <../../README.rst>`_
============
hdbpp-viewer
============
Created Sunday 13 December 2020
build step :
::
git clone https://github.com/tango-controls-hdbpp/libhdbpp-extraction-java.git
mvn package
git clone https://github.com/tango-controls-hdbpp/hdbpp-viewer.git
mvn package
download external tools jcalendar.jar & jython.jar.
`https://www.jython.org/download.html <https://www.jython.org/download.html>`_ : Jython Standalone
`https://toedter.com/jcalendar/ <https://toedter.com/jcalendar/>`_ : jcalendar-1.4.zip
Decompress jcalendar-1.4.zip and copy jcalendar-1.4.jar in the target folder
Copy jython-standalone-2.7.2.jar in target folder
Create a run.sh
::
#!/bin/bash
TANGO_LIBS=/usr/local/share/java
CLASSPATH=$TANGO_LIBS/JTango.jar:$TANGO_LIBS/ATKWidget.jar:$TANGO_LIBS/ATKCore.jar:$TANGO_LIBS/Jive.jar
CLASSPATH=$CLASSPATH:./jcalendar-1.4.jar:./jython-standalone-2.7.2.jar
CLASSPATH=$CLASSPATH:./jhdbviewer-1.26-SNAPSHOT.jar
CLASSPATH=$CLASSPATH:../../libhdbpp-extraction-java/target/libhdbpp-java-1.31-SNAPSHOT.jar
echo $CLASSPATH
export TANGO_HOST=vtango.local.lab:10000
export HDB_TYPE=mysql
export HDB_NAME=hdbpp
export HDB_MYSQL_HOST=127.0.0.1
export HDB_USER=hdbpp
export HDB_PASSWORD=hello
java -cp $CLASSPATH HDBViewer.MainPanel
::
chmod +x run.sh
That's all folks !
Welcome in Tango world !
Do not forget to tune mariadb permissions if the viewer doesn't run on the server.
`Hdb++ <../Hdb++.rst>`_
`README <../../README.rst>`_
==============
libhdbpp-mysql
==============
Created Saturday 12 December 2020
::
cd /usr/local/lib
ln -s libhdb++.so.6 libhdb++.so
git clone https://github.com/tango-controls-hdbpp/libhdbpp-mysql.git
we will use mariadb client, no need for mysqlclient then comment these lines in CMakeLists.txt
::
50 #pkg_check_modules(LIBMYSQLCLIENT REQUIRED mysqlclient)
51
52 #foreach(FLAG ${LIBMYSQLCLIENT_CFLAGS_OTHER})
53 # set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${FLAG}")
54 #endforeach()
in LibHdb++MySQL.h remove libhdb++/ line 24
::
vi src/LibHdb++MySQL.h
::
mkdir build
cd build/
export CPLUS_INCLUDE_PATH=$CPLUS_INCLUDE_PATH:/usr/local/include/tango/:/usr/include/mariadb:../../libhdbpp/src/
cmake -DCMAKE_LIBRARY_PATH=-L/usr/lib/x86_64-linux-gnu -DCMAKE_CXX_STANDARD_LIBRARIES="-lmariadb" ..
make
sudo make install
Keep focus on '/usr/local/lib/libhdb++mysql.so.6.2.3'. We will use it later.
It's time to create the database. Let's follow a beginner magical recipe to avoid mysql/mariadb/innodb incompatibilities with viewer (see later). Certainly not a good solution : need more work to understand the dependencies between all these pieces.
::
mysql -u root -p
CREATE DATABASE hdbpp;
CREATE USER 'hdbpp'@'localhost' IDENTIFIED BY 'hello';
GRANT ALL PRIVILEGES ON *.* TO 'hdbpp'@'localhost' WITH GRANT OPTION;
FLUSH PRIVILEGES;
sed 's/ENGINE=MyISAM/ENGINE=InnoDB/' /usr/local/share/libhdb++mysql/create_hdb++_mysql.sql > magical.sql
mysql -u root -p hdbpp < magical.sql
`hdbpp-es <./hdbpp-es.rst>`_
`README <../../README.rst>`_
========
libhdbpp
========
Created Saturday 12 December 2020
::
git clone --depth 1 --branch v1.0.1 https://github.com/tango-controls-hdbpp/libhdbpp.git
cd libhdbpp/
mkdir build
cd build/
cmake ..
export CPLUS_INCLUDE_PATH=$CPLUS_INCLUDE_PATH:/usr/local/include/tango
make
sudo make install
`libhdbpp-mysql <./libhdbpp-mysql.rst>`_
`Hdb++ <../Hdb++.rst>`_
`README <../../README.rst>`_
=============
Prerequisites
=============
Created Monday 07 December 2020
usable DHCP and DNS on the localnet (optional).
Server name : vtango (like virtual, for test, he runs on a virtual machine)
Domain name : local.lab
an ubuntu 20.04 desktop fresh install (to prevent localization issues choose us eveywhere but keyboard)
back to Europe if needed :
::
dpkg-reconfigure tzdata
install many packages (build, corba, zmq, maria, ...)
::
aptitude install build-essential cmake ant git python3-pip maven
aptitude install omniidl libomniorb4-dev libcos4-dev libomnithread4-dev libzmq3-dev libboost-all-dev
aptitude install mariadb-server libmariadbclient-dev
pip3 install Sphinx sphinx_rtd_theme ipython
install sun jdk and make it default one with 'update-alternatives --config'
::
tar xvfz jdk-8u202-linux-x64.tar.gz
mv jdk1.8.0_202/ /opt/
update-alternatives --install /usr/bin/java java /opt/jdk1.8.0_202/bin/java 100
update-alternatives --install /usr/bin/javac javac /opt/jdk1.8.0_202/bin/javac 100
update-alternatives --config java
update-alternatives --config javac
`Server Installation <./Server.rst>`_
`TOC <../README.rst>`_
======
Server
======
Created Monday 07 December 2020
**create db**
::
mysql -u root -p
CREATE USER 'tangouser'@'localhost' IDENTIFIED BY 'hello';
GRANT ALL PRIVILEGES ON *.* TO 'tangouser'@'localhost' WITH GRANT OPTION;
FLUSH PRIVILEGES;
**get TangoSourceDistribution**
::
git clone https://github.com/tango-controls/TangoSourceDistribution.git
ant build package
cd build/distr
configure with mariadb
::
./configure --enable-mariadb --with-mariadbclient-include=/usr/bin/mysql --with-mariadbclient-lib=/usr/lib/x86_64-linux-gnu --with-zlib=/usr/lib/x86_64-linux-gnu --enable-dbserver --enable-dbcreate --enable-java --with-mysql-admin=tangouser --with-mysql-admin-passwd=hello
make
sudo make install
**installation test in consoles (without services nor starters) :**
run DataBaseds (edit hostname & domain name)
::
vi /etc/tangorc
TANGO_HOST=vtango.local.lab:10000
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
DataBaseds 2 -ORBendPoint giop:tcp:vtango.local.lab:10000
run jive
::
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
jive
**setup server as a systemd service**
::
adduser tangouser
::
vi /etc/systemd/system/tango.service
::
[Unit]
Description = Tango DB
After=mysqld.service
Requires=mysqld.service
[Service]
User=tangouser
StandardOutput=inherit
StandardError=inherit
KillSignal=SIGINT
Environment=TANGO_HOST=vtango.local.lab:10000
Environment=MYSQL_USER=tangouser
Environment=MYSQL_PASSWORD=hello
Environment=LD_LIBRARY_PATH=LD_LIBRARY_PATH:/usr/local/lib
ExecStart=/usr/local/bin/DataBaseds 2 -ORBendPoint giop:tcp:vtango.local.lab:10000
[Install]
WantedBy=multi-user.target
::
chmod +x /etc/systemd/system/tango.service
systemctl enable tango
systemctl --system daemon-reload
systemctl start tango
systemctl status tango
`Hdb++ <./Hdb++.rst>`_
`First Device Server in Python <./First_Device_Server_in_Python.rst>`_
`TOC <../README.rst>`_
=======================
TangoSourceDistribution
=======================
=======
Starter
=======
Created Monday 14 December 2020
Play with Starter (with simple example : `Example <./examples/Counter_Push/Counter_Push>`_)
in few words, create file DeviceServerClassName, DeviceServerClassName.sh
do not forget to tune permissions (chmod +x)
In game files :
- Counter_Push.py
- Counter_Push.sh
- Counter_Push
Manual start the ... Starter :
::
host=$(hostname -s)
tango_admin --add-server Starter/$host Starter tango/admin/$host
Starter $host
Reference : ``https://tango-controls.readthedocs.io/en/latest/administration/deployment/starter.html <https://tango-controls.readthedocs.io/en/latest/administration/deployment/starter.html>`_ <`https://tango-controls.readthedocs.io/en/latest/administration/deployment/starter.html <https://tango-controls.readthedocs.io/en/latest/administration/deployment/starter.html>`_>`_
care paths (/var/tmp, a forgotten note)
Un service pour lancer le Starter :
::
[Unit]
Description=Starter device server
[Service]
Restart=always
RestartSec=10
User=tangouser
StandardOutput=inherit
StandardError=inherit
KillSignal=SIGINT
Environment=TANGO_HOST=vtango.local.lab:10000
Environment=LD_LIBRARY_PATH=LD_LIBRARY_PATH:/usr/local/lib
ExecStartPre=/bin/sleep 5
ExecStart=/usr/local/bin/Starter %H
[Install]
WantedBy=multi-user.target
::
chmod 644 tango-starter.service
systemctl enable tango-starter
systemctl --system daemon-reload
systemctl start tango-starter
systemctl status tango-starter
Run and configure Astore :
Edit properties to write path
Open Control Panel to start new device server
Start New, Level 1
#!/usr/bin/env python3
from Counter_Push import *
if __name__ == '__main__':
main()
# -*- coding: utf-8 -*-
#
# This file is part of the Counter_Push project
#
#
#
# Distributed under the terms of the GPL license.
# See LICENSE.txt for more info.
""" Counter_Push
"""
# PyTango imports
import tango
from tango import DebugIt
from tango.server import run
from tango.server import Device
from tango.server import attribute, command
from tango import AttrQuality, DispLevel, DevState
from tango import AttrWriteType, PipeWriteType
# Additional import
# PROTECTED REGION ID(Counter_Push.additionnal_import) ENABLED START #
import time
from threading import Thread
class Counter(Thread):
def __init__(self, parent):
Thread.__init__(self)
self.parent = parent
self.counter = 0.0
def run(self):