Linux Docker deployment
Hideez Enterprise Server on Linux Docker
This instruction shows how to install the HES server using docker containers on Linux. Examples of commands are given for CentOS (7,8) and Ubuntu (18.04, 20.04) , other versions of the Linux was not tested.
First of all, you need to decide what URL will be for your future HES server. It can be something like hideez.yurcompany.com. Hereinafter, this name is indicated as <your_domain_name>. You can copy this instruction into any text editor and replace all instances of the <your_domain_name> with your name. After that, you can execute most of the commands just copying them from the editor.
You need to add your domain name to the DNS settings of your hosting provider.

1. Preparation (if not already done)

Install Docker

You can also always refer to the official installation documentation: https://docs.docker.com/engine/install
CentOS
1
$ sudo yum install -y yum-utils
2
$ sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
3
$ sudo yum install -y docker-ce docker-ce-cli containerd.io
4
$ sudo systemctl start docker
5
$ sudo systemctl enable docker
Copied!
in case of unsuccessful installation, on Centos 8, you may need to remove some packages
1
$ sudo yum remove podman buildah -y
Copied!
and retry the installation
Ubuntu
1
$ sudo apt-get install -y apt-transport-https ca-certificates curl gnupg lsb-release
2
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
3
$ sudo echo \
4
"deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
5
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
6
$ sudo apt update
7
$ sudo apt install docker-ce -y
Copied!
To verify installed docker version run the following command:
1
$ docker --version
2
Docker version 20.10.10, build b485636
Copied!

Install Docker Compose

You can also always refer to the official installation documentation: https://docs.docker.com/compose/install/
1
$ sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
2
$ sudo chmod +x /usr/local/bin/docker-compose
Copied!
Note: Replace “1.29.2” with docker compose version that you want to install but at this point of time this is the latest and stable version of the docker compos. You can see all releases of docker-compose here.
Test the installation.
1
$ sudo docker-compose --version
2
docker-compose version 1.29.2, build 5becea4c
Copied!
in some cases (CentOS), if you can't start docker-compose from sudo (sudo: docker-compose: command not found), you need to create a link in /usr/bin/
1
$ sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
Copied!

2. Іnstalling HES in the docker

Download templates

We have prepared an archive with a template for building containers
1
$ cd ~
2
$ curl -O https://update.hideez.com/hes/docker_latest.tar.gz
Copied!

Extracting files and moving to the /opt directory and create folders for HES

1
$ tar -xvf docker_latest.tar.gz
2
$ sudo mv HES /opt/
Copied!

Build docker image

1
$ cd /opt/HES/
2
$ sudo docker build . -t hes
Copied!

Configure the HES

Copy file to /opt/HES/hes-site/appsettings.json to /opt/HES/hes-site/appsettings.Production.json :
1
$ sudo cp /opt/HES/hes-site/appsettings.json /opt/HES/hes-site/appsettings.Production.json
Copied!
The file /opt/HES/hes-site/appsettings.Production.json contains configuration and security settings, required to run the HES server.
А detailed description of the parameters of this file can be found on this page.
To start the container edit the file /opt/HES/hes-site/appsettings.Production.json, it is enough to change only the parameter in "DefaultConnection"
1
"ConnectionStrings": {
2
"DefaultConnection": "server=127.0.0.1;port=3306;database=db;uid=user;pwd=password"
3
},
Copied!
server=127.0.0.1 change here to server=hes-db
Your setting should look like this:
1
"ConnectionStrings": {
2
"DefaultConnection": "server=hes-db;port=3306;database=db;uid=user;pwd=password"
3
},
Copied!
WARNING! This names must be the same as the MySQL container name in the /opt/HES/docker-compose.yml
server - name of mysql server.
port - put here "3306". This is default value.
database - name of the DB (e.g. "db").
uid - username to access the DB (e.g. "user").
pwd - user password to access the DB. (default "password")

Configure the Docker (Optional)

