Меню

PIX Master installation and configuration

Installing and configuring PIX Master on a Linux server
*The Master does not work on Ubuntu 22 and Centos distributions (versions of the Master up to 15 still can operate on mentioned systems).

L1. Server settings required before installing the PIX Master
Installing the .Net Core modules on Linux
To install the required modules, use a terminal (you can search for the word cmd in the search box).
In order to execute the following commands, you need root access. To do this, execute the "su root" instruction at the command line and enter the root user password specified when installing the operating system.
To install the .Net Core modules at the command line, use the following commands:

sudo apt-get update
sudo apt-get install apt-transport-https
sudo apt-get update
wget https://packages.microsoft.com/config/debian/10/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
sudo apt-get update
sudo apt-get install -y dotnet-sdk-6.0
In case an error occurs during the installation of packages, you should follow the instructions given in the Linux distributions subsections of the site.
Installing and configuring the Apache server

sudo apt-get install apache2
Create a certificate:

cd /etc/apache2
mkdir ssl
cd ssl
sudo openssl req -new -x509 -days 1461 -nodes -out cert.pem -keyout cert.key -subj "/C=RU/ST=Msk/L=Msk/O=YourCompany/OU=IT Department/CN=master.yourcompany.local/CN=master"
sudo a2enmod proxy_http proxy_html proxy_wstunnel ssl
sudo a2enmod rewrite
sudo systemctl restart apache2
After that, you need to create a configuration file to install a proxy on Apache. To do this, run the command:

sudo nano /etc/apache2/conf-enabled/netcore.conf
The following text should be copied into the created file:

<VirtualHost *:443>
ServerName www.CurrentDomain.com
DocumentRoot /var/pixmaster
SSLEngine on
SSLCertificateFile ssl/cert.pem
SSLCertificateKeyFile ssl/cert.key
#SSLCertificateChainFile ssl/cert.ca-bundle
ProxyPreserveHost On
ProxyPass / http://127.0.0.1:5000/
ProxyPassReverse / http://127.0.0.1:5000/
RewriteEngine on
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
RewriteCond %{HTTP:UPGRADE} ^WebSocket$ [NC]
RewriteCond %{HTTP:CONNECTION} Upgrade$ [NC]
RewriteRule /(.*) ws://127.0.0.1:5000/$1 [P]
ErrorLog /var/log/apache2/netcore-error.log
CustomLog /var/log/apache2/netcore-access.log common
</VirtualHost>
After that, you need to restart the server Apache, for which run:

sudo apachectl configtest
Should get Syntax Ok. After that restart the service:

sudo service apache2 restart
Check the status:

sudo service apache2 status
If successful, you get the status Active: active (running).
If Stopped, Failed - you need to recheck the configuration.
You can verify that Apache is installed correctly by going to http://localhost. The apache welcome page should appear.
Installing Docker + Postgres on Linux
Docker installation:

sudo apt update
sudo apt install docker.io
Then you can work with Docker according to the manual by running commands in superuser mode (sudo).

Start Docker:

sudo systemctl start docker
sudo systemctl enable docker
Load the Postgres container:

sudo docker pull postgres
Use the following command to run the Postgres container automatically:

sudo docker run -d --restart unless-stopped --name pix-postgres -e POSTGRES_PASSWORD=123456789 -d -p 5432:5432 -v $HOME/docker/volumes/postgres:/var/lib/postgresql/data postgres
L2. Setting up a deployed application
For the application to work, you must set up the path to its database in the configuration, as well as specify a folder for storing cryptographic keys.

Configuring the application
Go to the folder where the application was installed and open the file called appsettings.json.
It should have approximately the following content:

{
"Provider": "PostgreSQL",
"CryptographyKeysFolder": "Keys",
"ConnectionStrings": {
"DefaultConnection": "Server=(localdb)\\MSSQLLocalDB;Database=master_test;Trusted_Connection=True;MultipleActiveResultSets=true;Persist Security Info=False;",
"PostgreSqlConnection": "User ID=postgres;Password=123456789;Host=localhost;Port=5432;Database=master_test;Pooling=true;"
},
"Logging": {
"LogLevel": {
"Default": "Warning",
"Hangfire": "Information"
}
},
"AllowedHosts": "*",
"PasswordValidationOptions": {
"RequiredLength": "8",
"RequireNonAlphanumeric": "true",
"RequireLowercase": "true",
"RequireUppercase": "true",
"RequireDigit": "true"
},
"UseSwagger": "false"
}
The Provider key specifies the DBMS (database management system) to be used: MSSQL or PostgreSQL.

In the ConnectionStrings section for the PostgreSqlConnection key you must specify the connection string to the database.
ATTENTION! In the CryptographyKeysFolder key, you must specify the path to the folder where cryptography keys will be stored and specify access rights:

sudo mkdir /var/pixmaster/Keys
sudo chmod 777 /var/pixmaster/Keys
Also, create a folder to store the Master log files and give it full access permissions.

sudo mkdir MasterLog
sudo chmod 777 MasterLog

This is specific to Linux only.
L3. Configuring and running the service
You can move the folder with the published project with the command:

sudo cp -a <folder> <target folder>
<folder> is the path to the folder to be moved, <target folder> is the path where the application will be deployed.
The example below will use /var/pixmaster/ as the application's working folder.

Example:

sudo cp -a /home/user/pix-master/ /var/pixmaster
The service file can be created with the following command:

sudo nano /etc/systemd/system/Master.service
#  Master.service - the name of the service for the project.
The following data must be copied into this file:

[Unit]
Description=ASP .NET Web Application
[Service]
#Specify the path to the directory where the Master is installed
WorkingDirectory=/var/pixmaster
ExecStart=/usr/bin/dotnet /var/pixmaster/Master.dll
Restart=always
RestartSec=10
SyslogIdentifier=netcore-demo
User=www-data
Environment=ASPNETCORE_ENVIRONMENT=Production
[Install]
WantedBy=multi-user.target
After that you will need to start the service with the following commands:

sudo systemctl enable Master.service
sudo systemctl start Master.service

You can now access the application through port 5000.
Check the status:

sudo service apache2 status
If successful, you get the status Active: active (running).
You can run the following command to retrieve data about the service:

sudo journalctl -fu Master.service
Default login data:
Login: admin
Password: Admin1Default@