SimpleVAT Deployment Documentation

Purpose

This installation and deployment documentation focuses on describing technically the procedure to install and use the SimpleVAT software successfully.

Definitions

Containers - Containers are software that allows applications to work reliably when moved from one computing environment to another.

Docker – Docker is the most popular container engine, open-sourced for developers and administrators to manage, shift, and run applications.

Docker image - Docker image is a template that consists of instructions to conveniently package up applications.

Docker hub - Docker hub is a repository for storing and sharing private or public container images.

MySQL – Open source data base used for web-based applications.

Prerequisites

The following system prerequisites are necessary in prior to the installation of the Docker software:

  • Windows 10 64-bit: Pro

  • Enterprise

  • Education (Build 16299 or later).

The following hardware prerequisites are required to successfully run Docker on Windows 10:

  • 64-bit processor with Second Level Address Translation (SLAT)

  • 4GB system RAM

Docker installation

Docker is to be installed in your system prior to installation of SimpleVAT software.

Windows Docker installation

  1. Download the installation file from docker hub. I will be available in your https://hub.docker.com/editions/community/docker-ce-desktop-windows/

  2. When prompted, ensure the Enable Hyper-V Windows Features option is selected on the Configuration page.

  3. Follow the instructions on the installation wizard to authorize the installer and proceed with the install.

  4. When the installation is successful, click Close to complete the installation process.

  5. After this you need to install Mysql, Navigate to Creating Database Section.

Linux Docker installation

Installing on Ubuntu

Set up the repository

  1. Update the apt package index and install packages to allow apt to use a repository over HTTPS:

$ sudo apt-get update
$ sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
software-properties-common
  1. Add Docker’s official GPG key:

$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add

Verify that you now have the key with the fingerprint 9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88, by searching for the last 8 characters of the fingerprint.

$ sudo apt-key fingerprint 0EBFCD88
pub rsa4096 2017-02-22 [SCEA]
9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88
uid [ unknown] Docker Release (CE deb) <[email protected]>
sub rsa4096 2017-02-22 [S]
  1. Use the following command to set up the stable repository.

$ sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"

Install Docker Engine

  1. Update the apt package index, and install the latest version of Docker Engine and containerd, or go to the next step to install a specific version:

$ sudo apt-get update
$ sudo apt-get install docker-ce docker-ce-cli containerd.io

To install a specific version of Docker Engine, list the available versions in the repo, then select and install:

a. List the versions available in your repo:

$ apt-cache madison docker-ce
docker-ce | 5:18.09.1~3-0~ubuntu-xenial | https://download.docker.com/linux/ubuntu xenial/stable amd64 Packages
docker-ce | 5:18.09.0~3-0~ubuntu-xenial | https://download.docker.com/linux/ubuntu xenial/stable amd64 Packages
docker-ce | 18.06.1~ce~3-0~ubuntu | https://download.docker.com/linux/ubuntu xenial/stable amd64 Packages
docker-ce | 18.06.0~ce~3-0~ubuntu | https://download.docker.com/linux/ubuntu xenial/stable amd64 Packages

b. Install a specific version using the version string from the second column, for example, 5:18.09.1~3-0~ubuntu-xenial

$ sudo apt-get install docker-ce=<VERSION_STRING> docker-ce-cli=<VERSION_STRING> containerd.io

Verify that Docker Engine is installed correctly by running the hello-world image.

$ sudo docker run hello-world

Install On CentOS

Set up the repository

Install the yum-utils package (which provides the yum-config-manager utility) and set up the stable repository.

$ sudo yum install -y yum-utils
$ sudo yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo

Install Docker Engine

  1. Install the latest version of Docker Engine and containerd, or go to the next step to install a specific version:

$ sudo yum install docker-ce docker-ce-cli containerd.io

If prompted to accept the GPG key, verify that the fingerprint matches 060A 61C5 1B55 8A7F 742B 77AA C52F EB6B 621E 9F35, and if so, accept it.

Docker is installed but not started. The docker group is created, but no users are added to the group.

2. To install a specific version of Docker Engine, list the available versions in the repo, then select and install:

a. List and sort the versions available in your repo. This example sorts results by version number, highest to lowest, and is truncated:

$ yum list docker-ce --showduplicates | sort -r
docker-ce.x86_64 3:18.09.1-3.el7 docker-ce-stable
docker-ce.x86_64 3:18.09.0-3.el7 docker-ce-stable
docker-ce.x86_64 18.06.1.ce-3.el7 docker-ce-stable
docker-ce.x86_64 18.06.0.ce-3.el7 docker-ce-stable

The list returned depends on which repositories are enabled, and is specific to your version of CentOS (indicated by the .el7 suffix in this example).

b. Install a specific version by its fully qualified package name, which is the package name (docker-ce) plus the version string (2nd column) starting at the first colon (:), up to the first hyphen, separated by a hyphen (-). For example, docker-ce-18.09.1

$ sudo yum install docker-ce-<VERSION_STRING> docker-ce-cli-<VERSION_STRING> containerd.io

Docker is installed but not started. The docker group is created, but no users are added to the group.

Start Docker.

$ sudo systemctl start docker

Verify that Docker Engine is installed correctly by running the hello-world image.

$ sudo docker run hello-world

This command downloads a test image and runs it in a container. When the container runs, it prints an informational message and exits.

Install On Debian

Set up the repository

  1. Update the apt package index and install packages to allow apt to use a repository over HTTPS:

$ sudo apt-get update
$ sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
software-properties-common
  1. Add Docker’s official GPG key:

$ curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add

Verify that you now have the key with the fingerprint 9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88, by searching for the last 8 characters of the fingerprint.

$ sudo apt-key fingerprint 0EBFCD88
pub 4096R/0EBFCD88 2017-02-22
Key fingerprint = 9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88
uid Docker Release (CE deb) <[email protected]>
sub 4096R/F273FCD8 2017-02-22

Use the following command to set up the stable repository.

$ sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/debian \
$(lsb_release -cs) \
stable"

Install Docker Engine

  1. Update the apt package index, and install the latest version of Docker Engine and containerd, or go to the next step to install a specific version:

$ sudo apt-get update
$ sudo apt-get install docker-ce docker-ce-cli containerd.io

2. To install a specific version of Docker Engine, list the available versions in the repo, then select and install:

a. List the versions available in your repo:

$ apt-cache madison docker-ce
docker-ce | 5:18.09.1~3-0~debian-stretch | https://download.docker.com/linux/debian stretch/stable amd64 Packages
docker-ce | 5:18.09.0~3-0~debian-stretch | https://download.docker.com/linux/debian stretch/stable amd64 Packages
docker-ce | 18.06.1~ce~3-0~debian | https://download.docker.com/linux/debian stretch/stable amd64 Packages
docker-ce | 18.06.0~ce~3-0~debian | https://download.docker.com/linux/debian stretch/stable amd64 Packages

b. Install a specific version using the version string from the second column, for example, 5:18.09.1~3-0~debian-stretch

$ sudo apt-get install docker-ce=<VERSION_STRING> docker-ce-cli=<VERSION_STRING> containerd.io
  • Verify that Docker Engine is installed correctly by running the hello-world image.

$ sudo docker run hello-world

This command downloads a test image and runs it in a container. When the container runs, it prints an informational message and exits.

Creating database

Installing MySQL Shell with the MySQL APT Repository

Make sure you do not skip the step for updating package information for the MySQL APT repository:

sudo apt-get update

Install MySQL Shell with this command:

sudo apt-get install mysql-shell

If you already have the MySQL APT repository as a software repository on your system, do the following:

  • Update package information for the MySQL APT repository:

sudo apt-get update

Update the MySQL APT repository configuration package with the following command:

sudo apt-get install mysql-apt-config

Install MySQL Shell with this command:

sudo apt-get install mysql-shell

Installing MySQL Shell with the MySQL Yum Repository

If you already have the MySQL Yum repository as a software repository on your system but have configured the repository with the old release package mysql-community-release, it is easiest to install MySQL Shell by first reconfiguring the MySQL Yum repository with the new mysql57-community-release package.

To do so, you need to remove your old release package first, with the following command :

sudo yum remove mysql-community-release

For dnf-enabled systems, do this instead:

sudo dnf erase mysql-community-release

Then, follow the steps given in Adding the MySQL Yum Repository to install the new release package, mysql57-community-release.

Enable the MySQL Tools Preview subrepository. You can do that by editing manually the /etc/yum.repos.d/mysql-community.repo file. This is an example of the subrepository's default entry in the file (the baseurl entry in your file might look different, depending on your Linux distribution)

[mysql-tools-preview]
name=MySQL Tools Preview
baseurl=http://repo.mysql.com/yum/mysql-tools-preview/el/6/$basearch/
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql

Change the entry enabled=0 to enabled=1 to enable the subrepository.

Install MySQL Shell with this command:

sudo yum install mysql-shell

For dnf-enabled systems, do this instead:

sudo dnf install mysql-shell

Connecting to Mysql Server

Now that Mysql is installed, you need to connect to the server and create your database

shell> mysql -h host -u user -p
Enter password: ********

If that works, you should see some introductory information followed by a mysql> prompt:

shell> mysql -h host -u user -p
Enter password: ********
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 25338 to server version: 5.7.32-standard
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>

Now you need to create a Database

mysql> CREATE DATABASE simplevat_db;
Once the database is created, you need to assign all privileges to Mysql user
mysql> CREATE USER 'simplevat_db_user'@'%' IDENTIFIED BY 'SimpleVat123$';
mysql> GRANT ALL PRIVILEGES ON simplevat_db.* TO 'simplevat_db_user'@'%';
mysql> FLUSH PRIVILEGES;
mysql> QUIT
Bye

Now that docker is installed and Mysql is configured we will now pull simplevat form Docker hub and run it in your machine.

Please keep a note of the database name, database username and password and it will be required in the next step.

Run Docker

Once the database is created, input the Docker commands which are needed to run the SimpleVAT application.

Open a command prompt and perform the following commands:

(to check the docker version)

docker -v

Now we will pull the simplevat docker image from https://hub.docker.com/r/datainn/simplevat

Use the below command to perform this operation

docker pull datainn/simplevat

Now that you have successfully pulled the docker image, we will now run the docker image

Use the below command to perform this operation

docker run -p 8080:8080 --env SIMPLEVAT_DB_HOST=127.0.0.1 --env SIMPLEVAT_DB=simplevat_db --env SIMPLEVAT_DB_USER=simplevat_new_user --env SIMPLEVAT_DB_PASSWORD=SimpleVat123$ --env SIMPLEVAT_HOST=http://localhost:8080/ datainn/simplevat