This article introduces the use of docker to deploy the Apache ShenYu gateway.
Before you read this document, you need to complete some preparations before deploying Shenyu according to the Deployment Prerequisites document.
docker pull apache/shenyu-admin:${current.version}
docker network create shenyu
h2 to store data:docker run -d -p 9095:9095 --net shenyu apache/shenyu-admin:${current.version}
MySQL to store data, follow the guide document to initialize the database, copy mysql-connector.jar to /$(your_work_dir)/ext-lib:docker run -v /${your_work_dir}/ext-lib:/opt/shenyu-admin/ext-lib \
-e "SPRING_PROFILES_ACTIVE=mysql" \
-e "spring.datasource.url=jdbc:mysql://${your_ip_port}/shenyuuseUnicode=true&characterEncoding=utf8 \
&useSSL=false&serverTimezone=Asia/Shanghai&zeroDateTimeBehavior=convertToNull" \
-e "spring.datasource.username=${your_username}" \
-e "spring.datasource.password=${your_password}" \
-d -p 9095:9095 --net shenyu apache/shenyu-admin:${current.version}
another way is to put the application.yml、application-mysql.yml configuration in ${your_work_dir}/conf from Configure address , modify the configuration spring.profiles.active = mysql in application.yml, and then execute the following statement:
docker run -v ${your_work_dir}/conf:/opt/shenyu-admin/conf \
-v /${your_work_dir}/ext-lib:/opt/shenyu-admin/ext-lib \
-d -p 9095:9095 --net shenyu apache/shenyu-admin:${current.version}
PostgreSql to store data, follow the guide document to initialize the database, execute the following statement:docker run -e "SPRING_PROFILES_ACTIVE=pg" \
-e "spring.datasource.url=jdbc:postgresql://${your_ip_port}/shenyu?useUnicode=true&characterEncoding=utf-8&useSSL=false" \
-e "spring.datasource.username=${your_username}" \
-e "spring.datasource.password=${your_password}" \
-d -p 9095:9095 --net shenyu apache/shenyu-admin:${current.version}
another way is to put the application.yml、application-pg.yml configuration in ${your_work_dir}/conf, modify the configuration spring.profiles.active = pg in application.yml,and then execute the following statement:
docker run -v ${your_work_dir}/conf:/opt/shenyu-admin/conf \
-d -p 9095:9095 --net shenyu apache/shenyu-admin:${current.version}
Oracle to store data, follow the guide document to initialize the database, execute the following statement:docker run -e "SPRING_PROFILES_ACTIVE=oracle"
-e "spring.datasource.url=jdbc:oracle:thin:@localhost:1521/shenyu" \
-e "spring.datasource.username=${your_username}" \
-e "spring.datasource.password=${your_password}" \
-d -p 9095:9095 --net shenyu apache/shenyu-admin:${current.version}
another way is to put the application.yml、application-oracle.yml configuration in ${your_work_dir}/conf, modify the configuration spring.profiles.active = oracle in application.yml, and then execute the following statement:
docker run -v ${your_work_dir}/conf:/opt/shenyu-admin/conf
-d -p 9095:9095 \
--net shenyu apache/shenyu-admin:${current.version}
In the host, the directory where the bootstrap configuration file is located is recorded as $BOOTSTRAP_CONF.
docker network create shenyu docker pull apache/shenyu-bootstrap:${current.version} docker run -d \ -p 9195:9195 \ -v $BOOTSTRAP_CONF:/opt/shenyu-bootstrap/conf \ apache/shenyu-bootstrap:${current.version}