diff --git a/deploy/standalone/docker/statistics-service.env.example b/deploy/standalone/docker/statistics-service.env.example new file mode 100644 index 00000000..9c94427b --- /dev/null +++ b/deploy/standalone/docker/statistics-service.env.example @@ -0,0 +1,4 @@ +IMAGE=10.2.1.3:18082/hyapp/statistics-service:RELEASE_TAG +CONTAINER_NAME=hyapp-statistics-service +CONFIG_PATH=/etc/hyapp/statistics-service/config.yaml +STOP_TIMEOUT_SEC=60 diff --git a/deploy/standalone/systemd/hyapp-statistics-service.service b/deploy/standalone/systemd/hyapp-statistics-service.service new file mode 100644 index 00000000..0be1a37c --- /dev/null +++ b/deploy/standalone/systemd/hyapp-statistics-service.service @@ -0,0 +1,17 @@ +[Unit] +Description=HYApp statistics-service +After=docker.service network-online.target +Wants=network-online.target +Requires=docker.service + +[Service] +Type=simple +EnvironmentFile=/etc/hyapp/statistics-service/docker.env +ExecStartPre=-/usr/bin/env docker rm -f ${CONTAINER_NAME} +ExecStart=/usr/bin/env docker run --name=${CONTAINER_NAME} --rm --network=host --init --pull=never --stop-signal=SIGTERM --stop-timeout=${STOP_TIMEOUT_SEC} --env=TZ=UTC --log-driver=json-file --log-opt=max-size=100m --log-opt=max-file=5 --mount=type=bind,src=${CONFIG_PATH},dst=/app/config.yaml,readonly ${IMAGE} +ExecStop=/usr/bin/env docker stop -t ${STOP_TIMEOUT_SEC} ${CONTAINER_NAME} +Restart=always +RestartSec=3 + +[Install] +WantedBy=multi-user.target diff --git a/deploy/standalone/systemd/hyapp-wallet-service.service b/deploy/standalone/systemd/hyapp-wallet-service.service index 4a0ecbc9..381c86d0 100644 --- a/deploy/standalone/systemd/hyapp-wallet-service.service +++ b/deploy/standalone/systemd/hyapp-wallet-service.service @@ -10,7 +10,7 @@ StartLimitBurst=3 Type=simple EnvironmentFile=/etc/hyapp/wallet-service/docker.env ExecStartPre=-/usr/bin/env docker rm -f ${CONTAINER_NAME} -ExecStart=/usr/bin/env docker run --name=${CONTAINER_NAME} --rm --network=host --init --pull=never --stop-signal=SIGTERM --stop-timeout=${STOP_TIMEOUT_SEC} --env=TZ=UTC --log-driver=json-file --log-opt=max-size=100m --log-opt=max-file=5 --mount=type=bind,src=${CONFIG_PATH},dst=/app/config.yaml,readonly --health-cmd="/app/grpc-health-probe -addr=127.0.0.1:13004 -service=wallet-service" --health-interval=5s --health-timeout=3s --health-retries=6 --health-start-period=10s ${IMAGE} +ExecStart=/usr/bin/env docker run --name=${CONTAINER_NAME} --rm --network=host --init --pull=never --stop-signal=SIGTERM --stop-timeout=${STOP_TIMEOUT_SEC} --env=TZ=UTC --log-driver=json-file --log-opt=max-size=100m --log-opt=max-file=5 --mount=type=bind,src=${CONFIG_PATH},dst=/app/config.yaml,readonly --mount=type=bind,src=/etc/hyapp/secrets,dst=/etc/hyapp/secrets,readonly --health-cmd="/app/grpc-health-probe -addr=127.0.0.1:13004 -service=wallet-service" --health-interval=5s --health-timeout=3s --health-retries=6 --health-start-period=10s ${IMAGE} ExecStop=/usr/bin/env docker stop --time=${STOP_TIMEOUT_SEC} ${CONTAINER_NAME} Restart=on-failure RestartSec=5s @@ -21,4 +21,3 @@ LimitNOFILE=1048576 [Install] WantedBy=multi-user.target - diff --git a/deploy/tencent-tat/hyapp_tat_deploy.py b/deploy/tencent-tat/hyapp_tat_deploy.py index d1373f02..ee43b4f0 100644 --- a/deploy/tencent-tat/hyapp_tat_deploy.py +++ b/deploy/tencent-tat/hyapp_tat_deploy.py @@ -523,7 +523,7 @@ fi echo "== hyapp containers ==" docker ps --filter 'name=hyapp-' --format '{{.Names}} {{.Image}} {{.Status}}' || true echo "== listening ports ==" -ss -lntp 2>/dev/null | awk 'NR==1 || /:13000|:13001|:13004|:13005|:13006|:13008|:13009|:13100|:13101|:13104|:13105|:13106|:13108|:13109/' || true +ss -lntp 2>/dev/null | awk 'NR==1 || /:13000|:13001|:13004|:13005|:13006|:13008|:13009|:13010|:13100|:13101|:13104|:13105|:13106|:13108|:13109|:13110/' || true """ diff --git a/deploy/tencent-tat/inventory.prod.example.json b/deploy/tencent-tat/inventory.prod.example.json index 53aec041..113191f3 100644 --- a/deploy/tencent-tat/inventory.prod.example.json +++ b/deploy/tencent-tat/inventory.prod.example.json @@ -194,6 +194,25 @@ ], "drain_seconds": 5 } + }, + "statistics-service": { + "unit": "hyapp-statistics-service", + "container": "hyapp-statistics-service", + "env_file": "/etc/hyapp/statistics-service/docker.env", + "image_template": "${REGISTRY}/statistics-service:${TAG}", + "target_port": 13010, + "hosts": [ + "new-app-1", + "new-app-2" + ], + "clb": { + "enabled": true, + "load_balancer_id": "lb-epvnr4o0", + "listener_ids": [ + "lbl-a0myhr6q" + ], + "drain_seconds": 5 + } } } }