Deploying iServer in Docker

Feedback


Linux Container Virtualization (LXC) is a lightweight virtualization technique that utilizes kernel virtualization technology to provide lightweight virtualization for isolating processes and resources. Docker extends LXC, providing higher-level API and simplifying application packaging and deployment, creating independent private environments for end users, which can effectively save developers and system administrators' environment deployment time.

SuperMap iServer is now online on Alibaba Cloud and Docker Center (the addresses for obtaining images are registry.cn-beijing.aliyuncs.com/supermap/iserver and supermap/iserver, and it is recommended that you obtain iServer images through Alibaba Cloud). With just a few steps, you can deploy iServer in Docker.

Install Docker

Install Docker in the public network environment

Install Docker Desktop on Windows

1. Enable virtualization of the computer.

Generally, computers are turned on by default. You can check whether virtualization is turned on through "Task Manager → Performance → CPU".

2. Turn on Hyper-V.

Enable Hyper-V to start the virtual machine, which can be set through "Control Panel → Program → Enable or Turn off Windows Functions → Check Hyper-V". After enabling, restart the computer to take effect.

3. visit https://docs.docker.com/desktop/windows/install/, download Docker Desktop。

4. Install Docker Desktop and follow the prompts.

5. Open Docker Desktop and wait for it to be enabled.

If the prompt "Hardware assisted virtualization and data execution protection must be enabled in the BIOS" appears, it may be due to some programs disabling the virtual machine management program.

Solution: Run CMD as an administrator and execute the following command:

bcdedit /set hypervisorlaunchtype auto

When successfully operated, restart the computer and reopen Docker Desktop.

6. When the whale icon in the bottom left corner has a green background, it indicates that Docker is available.

Install Docker on Linux

Install through convenient script

This operation takes CentOS-7-x86_64 as an example. this convenient script is applicable to multiple systems such as CentOS, Debian, Ubuntu, etc. It does not support custom installation configuration. For details, please refer to the official documentation: https://docs.docker.com/engine/install/.

Note: Log in as root or the most privileged user and perform the following operations.

1. Install with convenient script:

curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun

2. After the installation is completed, execute the following command to view the Docker version and confirm that the installation is successful:

docker --version

手动安装

This operation takes Ubuntu_18.04_LTS x86_64 as an example. For Docker installation of other systems, please refer to the official installation document: https://docs.docker.com/engine/install/.

Note: Log in as root or the most privileged user and perform the following operations.

1. Uninstall old versions that may exist:

apt-get remove docker docker-engine docker.io containerd runc

2. Update the apt package index:

apt-get update

3.Install the following packages to make the repository available to apt via HTTPS(repository):

apt-get install -y apt-transport-https ca-certificates curl software-properties-common

4.Add the GPG key and set the stable repository

4.1 Add Docker official GPG key:

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

4.2 Set up the stable repository:

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

4.1 Add Alibaba Cloud GPG key:

curl -fsSL http://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add -

4.2 Set up the stable repository:

add-apt-repository "deb [arch=amd64] http://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable"

5.Update the apt package index again:

apt-get update

6.Install the latest version of Docker CE:

apt-get install -y docker-ce

At this point, the installation of Docker has been completed, and the following command can be used to verify whether it is successful:

docker run hello-world

This command downloads a test file and runs it in a container. When the container runs, it prints some information and automatically exits.

Install Docker offline

For LAN scenarios where the public network cannot be connected, we have collected and produced Docker offline installation packages for common operating systems. If needed, please contact SuperMap Support Center for assistance. You can also refer to the official Docker documentation for installation: https://docs.docker.com/engine/install/binaries/.

When the installation is complete, start Docker:

service docker start

Get iServer image

Note: If it is a Windows system, open CMD (Command Prompt) and perform the operation; If it is a Linux system, it is necessary to log in as root user or the highest privileged user and perform operations.

Obtain SuperMap iServer image in public network environment

  1. Get iServer image

You can obtain an iServer image through Alibaba Cloud.

To pull a specified version of iServer image, you need to enter the corresponding tag. The rules are as follows:

Image tag for Linux X86-64 architecture: [version number] - amd64

Image tag for Linux ARM64 architecture: [version number] - arm64

For example, enter the following command to get the iServer image for the Linux X86-64 architecture 11.2.0 version :

