部署

目的:基于trantor和dice平台,快速部署供应链平台各个模块。(trantor0.10.0)
传送门:trantor文档 https://yuque.alibaba-inc.com/terminus-trantor/cookbook/ynaghi
dice文档 https://dice-docs.app.terminus.io/

部署步骤

一、代码仓库准备

1、登录dice平台,创建项目;
2、登录dice平台,在已创建项目下添加应用;
3、根据dice平台添加应用生成的代码仓库地址,创建本地仓库,建立本地仓库和dice平台远程仓库的链接;
//clone dice创建的远程仓库 git clone https://github.com/bzdgn/docker-spring-boot-java-web-service-example.git touch readme.md git add readme.md git commit -m "add README" git push -u origin master //在本地代码仓库执行 git remote add dice https://terminus-org.app.terminus.io/wb/SRM-Demo/settlement git push -u dice --all git push -u dice --tags

二、本地模块代码开发

三、项目打包deploy

maven仓库配置:

terminus terminus release repository https://repo.terminus.io/repository/releases/ terminus terminus snapshot repository https://repo.terminus.io/repository/snapshots/

trantor打包插件

io.terminus.trantor trantor-metadata-maven-plugin 1.0.2-SNAPSHOT io.terminus.sourcing.admin http://127.0.0.1:8082 install deploy

模块deploy的两种方式:

1、命令:mvn clean deploy -Dtrantor.deploy
2、通过restful接口
请求地址: {mete-store}/api/internal/trantor/metadata/json
请求类型: post
请求参数: trantor-module-metadata.json文件内容
本地模块路径下执行命令: mvn clean install -Dtrantor.output -Dmaven.test.skip=true 生成trantor-module-metadata.json文件
建议:
1、各模块中引用的依赖版本,在最外层pom文件中统一管理,不要直接在引用依赖时直接指定版本号;
2、xxModule中指定key和version,最好不要使用默认version,避免各模块版本不统一;
注:正常操作流程是deploy-->>执行发布计划-->>启动模块服务

四、dice平台构建流水线

参考:https://dice-docs.app.terminus.io/3.17/manual/deploy/deploy-from-git.html#%E5%87%86%E5%A4%87%E7%A4%BA%E8%8C%83%E4%BB%A3%E7%A0%81
dice配置文件示例:

1、dice.yml

参考:https://dice-docs.app.terminus.io/3.17/manual/deploy/dice-yml.html#dice-yml-%E6%96%87%E4%BB%B6%E5%85%A8%E5%B1%80%E7%BB%93%E6%9E%84
注:addons如果修改版本号不生效,请删除重写addon,然后重启服务
services: sourcing-center: ports: - 8081 expose: - 80 deployments: replicas: 1 resources: cpu: 0.5 mem: 2048 health_check: http: port: 8081 path: "/actuator/health" duration: 600 addons: api-gateway: plan: "api-gateway:basic" options: version: "1.0.0" registercenter: plan: "registercenter:basic" rocketmq: plan: "rocketmq:basic" options: version: "4.3.0" trantor-env-test: plan: custom:basic envs: {}

2、pipeline.yml