Open the /opt/HES/docker-compose.yml file for editing. In this file you need to modify several parameters:
MYSQL_DATABASE - put here the same name as database in appsettings.Production.json (e.g. "db").
MYSQL_USER - put here the same name as uid in appsettings.Production.json (e.g. "user").
MYSQL_PASSWORD - put here the same password as password in appsettings.Production.json
MYSQL_ROOT_PASSWORD - put here the password for mysql root account. (default is "password")

Configure the Nginx (Optional)

Open the /opt/HES/nginx/nginx.conf file for editing. Uncoment and replace all instances of <your_domain_name> with your name.

Create a SSL Certificate

Here we providing instruction on how to get a self-signed certificate for SSL encryption. It can be used for test or demo purposes. For the production server, you need to acquire a certificate from a certificate authority. For a self-signed certificate, the browser will alert you that the site has security issues.
Run the following command and answer a few simple questions:
1
$ sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /opt/HES/nginx/certs/hes.key -out /opt/HES/nginx/certs/hes.crt
Copied!
The certificate will be generated and copied to the HES directory.

Run the Server

Finally, when config files updated and certificate ready you can run the server:
1
$ cd /opt/HES
2
$ sudo docker-compose up -d
Copied!
after uploading the images, your server is ready to work

Check the status

You can check the status of the docker containers running the command:
1
$ sudo docker-compose ps
2
Name Command State Ports
3
---------------------------------------------------------------------------------------------------------------------------
4
hes-db docker-entrypoint.sh --def ... Up 0.0.0.0:3306->3306/tcp,:::3306->3306/tcp, 33060/tcp
5
hes-nginx /docker-entrypoint.sh ngin ... Up 0.0.0.0:443->443/tcp,:::443->443/tcp, 0.0.0.0:80->80/tcp,:::80->80/tcp
6
hes-site ./HES.Web Up 5000/tcp
Copied!
To make sure that everything is configured correctly, open the URL of your site in a browser (https://<your_domain_name>). You should see the server authorization page. Log in using the default login '[email protected]' and default password 'admin'.
In case you cannot log in to the HES, see log files located in '/opt/HES/hes-site/logs'

3. How to update HES server

(Optimal) Backup the MySQL Database (for possible further recovery)) :
The following command will create a copy of the database (dump) in file db.sql in /opt/HES.old directory (on host) from container with name hes-db:
1
$ sudo mkdir /opt/HES.old
2
$ cd /opt/HES/
3
$ sudo sh -c "docker exec hes-db /usr/bin/mysqldump -u root --password=password db > /opt/HES.old/db.sql"
Copied!

Stop containers:

1
$ cd /opt/HES/
2
$ sudo docker-compose down
Copied!
(Optimal) Save the image of HES to a tar file (for possible further recovery):
1
$ sudo docker save -o /opt/HES.old/hes.tar hes
Copied!

Remove image of HES:

1
$ sudo docker rmi hes --force
Copied!
To upgrade the server to the latest version, run commands:
1
$ sudo docker build . -t hes
Copied!
and Restart containers:
1
$ sudo docker-compose up -d
Copied!

If something goes wrong, you can restore the HES server using the following commands:

Stop containers:
1
$ cd /opt/HES/
2
$ sudo docker-compose down
Copied!
Remove image of HES:
1
$ sudo docker rmi hes --force
Copied!
Start MySQL container only:
1
$ sudo docker-compose up -d hes-db
Copied!
Restore the MySQL Database from dump file:
1
$ sudo cat /opt/HES.old/db.sql | sudo docker exec -i hes-db /usr/bin/mysql -u root --password=password db
2
$ sudo docker-compose down
Copied!
Restore old image of HES from tar file:
1
$ sudo docker load -i /opt/HES.old/hes.tar
Copied!
and start containers:
1
$ sudo docker-compose up -d
Copied!

After checking that the update was successful and everything works fine, you can delete copies of the database and server:

1
$ sudo rm -rf /opt/HES.old
Copied!
Last modified 1mo ago