docker pull registry.cn-beijing.aliyuncs.com/supermap/iserver:11.2.0-amd64

Enter the following command to get the iServer image for Linux ARM64 architecture 11.2.0 version:

docker pull registry.cn-beijing.aliyuncs.com/supermap/iserver:11.2.0-arm64

  1. View image information

After the download is complete, you can view the downloaded image information with the following command:

docker images

Get offline SuperMap iServer image

  1. For LAN scenarios that cannot be connected to the public network, you can contact the SuperMap Support Center to obtain an offline iServer image.
  2. Copy the obtained iServer image (*. tar) to an offline environment and import it into Docker

docker load -i *.tar

  1. Check whether the import is successful with the following command:

docker images

Start and use iServer

Run Docker container

Run a Docker container iserver1 based on the obtained iServer image.

docker run --security-opt seccomp=unconfined --name iserver1 -d -p 8090:8090 -v `pwd`/my_opts:/opt/iserverOPTs registry.cn-beijing.aliyuncs.com/supermap/iserver:12.0.0.0-amd64

Among

--name refers to specifying a name for the container. The --name iserver1 indicates that the specified container name is iserver1;

-d refers to run the container in the background and returning the container ID;

-p specifies port mapping, the format of: host port: container port. -p 8090:8090 indicates that the specified mapped host port (externally exposed port) is 8090, and the container port is also 8090;

iServer JAVA-POTS represents the Java memory configuration of iServer

-v represents the mapping data path, in the format of: host path: container path. When setting up a cluster, this parameter can be used to publish services on the primary node. If the master node does not need to publish services, there is no need to use the - v parameter;

registry.cn-beijing.aliyuncs.com/supermap/iserver represents the corresponding image name. If you are obtaining an offline image, you should enter the corresponding image name here. You can view the existing image information of the local repository by using the following command:

docker images

Wait a few seconds and iServer startup completed. Enter http://<Host IP>:8090 in the browser to access iServer.

 Set environment variables (optional)

To use iServer's distributed analytics service, the environment variable distributeanalysmost needs to be set at runtime, where distributeanalysmost corresponds to the IP address inside the container.

docker run --security-opt seccomp=unconfined --name iserver1 -d -p 8090:8090 --env distributeanalysthost="172.17.0.2" -v `pwd`/my_opts:/opt/iserverOPTs registry.cn-beijing.aliyuncs.com/supermap/iserver:12.0.0.0-amd64

 Note: my_opts represents the folder where the data to be mapped from the host to the container is located, which can be customized according to the actual path on your compute, /opt/iserverOPTs is a folder that already exists in the container, used to store all iServer related configuration files.

Publishing GIS services on iServer

In the above steps, the mapping path from the host to the Docker container (-v `pwd`/my_opts:/opt) has been specified through the -v parameter, so the data can be directly placed in a directory on the host (`pwd`/my_opts). Log in to iServer Service Manager and enter the Quick Publish Service Wizard. When browsing remotely, you can directly find the mapped data in the corresponding directory of the container and publish it.

The path mapping method can be used to publish file based GIS data, such as file based workspaces, MBTiles tile packages, etc. For GIS data stored in databases, such as database workspaces, MongoDB tiles, etc., this mapping is not required. It is recommended to deploy the database separately, such as on the host machine or other machines, and make it accessible to all iServer.

Build the iServer cluster based on Docker

The iServer launched in the above example can be used as the cluster master node. Start container son1 as a cluster child node:

docker run --security-opt seccomp=unconfined --name son1 --link iserver1:master -v /home/data:/home registry.cn-beijing.aliyuncs.com/supermap/iserver:12.0.0.0-amd64

<clustering>    

 <reporters>    

   <reporter>    

     <enabled>true</enabled>     

     <address>http://master:8090/iserver/services/cluster</address>         

     <isTileWorker>true</isTileWorker>      

   </reporter>   

  </reporters>      

</clustering>  

After the two containers are started, you can access the service through http://<HOST IP>:8090, and see that the child node has been added on the "cluster" page. The child node can also participate in the graph cutting task as a tile child node.

Enable the cluster service on the master node to use the cluster function.

License configuration

The method for configuring iServer license for Docker deployment is as follows:

-e LICENSE_SERVER= license server IP