Platform and services installation
Installation of the IoT platform — downloading images, Docker setup, system install, updates and autostart configuration.
Installation files download
There are two ways to download the installation images of the “Secure IoT Telemetry Data Acquisition and Processing Platform”:
In the case when the server is not connected to the Internet (for example, according to the enterprise security policy), it is possible to install the “Secure IoT Platform for Telemetry Data Collection and Processing” system offline. In this case, the installation images of the system are transferred to the server from an external media.
If the server is connected to the Internet, the system installation images are uploaded to the server via a remote repository.
Installation steps
Copy the required data package
To install the containerization tool it is necessary to execute the commands (administrator rights will be required):
- It is necessary to copy the downloaded
unicloud.tgzarchive to the user’s root folder. Copy theimagesfolder (standalone installation package of the system with archived images) to the root folder of the user. The archive also contains configuration filesdocker-compose.ymland.env(hidden, it is necessary to display hidden files).
-
images
- vadtel-nginx-latest.tar.gz
- vadtel-app-latest.tar.gz
- anytelemetry-latest.tar.gz
- pgbouncer-latest.tar.gz
- vadteljsondaemon-latest.tar.gz
- logrotate-latest.tar.gz
- postgres-15.1-alpine.tar.gz
- redis-6.0.16-alpine.tar.gz
- vector-latest.tar.gz
-
The configuration files should be copied to
/opt/vadtelnewweb/. -
Logins and passwords to the system must be specified in the
.envfile:
.env#key SECRET_KEY_BASE=0356080kcn0ejgk4lwekrf #DB PGSQL login PG_APP_USER=ppppp #DB PGSQL password PG_APP_PASSWORD= ppppp #WEB interface login VADTEL_SUPER_ADMIN_EMAIL=NEED_USERNAME #WEB interface password VADTEL_SUPER_ADMIN_PASSWORD=NEED_PASSWORD #DB PGSQL unicloud login VADTEL_UNICLOUD_TEST_USERNAME=NEED_USERNAME #DB PGSQL unicloud password VADTEL_UNICLOUD_TEST_PASSWORD=NEED_PASSWORD- It is necessary to copy the downloaded
Installing Docker and Docker Compose
Installing Docker and Docker Compose on the CentOS distribution.
Install Docker and Docker Compose:
bashsudo dnf install docker-ce docker-composeExpected outputDependencies resolved. Installing: docker-ce docker-compose Transaction Summary Install 2 Packages Is this ok [y/N]: y Downloading Packages... Running transaction... Complete!Run and add Docker to autoloader:
bashsudo systemctl enable --now docker && systemctl start dockerInstalling Docker and Docker Compose on an Debian distribution
Install Docker and Docker Compose:
bashsudo apt update sudo apt install docker docker-composeExpected outputReading package lists... Done Building dependency tree... Done The following NEW packages will be installed: docker docker-compose Do you want to continue? [Y/n] y Setting up docker ... Setting up docker-compose ... Processing triggers for man-db ...System Installation
Next, the system installation does not differ for different operating systems. Add the user under which the application will run to the docker group:
bashsudo usermod -aG docker ${USER}Next, unpack the
unicloud.tgzarchive copied to the user’s root folder and run the following command:bashtar -xf unicloud.tgz-
unicloud
-
run
-
db-unicloud
-
- remote_install.sh
-
init-db
- create_tables.sql
- script_conf.sh
- docker-compose.yml
-
logs
-
crontab
-
vadteljsondaemon
-
anytelemetry
-
-
backups
-
data
-
db-unicloud
-
-
local-images
- pgbouncer.tar.gz
- postgres.tar.gz
- vadteljsondaemon.tar.gz
- anytelemetry.tar.gz
- logrotate.tar.gz
- unicloud.service
-
After executing the command, go to the unzipped
unicloudfolder in the user’s root folder and run the script:bashsudo ./remote_install.shExpected outputReading package lists... Done Building dependency tree... Done Created symlink /etc/systemd/system/multi-user.target.wants/unicloud.service -> /lib/systemd/system/unicloud.service Packet successfully installed. Database credentials saved to the .env fileAfter successful installation of the package, go to the
/var/lib/unicloudfolder with administrator privileges, and change the Owner Name and Group Name to the current user for the.envfileThe script generates access — login, password to the database
/var/lib/unicloud/.env, which must be specified in the file/opt/vadtelnewweb/.env.These are the values:
bashVADTEL_UNICLOUD_TEST_USERNAME=NEED_USERNAME VADTEL_UNICLOUD_TEST_PASSWORD=NEED_PASSWORD-
Extracting and downloading images
Unzip the previously copied folder with
imagesimage filesbashgunzip vadtel-nginx-latest.tar.gz gunzip vadtel-app-latest.tar.gz gunzip anytelemetry-latest.tar.gz gunzip pgbouncer-latest.tar.gz gunzip vadteljsondaemon-latest.tar.gz gunzip logrotate-latest.tar.gz gunzip postgres-15.1-alpine.tar.gz gunzip redis-6.0.16-alpine.tar.gz gunzip vector-latest.tar.gzUploading images to Docker:
bashdocker load -i vadtel-nginx-latest.tar docker load -i vadtel-app-latest.tar docker load -i anytelemetry-latest.tar docker load -i pgbouncer-latest.tar docker load -i vadteljsondaemon-latest.tar docker load -i logrotate-latest.tar docker load -i postgres-15.1-alpine.tar docker load -i redis-6.0.16-alpine.tar docker load -i vector-latest.tar.gzExpected outputLoaded image: vadtel-nginx:latest Loaded image: vadtel-app:latest Loaded image: anytelemetry:latest Loaded image: pgbouncer:latest Loaded image: vadteljsondaemon:latest Loaded image: logrotate:latest Loaded image: postgres:15.1-alpine Loaded image: redis:6.0.16-alpine Loaded image: vector:latestCheck if the images are available:
bashdocker imagesOutput structureREPOSITORY TAG vadtel-nginx latest vadtel-app latest anytelemetry latest pgbouncer latest vadteljsondaemon latest logrotate latest postgres 15.1-alpine redis 6.0.16-alpine vector latestIf the images loaded without errors, being in the
/var/lib/unicloudfolder, run the following command:bashdocker-compose up -dCreate a directory in the
/optfolder for thevadtelnewwebapplicationbashsudo mkdir /opt/vadtelnewweb cd /opt/vadtelnewwebAfter that, it is necessary to copy
docker-compose.ymland.envfiles (if not copied earlier for a new installation) to the/opt/vadtelnewwebfolder.For the first run, it is necessary to create a Database, for this purpose execute the following command:
bashdocker-compose run app bundle exec rails db:createExpected outputCreating <project>_db_1 ... done Creating <project>_app_run ... done Created database '<database_name>'Now we can run the application:
bashdocker-compose up -dExpected outputCreating network "unicloud_unicloud-net" ... done Creating <project>_db_1 ... done Creating <project>_app_1 ... done Creating <project>_nginx_1 ... doneTroubleshooting
If an error occurs after running the application:
bashnetwork unicloud_unicloud-net declared as external, but could not be foundThis means that the external network was not created during installation, so you need to perform the initial installation from the
unicloud.tar.tgzarchive, according to instructions.After that, you need to re-run the application:
bashdocker-compose up -dTo check for running containers, execute the following command:
bashdocker psOutput structureCONTAINER ID IMAGE STATUS PORTS NAMES <id> vadtel-nginx Up <uptime> 0.0.0.0:80->80/tcp <project>_nginx_1 <id> vadtel-app Up <uptime> <project>_app_1 <id> postgres Up <uptime> 5432/tcp <project>_db_1Software Update
To upgrade the software, you need to shut down the containers by going to
/opt/vadtelnewweb, and executing the following command:bashdocker-compose downThen, navigate to the
/var/lib/unicloudfolder to perform the following actions:- Stop the
unicloudservice:
bashsudo service unicloud stop- Shutting down the containers:
bashdocker-compose downNext, copy and unpack the necessary compressed image files:
bashgunzip vadtel-nginx-latest.tar.gz gunzip vadtel-app-latest.tar.gz gunzip anytelemetry-latest.tar.gz gunzip pgbouncer-latest.tar.gz gunzip vadteljsondaemon-latest.tar.gz gunzip logrotate-latest.tar.gz gunzip postgres-15.1-alpine.tar.gz gunzip redis-6.0.16-alpine.tar.gz gunzip vector-latest.tar.gzLoad images into Docker:
bashdocker load -i vadtel-nginx-latest.tar docker load -i vadtel-app-latest.tar docker load -i anytelemetry-latest.tar docker load -i pgbouncer-latest.tar docker load -i vadteljsondaemon-latest.tar docker load -i logrotate-latest.tar docker load -i postgres-15.1-alpine.tar docker load -i redis-6.0.16-alpine.tar docker load -i vector-latest.tar.gzExpected outputLoaded image: vadtel-nginx:latest Loaded image: vadtel-app:latest Loaded image: anytelemetry:latest Loaded image: pgbouncer:latest Loaded image: vadteljsondaemon:latest Loaded image: logrotate:latest Loaded image: postgres:15.1-alpine Loaded image: redis:6.0.16-alpine Loaded image: vector:latestChecking the availability of images:
bashdocker imagesOutput structureREPOSITORY TAG vadtel-nginx latest vadtel-app latest anytelemetry latest pgbouncer latest vadteljsondaemon latest logrotate latest postgres 15.1-alpine redis 6.0.16-alpine vector latestIf the images loaded without errors, while in the
/var/lib/unicloudfolder, run the following command:shellsudo service unicloud start docker-compose up -dNext, you need to go to the folder
/opt/vadtelnewweband run the application:shelldocker-compose up -dTo check running containers, run the following command:
bashdocker ps- Stop the
Configuring autoload
Create/edit/copy the configuration file
/etc/docker/daemon.jsonand add the following to it (replacing values if necessary):daemon.json{ "log-driver": "json-file", "log-opts": { "max-size": "50m", "max-file": "3" } }Then we create a script for autostarting the application, for which we will need a file
docker-compose-vadtel.servicewith the contents given below, whereWorkingDirectoryis the path todocker-compose.ymlExecute command:
shellnano /etc/systemd/system/docker-compose-vadtel.servicedocker-compose-vadtel.service[Unit] Description=Docker Compose vadtel Application Service Requires=docker.service After=docker.service StartLimitIntervalSec=60 [Service] WorkingDirectory=/opt/vadtelnewweb ExecStart=/usr/bin/docker-compose up ExecStop=/usr/bin/docker-compose down TimeoutStartSec=0 Restart=on-failure StartLimitBurst=3 [Install] WantedBy=multi-user.targetIn order to activate the autorun script from the
/etc/systemd/system/directory, execute the command:shellsudo systemctl enable docker-compose-vadtelSystem health check
After launching the application, in order to check the system operability, it is necessary to enter the IP address of the server where the application is running in the browser address bar:
bashhttp://127.0.0.1/auth/users/sign_in
Login and password for signing in to the system are specified in the file
/opt/vadtelnewweb/.env.envVADTEL_SUPER_ADMIN_EMAIL= (login) VADTEL_SUPER_ADMIN_PASSWORD= (password)
Чи була ця сторінка корисною?
Дякуємо за відгук!