Deploy iServer in Docker |
Linux Container virtual technology is a light-weight virtual method. It leverages kernel virtualization to provide lightweight virtualization for thread and resources isolation. Docker extends LXC, provides a higher level of APIs, simplifies application packaging and deployment, and creates an independent private environment for end users, saving deployment time for developers and system administrators.
SuperMap iServer is now available in the Docker Center. Here is downloading address: http://hub.docker.com/r/supermap/iserver.. You can deploy iServer in Docker in just a few steps.
Taking Ubuntu Wily 15.10 as an example, we will introduce you how to deploy and run iServer in Docker.
The following operations needs root user or the highest authority user to login.
When you download and install the package using apt-get, you first need to update the source and install apt-transport-https to ensure that the system can download the required files correctly. Execute the following commands to finish the operations:
apt-get update
apt-get install apt-transport-https ca-certificates
sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
Go to the /etc/apt/sources.list.d directory and create a new docker.list file which is used to add Docker to the apt software installation source:
cd /etc/apt/sources.list.d
vi docker.list
Add the followings in the docker.list file:
deb https://apt.dockerproject.org/repo ubuntu-wily main
Update the APT package index and confirm that APT is getting the file from the correct repository:
apt-get update
apt-get purge lxc-docker
apt-cache policy docker-engine
For Ubuntu system, it is recommended to install linux-image-extra package:
sudo apt-get install linux-image-extra-$(uname -r)
Install Docker and start:
sudo apt-get install docker-engine
sudo service docker start
Verify that the Docker was installed successfully. This command downloads a test file and runs it in a container. When the container is running, it will print some information and exit automatically.
sudo docker run hello-world
As the docker's mirror center is abroad, the download speed is slow. Recommend using the Ali cloud accelerator: https://help.aliyun.com/knowledge_detail/5974865.html. If your operating system is ubuntu, you can use the following script to add the configuration of the mirror to the startup parameters of docker daemon, then restart the Docker.
echo "DOCKER_OPTS=\"--registry-mirror=https://hqsuattf.mirror.aliyuncs.com\"" | sudo tee -a /etc/default/docker
sudo service docker restart
Execute the following command in the Docker host to download the latest iServer mirror:
docker pull supermap/iserver
Once the download is complete, you can view the downloaded image information with the following command:
docker images
Based on the downloaded iServer mirror, run a Docker container iserver1. Execute the following command:
docker run --name iserver1 -d -p 8090:8090 -v /home/data:/home supermap/iserver
Where, -p 8090:8090 indicates that the external exposure port number is 8090. -v indicates mapping data path. When you build a cluster, -v is used for publishing services on the master node. If the master node does not need to publish the service, you do not need to use the -v parameter.
Waiting a few seconds until iServer starts up. In the browser, please enter http: // <host IP>: 8090, you can access iServer.
Note: To use the distributed anaysis service of iServer, you need to set environment variable "distributeanalysthost" when running. "distributeanalysthost" corresponds to the internal ip of the container. Below shows the command:
docker run --name iserver1 -d -p 8090:8090 --env distributeanalysthost="172.17.0.2" -v /home/data:/home supermap/iserver
In the above steps, the mapping path from the host to the Docker container (-v /home/data:/home) has been specified with the -v parameter, so you can place the data directly in a directory on the host machine (/home/data). Log in to iServer Manager, enter the Quickly Publish Services Wizard. With remote browsing, you can directly find the mapping data in the container directory (/home) and publish them.
Path mapping approach can be used to publish file type GIS data, such as file-based workspace, MBTiles tile package and so on. For GIS data stored in the database, such as database workspaces, MongoDB tiles, this mapping is not required. It is recommended that the database be deployed separately, such as on a host or other machine, and make sure that all iServer can access this database.
You can use the iServer that was started in the example above as the cluster master. Start the container son1 as a cluster sub-node:
docker run --name son1 --link iserver1:master -v /home/data:/home supermap/iserver
After the two containers are started, you can access the services via http://<host IP>: 8090 and see that the child node has been added on the "Clusters" page. The child node can also be used as a tiling node to participate in map tiling.
You can use the cluster function by enabling the cluster service on the master node.
If you want to start multiple Docker, namely starting multiple iServer on a host machine which has been configured the official license, you can choose the license modules to be used when initially configuring the iServer. For details, see: Enable Licensing.