The SiLA_2_Manager is an open-source framework for laboratory automation with a modern IoT interface. It provides the user with a SiLA service management system, a scheduler, a scripting environment, a experiment planning utility, and a data handler to link service data to a database.
Read the docs for more detailed information.
The SiLA Manager is compatible with the SiLA2 Python repository and all SiLA servers generated with it. Follow the instructions in the SiLA2 Python repository to create your own SiLA servers or use the provided examples (HelloSiLA) to test the SiLA 2 Manager. You can also install the SiLA2 python library and codegenerator from pypi using pip. The other SiLA 2 repositories (like C# and Tecan) will be supported very soon.
-
Install pipenv
Visit:https://pypi.org/project/pipenv/
or try usingpip install pipenv
-
Install the project pipfile
Move to the project main directory, where the pipfile is located
Run:pipenv install
This will install all required python packages in a virtual environment. -
Entering the virtual environment
Most IDE's support automatic detection of virtual environments and will start the console in this environment. For some IDE's this requires some changes in the settings menu.
If no IDE is used you can enter the environment by entering:pipenv shell
This README contains the bare essentials to get the device manager up and running. For a more detailed description and further information read the documentation. The documentation can be generated using sphinx.
-
Run the following command from within the docs folder
To generate a pdf (Perl and latexmk required):make latexpdf
To generate a html-filemake html
-
The file will be stored in the _build folder inside the docs folder
-
Install Docker (v2.3.0.5)
Visithttps://www.docker.com/products/docker-desktop
-
Download and start the images of PostgreSQL and redis: Run
docker run --name postgres -e POSTGRES_PASSWORD=1234 -d -p 5432:5432 postgres
Rundocker run --name redis -d -p 6379:6379 redis
The next time you want use the containers you can start them directly:docker start postgres
docker start redis
-
Create the user-script docker image
cd user_script_env
docker build -t user_script .
-
Activate development mode
export DEVICE_MANAGER_ENV_PRODUCTION=0
orset DEVICE_MANAGER_ENV_PRODUCTION=0
if you are on windows -
Setup a test database:
Runpython setup_db.py
from inside your pipenv environment. -
Create Config File:
Runpython generate_config.py
from inside your pipenv environment.
Run ./run_backend_server.sh
from inside your pipenv environment.
Run ./run_backend_server.bat
from inside your pipenv environment.
-
Install nginx On ubuntu this can be installed with apt
sudo apt install nginx
-
Install PostgreSQL
sudo apt install postgresql-12
sudo apt install postgresql-client-12
-
Install Docker
Use the official instructions -
Install Supervisor
sudo apt install supervisor
-
Install Redis
sudo apt install redis-server
-
Install and run pipenv
sudo apt install pipenv
mkdir .venv
pipenv sync
-
Fix protobuf installation
Uninstall protobuf and reinstall it using the --no-binary flag.
pipenv shell
sudo pip3 uninstall protobuf
Check that protobuf has been uninstalled:
pip3 list
sudo pip3 install --no-binary=:all: -t $/home/<usr>/sila2_device_manager/.venv/lib/python3.8/site-packages protobuf==3.15.0
Check that protobuf has been reinstalled. -
Replace some files in the sila2lib of the virtual environment
sudo pipenv run python3.8 replace_files.py
-
Install and Enable Nginx Config
sudo cp server-config/device-manager.conf /etc/nginx/sites-available/
sudo ln -s /etc/nginx/sites-available/device-manager.conf /etc/nginx/sites-enabled/device-manager.conf
-
Install Supervisor Config
sudo cp server-config/device-manager-backend.supervisor.conf /etc/supervisor/conf.d
sudo cp server-config/device-manager-scheduler.supervisor.conf /etc/supervisor/conf.d
-
Create the device-manager user and group and add yourself
sudo adduser --system --no-create-home --group --ingroup docker device-manager
sudo gpasswd -a your-user-name device-manager
-
Create www directory
sudo mkdir /var/www/html/device-manager-frontend
chmod -R device-manager /var/www/html/device-manager-frontend
chgrp -R device-manager /var/www/html/device-manager-frontend
chmod -R 775 /var/www/html/device-manager-frontend
-
Create Backend Config Directory
sudo mkdir /etc/device-manager/
-
Start and Enable PostgreSQL
sudo systemctl enable postgresql.service
sudo systemctl start postgresql.service
Fill the database with the initial values and examples
pipenv run python setup_db.py
-
Set Postgres password
sudo -u postgres psql postgres
\password postgres
enter the password
\q
-
Start and Enable Docker
sudo systemctl enable docker.service
sudo systemctl start docker.service
-
Enable and configure Redis
edit /etc/redis/redis.conf and change
supervised no
tosupervised systemd
sudo systemctl enable redis.service
sudo systemctl start redis.service
-
Create the user-script docker image
cd user_script_env
sudo docker build -t user_script .
cd ..
-
Deploy Backend
sudo pipenv run ./deploy_backend.sh
-
Edit Device-Manager Configuration File
The configuration files are located in the main directory under:
./server-config/device-manager.conf
./server-config/device-manager-backend.supervisor.conf
./server-config/device-manager-scheduler.supervisor.conf
-
Build and Install Frontend
cd frontend
sudo make
sudo make install
-
Start and Enable Nginx
sudo systemctl enable nginx.service
sudo systemctl start nginx.service
-
Start and Enable Supervisor
sudo systemctl enable supervisor.service
sudo systemctl start supervisor.service
To deploy a new version its often enough to repeate step 17 and 19.
Then restart nginx and supervisor by using
sudo systemctl restart nginx.service
and
sudo systemctl restart supervisor.service
You can use supervisorctl
to manage the backend and scheduler processes separately.
The logs can be viewed under /var/log/device-manager.
To restart the backend or the scheduler service, use supervisorctl. Enter supervisorctl:
sudo supervisorctl
and run the restart command for the respective service:
restart backend:device-manager-backend-0
This code is licensed under the MIT License