Deploying iServer in Docker |
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.
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.
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.
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
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.
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
After the download is complete, you can view the downloaded image information with the following command:
docker images
docker load -i *.tar
docker images
Run a Docker container iserver1 based on the obtained iServer image.
If you downloaded the image from Alibaba Cloud, execute the following command to obtain the Linux X86-64 architecture 12.0.0.0 version image as an example:
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.
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.
If you downloaded the Linux X86-64 architecture 12.0.0.0 version image from Alibaba Cloud, execute the following command:
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.
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.
The iServer launched in the above example can be used as the cluster master node. Start container son1 as a cluster child node:
If you downloaded the Linux X86-64 architecture 12.0.0.0 version image from Alibaba Cloud, execute the following command:
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
Child nodes do not need to expose their port numbers to the outside world. They can use the internal IP of container son1 to access services within the host machine, publish services, and join the cluster. The IP of the cluster master node corresponds to the alias master. You can also manually join the cluster by modifying the iserver-system.xml of the child nodes. The modifications are as follows:
<clustering>
<reporters>
<reporter>
<enabled>true</enabled>
<address>http://master:8090/iserver/services/cluster</address>
<isTileWorker>true</isTileWorker>
</reporter>
</reporters>
</clustering>
The format of the link parameter is --link name:alias,here --link iserver1:master means to connect the container to iserver1 container and set the alias for iserver1 as master. Alias can be freely specifie.
-v mapping data paths to facilitate publishing services on child nodes
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.
The method for configuring iServer license for Docker deployment is as follows:
The normal license configuration process:
To use a file license, the container adaptation license file needs to be placed in the container LICENSE_DIR (default is /opt/SuperMap/License) directory, and the container hostname should be consistent with the one recorded in the license file
To use the network lock hardware license, you need to add:
-e LICENSE_SERVER= license server IP
Cloud license configuration process: Please refer to the introduction in the cloud license section.
Web License configuration process: Please refer to the introduction in the Web License .