geoserver-cloud的docker镜像使用
作者:互联网
介绍
geoserver官方推出了geoserver-cloud版本, 目前还处于研发阶段, 最新版本是1.0-RC19, 这里根据官方说明, 说下docker镜像使用方法
使用前提
需要联网
需要安装docker 版本>=19.03.3
需要安装docker-compose 版本>= 1.26.2
下载docker-compose.yml
geoserver-cloud目前支持两种配置方式, 一种是目录配置文件, 一种是存到数据库里
共享目录配置
wget "http://geoserver.org/geoserver-cloud/deploy/docker-compose/stable/shared_datadir/docker-compose.yml"
如果不能下载可以手动创建docker-compose.yml, 把下面的文本粘贴到文件里
version: "3.8"
volumes:
# a volume to host the shared data directory. Mount it at /opt/app/data_directory, since
# /opt/app is owned by the user geo:geo (603:603) in the containers. Otherwise it'd be owned by root
# uncomment the driver_opts entry to bind mount an existing datadirectory and set the device: <path>
# accordingly to the location of the data directory in the host
shared_data_directory:
#driver_opts:
#type: none
#o: bind
#device: $PWD/datadir
rabbitmq_data: # volume for rabbitmq data, so it doesn't create an anonymous one on each container
geowebcache_data: # used by gwc and web-ui to locate the default gwc tile cache directory
networks:
gs-cloud-network:
services:
rabbitmq:
image: rabbitmq:3.9-management
user: 1000:1000 # set the userid:groupid the container runs as
restart: always
volumes:
- rabbitmq_data:/var/lib/rabbitmq
networks:
- gs-cloud-network
deploy:
resources:
limits:
cpus: '2.0'
memory: 1G
# Eureka service discovery. This is a Discovery First Bootstrap configuration.
# The discovery service is the only fixed entry point.
# Browse to http://localhost:8761 to check all services are registered.
# Run docker-compose -f docker-compose.yml -f docker-compose-discovery-ha.yml to run extra discovery service instances for HA
discovery:
image: geoservercloud/geoserver-cloud-discovery:1.0-RC19
user: 1000:1000 # set the userid:groupid the container runs as
ports:
- 8761:8761
networks:
- gs-cloud-network
restart: always
deploy:
resources:
limits:
cpus: '2.0'
memory: 512M
# Spring Cloud Config service, provides centralized configuration to all
# microservices. Being a Discovery First Bootstrap configuration, it'll
# register itself with the Eureka discovery service and can be scaled
config:
image: geoservercloud/geoserver-cloud-config:1.0-RC19
user: 1000:1000 # set the userid:groupid the container runs as
depends_on:
- discovery
- rabbitmq
environment:
# Either 'git' or 'native'. Use the default sample git repository to download the services configuration from
# If 'git', BEWARE config server will look for a branch called "master", and github changed the default branch name to "main"
# For more information, see https://cloud.spring.io/spring-cloud-config/multi/multi__spring_cloud_config_server.html#_git_backend
SPRING_PROFILES_ACTIVE: git
# 'git' profile config
CONFIG_GIT_URI: https://github.com/geoserver/geoserver-cloud-config.git
# get the config for this release from the v1.0-RC19 tag
SPRING_CLOUD_CONFIG_SERVER_GIT_DEFAULT_LABEL: v1.0-RC19
# where to store the cloned repository, if unset, it'll use /tmp/config-repo-<randomid>
CONFIG_GIT_BASEDIR: /tmp/git_config
# 'native' profile config
CONFIG_NATIVE_PATH: /tmp/config
# avoid stack trace due to jgit not being able of creating a .config dir at $HOME
XDG_CONFIG_HOME: /tmp
networks:
- gs-cloud-network
# Uncoment to bind to a local filesystem directory if using the 'native' profile
#volumes:
# - ./config:/tmp/config
deploy:
resources:
limits:
cpus: '2.0'
memory: 512M
admin:
image: geoservercloud/geoserver-cloud-admin-server:1.0-RC19
user: 1000:1000 # set the userid:groupid the container runs as
depends_on:
- config
ports:
- 9091:8080
networks:
- gs-cloud-network
deploy:
resources:
limits:
cpus: '2.0'
memory: 1G
# Application facade, provides a single entry point routing to all
# microservices (e.g. http://localhost:9090/geoserver/wms, http://localhost:9090/geoserver/wfs, etc)
gateway:
image: geoservercloud/geoserver-cloud-gateway:1.0-RC19
user: 1000:1000 # set the userid:groupid the container runs as
depends_on:
- config
environment:
SPRING_PROFILES_ACTIVE: "datadir"
ports:
- 9090:8080
networks:
- gs-cloud-network
deploy:
resources:
limits:
cpus: '4.0'
memory: 1G
# WFS microservice, port dynamically allocated to allow scaling (e.g docker-compose scale wfs=5)
wfs:
image: geoservercloud/geoserver-cloud-wfs:1.0-RC19
user: 1000:1000 # set the userid:groupid the container runs as
depends_on:
- config
environment:
SPRING_PROFILES_ACTIVE: "datadir"
GEOSERVER_DATA_DIR: /opt/app/data_directory
volumes:
- shared_data_directory:/opt/app/data_directory
networks:
- gs-cloud-network
deploy:
resources:
limits:
cpus: '2.0'
memory: 1G
# WMS microservice, port dynamically allocated to allow scaling (e.g docker-compose scale wms=5)
wms:
image: geoservercloud/geoserver-cloud-wms:1.0-RC19
user: 1000:1000 # set the userid:groupid the container runs as
depends_on:
- config
environment:
SPRING_PROFILES_ACTIVE: "datadir"
GEOSERVER_DATA_DIR: /opt/app/data_directory
volumes:
- shared_data_directory:/opt/app/data_directory
networks:
- gs-cloud-network
deploy:
resources:
limits:
cpus: '2.0'
memory: 1G
# WCS microservice, port dynamically allocated to allow scaling (e.g docker-compose scale wcs=5)
wcs:
image: geoservercloud/geoserver-cloud-wcs:1.0-RC19
user: 1000:1000 # set the userid:groupid the container runs as
depends_on:
- config
environment:
SPRING_PROFILES_ACTIVE: "datadir"
GEOSERVER_DATA_DIR: /opt/app/data_directory
volumes:
- shared_data_directory:/opt/app/data_directory
networks:
- gs-cloud-network
deploy:
resources:
limits:
cpus: '2.0'
memory: 1G
# REST config microservice, port dynamically allocated to allow scaling (e.g docker-compose scale rest=5)
rest:
image: geoservercloud/geoserver-cloud-rest:1.0-RC19
user: 1000:1000 # set the userid:groupid the container runs as
depends_on:
- config
environment:
SPRING_PROFILES_ACTIVE: "datadir"
GEOSERVER_DATA_DIR: /opt/app/data_directory
volumes:
- shared_data_directory:/opt/app/data_directory
networks:
- gs-cloud-network
deploy:
mode: replicated
replicas: 1
resources:
limits:
cpus: '1.5'
memory: 1G
# WEB UI microservice
webui:
image: geoservercloud/geoserver-cloud-webui:1.0-RC19
user: 1000:1000 # set the userid:groupid the container runs as
depends_on:
- config
environment:
SPRING_PROFILES_ACTIVE: "datadir"
GEOSERVER_DATA_DIR: /opt/app/data_directory
GEOWEBCACHE_CACHE_DIR: /data/geowebcache
volumes:
- shared_data_directory:/opt/app/data_directory
- geowebcache_data:/data/geowebcache
networks:
- gs-cloud-network
deploy:
resources:
limits:
cpus: '2.0'
memory: 1G
gwc:
image: geoservercloud/geoserver-cloud-gwc:1.0-RC19
user: 1000:1000 # set the userid:groupid the container runs as
depends_on:
- config
environment:
SPRING_PROFILES_ACTIVE: "datadir"
GEOSERVER_DATA_DIR: /opt/app/data_directory
GEOWEBCACHE_CACHE_DIR: /data/geowebcache
networks:
- gs-cloud-network
volumes:
- shared_data_directory:/opt/app/data_directory
- geowebcache_data:/data/geowebcache
deploy:
resources:
limits:
cpus: '2.0'
memory: 1G
数据库方式配置
wget "http://geoserver.org/geoserver-cloud/deploy/docker-compose/stable/jdbcconfig/docker-compose.yml"
同样地, 如果不能下载可以手动创建docker-compose.yml, 把下面的文本粘贴到文件里
version: "3.8"
volumes:
postgresql_config_data: # volume for postgresql data, used to store the geoserver config through jdbcconfig
rabbitmq_data: # volume for rabbitmq data, so it doesn't create an anonymous one on each container
geowebcache_data: # used by gwc and web-ui to locate the default gwc tile cache directory
networks:
gs-cloud-network:
services:
rabbitmq:
image: rabbitmq:3.9-management
user: 1000:1000 # set the userid:groupid the container runs as
restart: always
volumes:
- rabbitmq_data:/var/lib/rabbitmq
networks:
- gs-cloud-network
deploy:
resources:
limits:
cpus: '2.0'
memory: 1G
database:
# be sure geoserver.backend.jdbcconfig.initdb is set to true in application.yml at lease for the first app run
image: postgres:13-alpine
environment:
POSTGRES_DB: geoserver_config
POSTGRES_USER: geoserver
POSTGRES_PASSWORD: geo5erver
networks:
- gs-cloud-network
volumes:
- postgresql_config_data:/var/lib/postgresql/data
deploy:
resources:
limits:
cpus: '2.0'
memory: 1G
# Eureka service discovery. This is a Discovery First Bootstrap configuration.
# The discovery service is the only fixed entry point.
# Browse to http://localhost:8761 to check all services are registered.
# Run docker-compose -f docker-compose.yml -f docker-compose-discovery-ha.yml to run extra discovery service instances for HA
discovery:
image: geoservercloud/geoserver-cloud-discovery:1.0-RC19
user: 1000:1000 # set the userid:groupid the container runs as
ports:
- 8761:8761
networks:
- gs-cloud-network
restart: always
deploy:
resources:
limits:
cpus: '2.0'
memory: 512M
# Spring Cloud Config service, provides centralized configuration to all
# microservices. Being a Discovery First Bootstrap configuration, it'll
# register itself with the Eureka discovery service and can be scaled
config:
image: geoservercloud/geoserver-cloud-config:1.0-RC19
user: 1000:1000 # set the userid:groupid the container runs as
depends_on:
- discovery
- rabbitmq
- database
environment:
# Either 'git' or 'native'. Use the default sample git repository to download the services configuration from
# If 'git', BEWARE config server will look for a branch called "master", and github changed the default branch name to "main"
# For more information, see https://cloud.spring.io/spring-cloud-config/multi/multi__spring_cloud_config_server.html#_git_backend
SPRING_PROFILES_ACTIVE: git
# 'git' profile config
CONFIG_GIT_URI: https://github.com/geoserver/geoserver-cloud-config.git
# get the config for this release from the v1.0-RC19 tag
SPRING_CLOUD_CONFIG_SERVER_GIT_DEFAULT_LABEL: v1.0-RC19
# where to store the cloned repository, if unset, it'll use /tmp/config-repo-<randomid>
CONFIG_GIT_BASEDIR: /tmp/git_config
# 'native' profile config
CONFIG_NATIVE_PATH: /tmp/config
# avoid stack trace due to jgit not being able of creating a .config dir at $HOME
XDG_CONFIG_HOME: /tmp
networks:
- gs-cloud-network
# Uncoment to bind to a local filesystem directory if using the 'native' profile
#volumes:
# - ./config:/tmp/config
deploy:
resources:
limits:
cpus: '2.0'
memory: 512M
admin:
image: geoservercloud/geoserver-cloud-admin-server:1.0-RC19
user: 1000:1000 # set the userid:groupid the container runs as
depends_on:
- config
ports:
- 9091:8080
networks:
- gs-cloud-network
deploy:
resources:
limits:
cpus: '2.0'
memory: 1G
# Application facade, provides a single entry point routing to all
# microservices (e.g. http://localhost:9090/geoserver/wms, http://localhost:9090/geoserver/wfs, etc)
gateway:
image: geoservercloud/geoserver-cloud-gateway:1.0-RC19
user: 1000:1000 # set the userid:groupid the container runs as
depends_on:
- config
environment:
SPRING_PROFILES_ACTIVE: "jdbcconfig"
ports:
- 9090:8080
networks:
- gs-cloud-network
deploy:
resources:
limits:
cpus: '4.0'
memory: 1G
# WFS microservice, port dynamically allocated to allow scaling (e.g docker-compose scale wfs=5)
wfs:
image: geoservercloud/geoserver-cloud-wfs:1.0-RC19
user: 1000:1000 # set the userid:groupid the container runs as
depends_on:
- config
environment:
SPRING_PROFILES_ACTIVE: "jdbcconfig"
networks:
- gs-cloud-network
deploy:
resources:
limits:
cpus: '2.0'
memory: 1G
# WMS microservice, port dynamically allocated to allow scaling (e.g docker-compose scale wms=5)
wms:
image: geoservercloud/geoserver-cloud-wms:1.0-RC19
user: 1000:1000 # set the userid:groupid the container runs as
depends_on:
- config
environment:
SPRING_PROFILES_ACTIVE: "jdbcconfig"
networks:
- gs-cloud-network
deploy:
resources:
limits:
cpus: '2.0'
memory: 1G
# WCS microservice, port dynamically allocated to allow scaling (e.g docker-compose scale wcs=5)
wcs:
image: geoservercloud/geoserver-cloud-wcs:1.0-RC19
user: 1000:1000 # set the userid:groupid the container runs as
depends_on:
- config
environment:
SPRING_PROFILES_ACTIVE: "jdbcconfig"
networks:
- gs-cloud-network
deploy:
resources:
limits:
cpus: '2.0'
memory: 1G
# REST config microservice, port dynamically allocated to allow scaling (e.g docker-compose scale rest=5)
rest:
image: geoservercloud/geoserver-cloud-rest:1.0-RC19
user: 1000:1000 # set the userid:groupid the container runs as
depends_on:
- config
environment:
SPRING_PROFILES_ACTIVE: "jdbcconfig"
networks:
- gs-cloud-network
deploy:
mode: replicated
replicas: 1
resources:
limits:
cpus: '1.5'
memory: 1G
# WEB UI microservice
webui:
image: geoservercloud/geoserver-cloud-webui:1.0-RC19
user: 1000:1000 # set the userid:groupid the container runs as
depends_on:
- rabbitmq
environment:
SPRING_PROFILES_ACTIVE: "jdbcconfig"
GEOWEBCACHE_CACHE_DIR: /data/geowebcache
networks:
- gs-cloud-network
deploy:
resources:
limits:
cpus: '2.0'
memory: 1G
gwc:
image: geoservercloud/geoserver-cloud-gwc:1.0-RC19
user: 1000:1000 # set the userid:groupid the container runs as
depends_on:
- config
environment:
SPRING_PROFILES_ACTIVE: "jdbcconfig"
GEOWEBCACHE_CACHE_DIR: /data/geowebcache
networks:
- gs-cloud-network
volumes:
- geowebcache_data:/data/geowebcache
deploy:
resources:
limits:
cpus: '2.0'
memory: 1G
拉取镜像
在docker-compose.yml的所在的目录下, 输入
docker-compose pull
等待下载完成
$ docker-compose pull
Pulling rabbitmq ... done
Pulling database ... done
Pulling discovery ... done
Pulling config ... done
Pulling gateway ... done
Pulling catalog ... done
Pulling wfs ... done
Pulling wms ... done
Pulling wcs ... done
Pulling rest ... done
Pulling webui ... done
启动容器
docker-compose --compatibility up -d
测试
输入 服务器ip:8761可以看到下边的界面
由于我的服务器端口冲突了, 我这里的注册中心端口是8001 网关端口是8003
直接访问
localhost:8003/web
可以看到下面的界面, 输入用户名admin 密码geoserver即可登录
销毁服务
如果不想使用了, 可以在docker-compose.yml文件所在目录输入命令
docker-compose down
注意: 该命令会销毁容器以及数据, 谨慎操作
标签:config,geoserver,docker,data,cloud,1000 来源: https://www.cnblogs.com/iminifly/p/16310031.html