Image credit: Unsplash

One of the most essential parts of enterprise software development is testing. You need to run a demo of your app to fully understand how it will work in the production mode.

The deployment of a testing infrastructure, including virtual machines for running application demos, can be time- and resource-consuming. This is why we here at 1Ci have implemented a simplified workflow for building a testing infrastructure. Here is how you can create a virtual machine for deploying 1C:Enterprise application demos.

Introduction

This manual describes how to create a VM image for deploying 1C:Enterprise application demos. The image will include:

Ubuntu Server 18.04

1C:Enterprise 8.3.14.1779

PostgreSQL 10.5–24.1С

Apache HTTP Server™ 2.4

You will need Oracle® VirtualBox to create the image.

System requirements

The computer that will run the virtual machine (the host computer) must meet the following requirements:

Any modern Intel® or AMD processor that supports hardware virtualization, with VT enabled in BIOS.

At least 4 GB of RAM, more is better.

20 GB of available disk space.

Support of a 64-bit host operating system.

Support of a guest operating system.

Step 1. Prepare your virtual machine

To prepare a virtual machine, perform the following steps:

Download and install Oracle® VirtualBox on a host computer using this manual. Download Ubuntu Server 18.04 and install it on the virtual machine. Install Oracle VM VirtualBox Guest Additions on the virtual machine: on the Devices menu, point to Optical Drives and click VBoxGuestAdditions.iso. Then, on the Machine menu, click Settings. In the Settings window, click Network. In the Attached to list, select Bridged Adapter. Then run the following commands:

sudo apt-get update

sudo apt-get upgrade

sudo apt-get install ssh

sudo apt-get install virtualbox-guest-additions-iso

reboot

Download and install WinSCP or another FTP client on the virtual machine.

It is handy for moving files from the host computer to the virtual machine. If the language of your 1C:Enterprise server infobase is not English, configure locales on the virtual machine. In the following commands, replace “YOUR_LOCALE” with a matching locale.

sudo locale-gen en_US.UTF-8

sudo locale-gen YOUR_LOCALE

sudo update-locale LANG=YOUR_LOCALE

sudo dpkg-reconfigure locales

In the figures below you can see an example of switching to a Russian locale.

Step 2. Install 1C:Enterprise

To install 1C:Enterprise, perform the following steps:

Obtain the 1C:Enterprise distribution file (deb64_8_3_14_1779.tar.gz) from a local 1Ci partner. Move the 1C:Enterprise distribution file to the /tmp folder of the virtual machine and run the following commands:

cd /tmp

tar -xzf deb64_8_3_14_1779.tar.gz

apt-get -y install gdebi

gdebi 1c-enterprise83-common_8.3.14–1779_amd64.deb

gdebi 1c-enterprise83-server_8.3.14–1779_amd64.deb

gdebi 1c-enterprise83-ws_8.3.14–1779_amd64.deb

gdebi 1c-enterprise83-common-nls__8.3.14–1779_amd64.deb

gdebi 1c-enterprise83-server-nls_8.3.14–1779_amd64.deb

gdebi 1c-enterprise83-ws-nls_8.3.14–1779_amd64.deb

3. Install Microsoft Core fonts:

apt-get -y install ttf-mscorefonts-installer

fc-cache –fv

4. Install the required libraries:

apt-get install libfreetype6 libgsf-1-common unixodbc glib2.0

5. Run the srv1cv83 service:

systemctl start srv1cv83

6. Check whether the service has started:

systemctl status srv1cv83

If the service is running, you will get the following result:

Step 3. Install PostgreSQL

To install PostgreSQL, perform the following steps:

Install libicu55:

apt search libicu55

cd /tmp

wget http://archive.ubuntu.com/ubuntu/pool/main/i/icu/libicu55_55.1-7_amd64.deb

sudo dpkg -i libicu55_55.1–7_amd64.deb

2. Download and install postgresql-common:

apt search postgresql-common

sudo apt install postgresql-common

3. Move the postgresql_10.5_24.1C_amd64_deb.tar.bz2 distribution file to the /tmp folder and run the following commands:

cd /tmp

tar -xvjf postgresql_10.5_24.1C_amd64_deb.tar.bz2

cd ./postgresql-10.5–24.1C_amd64_deb

sudo dpkg -i libpq5_10.5–24.1C_amd64.deb

sudo dpkg -i postgresql-client-10_10.5–24.1C_amd64.deb

sudo dpkg -i postgresql-10_10.5–24.1C_amd64.deb

Step 4. Customize PostgreSQL

To customize PostgreSQL:

To change the authentication rule from “peer” to “trust”, open the config file “pg_hba.conf”:

sudo nano /etc/postgresql/10/main/pg_hba.conf

and change the following line:

local all postgres peer

to:

local all postgres trust

To save your changes, press Ctrl+O. Then restart PostgreSQL.

2. Change the credentials of the “postgres” user:

sudo service postgresql restart

psql -U postgres -d template1 -c “ALTER USER postgres PASSWORD ‘YOUR_PASSWORD’”

where “YOUR_PASSWORD” is the new password for the “postgres” user.

3. To change the authentication rule from “trust” to “md5”, open the config file:

sudo nano /etc/postgresql/10/main/pg_hba.conf

and change the following line:

local all postgres trust

to:

local all postgres md5

Step 5. Create 1C:Enterprise server infobase

You can create a 1C:Enterprise server infobase on the server using the command line. However, this method requires installing a display server, such as “xvfb”. I will describe it in the next article. And now I’ll tell how to create a 1C:Enterprise server infobase using 1C:Enterprise GUI.

To create a 1C:Enterprise server infobase:

Run 1C:Enterprise on your client computer. Click Add, click Create infobase, and then click Next twice. Enter the name of your infobase and click 1C:Enterprise server.

4. Enter the 1C:Enterprise server infobase parameters as shown in the figure below. In the User password field, enter the password of the “postgres” user.

Step 6. Activate a 1C:Enterprise license

To activate a 1C:Enterprise license:

Run 1C:Enterprise version 8.3.14.1779 on your client computer and open your infobase in 1C:Enterprise Development Tools or Designer. Activate your license. The figure shows how to activate a license in Designer.

Step 7. Install Apache HTTP Server

To install Apache HTTP server:

Install apache2:

apt install apache2

2. Check the Apache HTTP Server version:

apache2 -version

You will get the following result::

Check whether the apache2 service is running:

service apache2 status

If the service is running, you will get the following result:

Step 8. Publish the 1C:Enterprise server infobase to the Apache web server

Create a folder for the .vrd file:

mkdir -p /var/www/1c/8.3.14.1779/demo

2. Create an Apache server configuration file:

touch /etc/apache2/conf-available/demo.conf

3. In the command line of your VM, run the following commands:

cd /opt/1C/x8.3/x86_64

./webinst -apache24 -wsdir cloud -dir ‘/var/www/8.3.14.1779/demo’ -connstr “Srvr=localhost;Ref=demo;” -confPath /etc/apache2/conf-available/demo.conf

4. Enable the apache2 configuration file:

a2enconf demo

5. Restart the Apache and 1C:Enterprise services:

sudo service apache2 restart

sudo service srv1cv83 restart

Now you can run your 1C:Enterprise server application in a web browser using the following URL: http://<localhost or your IP address>/cloud.