参考:https://dice-docs.app.terminus.io/3.17/manual/deploy/pipeline.html#%E5%A6%82%E4%BD%95%E7%BC%96%E5%86%99-pipeline-yml-%E6%96%87%E4%BB%B6
version: 1.1 stages: - stage: - git-checkout: params: depth: 1 - stage: - buildpack: alias: bp-sourcing-center params: context: ${git-checkout} modules: - name: sourcing-center path: module - stage: - release: version: 1.0 params: dice_yml: ${git-checkout}/dice.yml docker_images: ${maven-pack}/docker_image replacement_images: - ${bp-sourcing-center}/pack-result - stage: - dice: params: release_id_path: ${release}
3、dice环境变量配置(全局环境变量,需要权限才能配置)
dice环境变量,分为项目级配置、应用级配置
1)多个应用可以复用的配置,使用项目级全局配置
addon在dice平台添加方式(三方服务分为两种1、custom自定义 2、三方实例)
现有三方服务列表
三方服务实例
自定义服务实例
共用配置:
注:所有value值,按实际需求自行修改
srm-test-env配置
ACL_ADMIN_HOST:acl-admin-test-1632-app.test-dice.cnooc, ACL_CLIENT_HOST:acl-client-test-1632-app.test-dice.cnooc, ACL_MOCK:false, ADDON_HAS_ENCRIPY:YES, COOKIE_DOMAIN:test-dice.cnooc, DS_HOST:services-test-1670-autumn.default.svc.cluster.local, DS_PORT:8080, DS_PROJECT_ID:srm_test,· LOGIN_SHARE_COOKIE_NAME:srm_test_u_c_local, META_STORE_HOST:services-test-1640-meta-store.default.svc.cluster.local META_STORE_PORT:8080, MOCK_ORG_ENABLE:false, MOCK_PARTNERE_NABLE:false, MODULE_PORT:8081, UC_FRONT_URL:front-test-1657-app.test-dice.cnooc, UC_PROTOCOL:http, USER_MOCK:false
2)不能复用的配置,设置单个应用的环境变量
trantor-master 配置:
ADDRESS_CACHE:LOCAL DS_PROJECT_ID:trantor_master USER_MOCK:true ACL_MOCK:true WORKSPACE_HIDDENS:Bell MAX_EXPORT_NUM:100000 MAX_EXPORT_FIELD_NUM:200 EVENT_ENABLE:false DS_SUBSCRIBE:false DEPLOYMENT_MODE:STANDALOAN GATEWAY_PREFIX:/srm/trantor-master GATEWAY_URL:test.gateway.test-dice.cnooc META_STORE_URL:test.gateway.test-dice.cnooc/srm/trantor-master/meta-store TENANT_ENABLE:true DUBBO_REGISTRY_PROTOCOL:zookeeper OSS_HOST:test.cnoocmall.com OSS_STS_ENABLED:false OSS_AS:4gjC6MYerAxU5HC05Jqvct2Lcq0Itd
trantor-slave配置:
SUBSCRIBE:false MYSQL_DATABASE:autumn_srm_test HIKARI_LOG_LEVEL:DEBUG MAX_POOL_SIZE:150 ADDRESS_CACHE:LOCAL ACL_INTERVAL_TIME:600 DS_PROJECT_ID:trantor_srm_test USER_MOCK:false ACL_MOCK:false TRANTOR_APP_NAME:trantor TRANTOR_SERVICE_NAME:meta-store UC_FRONT_URL:uc-srm.app.terminus.io LOGIN_SHARE_COOKIE_NAME:srm_test_u_c_local COOKIE_DOMAIN:terminus.io UC_PROTOCOL:https ACL_CLIENT_HOST:acl-client.services--5ed4d5fe046d4535281937d2b18aa1c6.svc.cluster.local:8080 ACL_ADMIN_HOST:acl-admin.services--5ed4d5fe046d4535281937d2b18aa1c6.svc.cluster.local:8080 ACL_URL:/srm-demo/acl/acl-admin SERVER_BUCKET:terminus-trantor DS_SUBSCRIBE:true OSS_AS:4QYLdx8u6rpkaTevLjkpuN3vHAPSjk OSS_AK:LTAI4FkL2GgZmDsQz1zVPrqC GATEWAY_URL:test-gateway.app.terminus.io META_STORE_URL:test-gateway.app.terminus.io/srm-demo/trantor/meta-store
flow-center配置:
TRANTOR_LOGIN_HOST:https://meta-store-srm-demo-test.app.terminus.io TRANTOR_ACL_HOST:http://meta-store.services--c55910a4b4f9e34c1498fe4b5dd3b40e.svc.cluster.local:8080 FLOW_UI_HOST:https://flow-ui-srm-demo-test.app.terminus.io ACL_AUTH_DOMAIN:acl-client.services--5ed4d5fe046d4535281937d2b18aa1c6.svc.cluster.local:8080 UC_HOST:https://usercenter-srm-demo-test.app.terminus.io COOKIE_DOMAIN:terminus.io LOGIN_SHARE_COOKIE_NAME:srm_test_u_c_local FLOW_CENTER:https://farafra-service-srm-demo-test.app.terminus.io JAVA_OPTS:-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.port=8888 -Dcom.sun.management.jmxremote.rmi.port=8888 -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8085 DUBBO_ENABLED:true USER_CENTER_PROTOCOL:dubbo ASGARD_WEB:http://farafra-service.services--982444f4aca8d21eab8df05bf49cff86.svc.cluster.local:8090 FLOW_WEB:http://farafra-service.services--982444f4aca8d21eab8df05bf49cff86.svc.cluster.local:8090 SIMULATE_WEB:http://farafra-service.services--982444f4aca8d21eab8df05bf49cff86.svc.cluster.local:8090
user-center配置:
LOGIN_SHARE_COOKIE_NAME:srm_test_u_c_local COOKIE_DOMAIN:terminus.io USER_CENTER_PROTOCOL:dubbo SMS_ENABLE_NOTICE_MOCK:true EMAIL_ENABLE_NOTICE_MOCK:true MYSQL_DATABASE:draco_test PWD_STRENGTH_CHECK_ENABLE:false JAVA_OPTS:-Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=8003,suspend=n -Dhttps.protocols=TLSv1.2
partner-center配置:
MODULE_PORT:8081 MOCK_PARTNERE_NABLE:false SWAGGER_ENABLE:true ABILITY_NOTICE_CENTER_APP_ID:ga38c9e1ae9da4fde86eb99c8ee3ad947 ABILITY_NOTICE_CENTER_PRIVATE_KEY:1234 ABILITY_NOTICE_CENTER_SERVER_HOST:server.services--0278f1ca891b1de98667cfefa0a9ec05.svc.cluster.local ABILITY_NOTICE_CENTER_SERVER_PORT:8080 ASYNC_EXPORT_OSS_HOST:oss-cn-shenzhen.aliyuncs.com ASYNC_EXPORT_OSS_INNER_HOST:oss-cn-shenzhen-internal.aliyuncs.com ASYNC_EXPORT_ACCESS_ID:LTAI4G821dZu3wCkL7MJn2o8 ASYNC_EXPORT_ACCESS_KEY:j5YUOZ5EYorA1oXkTry6xXKgJZ6PLo ASYNC_EXPORT_BUCKET_NAME:yago-test-oss JOB_SHARDING_COUNT:10 ASYNC_EXPORT_ZK_NAMESPACE:async-export MQ_GROUP:partner-center COOKIE_DOMAIN:yalego.net UC_FRONT_URL:uc-front-dev.yago.agile.com.cn LOGIN_SHARE_COOKIE_NAME:yajule_dev_u_c_local METASTORE_URL:http://meta-store-dev.yago.agile.com.cn/ JAVA_MAX_MEM_RATIO:30
material-center配置:
MODULE_PORT:8081 FILTER_ENABLE:true MOCK_PARTNERE_NABLE:false SWAGGER_ENABLE:true WEB_PORT:8081 METASTORE_URL:http://meta-store-dev.yalego.net SWAGGER_HOST:http://material-web-dev.yalego.net ASYNC_EXPORT_OSS_HOST:oss-cn-shenzhen.aliyuncs.com ASYNC_EXPORT_OSS_INNER_HOST:oss-cn-shenzhen-internal.aliyuncs.com ASYNC_EXPORT_ACCESS_ID:LTAI4G821dZu3wCkL7MJn2o8 ASYNC_EXPORT_ACCESS_KEY:j5YUOZ5EYorA1oXkTry6xXKgJZ6PLo ASYNC_EXPORT_BUCKET_NAME:yago-test-oss JOB_SHARDING_COUNT:10 ASYNC_EXPORT_ZK_NAMESPACE:async-export MQ_GROUP:material-center
contract-center配置:
item.api.version:b2b partner-center.filter.b2b:true MAX_IMPORT_LIMIT_ROW_NUM:1000 JAVA_OPTS:-Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=8003,suspend=n -Dhttps.protocols=TLSv1.2 SRM_CONTRACT_CA_ROOT_MOCK:true
uc-front配置:
WEB_HOST:usercenter.services--575788799193e78e854a58a381022fc5.svc.cluster.local WEB_PORT:8081
srm-portal配置:
WEB_BACKEND_URL:https://srm-portal-demo-test.app.terminus.io TRANTOR_URL:https://meta-store-srm-demo-test.app.terminus.io UC_URL:https://usercenter-srm-demo-test.app.terminus.io PARTNER_URL:https://partner-center-web-8502.app.terminus.io PARTNER_ADMIN_URL:https://partner-center-test-8504.app.terminus.io CONTRACT_URL:https://contract-center-demo-test.app.terminus.io MATERIAL_URL:https://material-center-web-8502.app.terminus.io REQUISITION_URL:https://requisition-center-demo-test.app.terminus.io PERFORMANCE_URL:https://performance-web-srm-demo-test.app.terminus.io SOURCING_URL:https://sourcing-center-demo-test.app.terminus.io MYSQL_DATABASE:srm-portal1
settlement配置:
UC_PROTOCOL:https MODULE_PORT:8080 JAVA_OPTS:-Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=8003,suspend=n -Dhttps.protocols=TLSv1.2 DS_HOST:datastore.services--test-9081.svc.cluster.local USER_MOCK:true ACL_MOCK:false DS_PROJECT_ID:trantor_060_test META_STORE_HOST:meta-store.services--b14746f3e9c0aeb5b264a71156b7c6df.svc.cluster.local UC_FRONT_URL:front-test-9088-app.app.terminus.io LOGIN_SHARE_COOKIE_NAME:t_product_test_u_c_local ACL_CLIENT_HOST:acl-client.services--test-9086.svc.cluster.local:8080 ACL_ADMIN_HOST:acl-admin.services--test-9086.svc.cluster.local:8080 COOKIE_DOMAIN:terminus.io DS_PORT:8080 META_STORE_PORT:8080 SPRING_PROFILES_ACTIVE:test
third_purchase_center配置:
SUNING_APPSECRET:8c0094fcdb50590c0c9bcaa89dbd5075 SUNING_APPKEY:e1d4179f7395a77cfee3360dabf3a7c5 SUNING_CHECKPARAM:true SUNING_SERVER_URL:https://openxgpre.cnsuning.com/api/http/sopRequest JD_VOP_USERNAME:杭州端点VOP JD_VOP_PASSWORD:terminus@2020! JD_VOP_CLIENT_ID:aU2E9hhGUTB9rj9uoPiR JD_VOP_CLIENT_SECRET:aMjtcinVVZkCZrAvcCja SWAGGER_HOST:third-uat.purchase.yalego.net LOGISTICS_KEY:nZChZkuJ776 LOGISTICS_CUSTOMER:1622208E5385C4B3D29BE1F34F3FD89C LOGISTICS_SECRET:4c83a49fbcf341249f0cd93691885909 LOGISTICS_USERID:c52ded5b0fe641cbb1afc16196b7fdb7 LOGISTICS_JUDGMENT:nZChZkuJ776 LOGISTICS_CALLBACK_VERIFY:false LOGISTICS_CALLBACK_URL:/api/third-purchase/listen/callback LOGISTICS_CALLBACK_API:http://logistics-api-uat.yalego.net JD_ORDER_PRICE:120 SUNING_ORDER_PRICE:86