From 2671dde183e75cb34269bb809f623f0868a2b4d6 Mon Sep 17 00:00:00 2001 From: Piotr Biernat Date: Sat, 20 Jul 2024 13:30:27 +0200 Subject: [PATCH] Refactgor --- Dockerfile | 7 ++++--- Makefile | 3 +++ api-eventbus/entrypoint.sh | 5 +++++ api-eventbus/etc/conf.d/45-plugin-prometheus.conf | 2 +- api-eventbus/etc/conf.d/50-plugin-consul.conf | 7 ------- deploy/image-build.sh | 2 +- deploy/image-push.sh | 7 +++++-- 7 files changed, 19 insertions(+), 14 deletions(-) delete mode 100644 api-eventbus/etc/conf.d/50-plugin-consul.conf diff --git a/Dockerfile b/Dockerfile index eb00294..dbb8331 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,12 +7,13 @@ LABEL dev.egommerce.image.version="1.0" COPY ./api-eventbus/etc /etc/rabbitmq COPY ./api-eventbus/entrypoint.sh ./api-eventbus/wait-for-it.sh / +COPY ./.app.config / -RUN rabbitmq-plugins --offline enable rabbitmq_peer_discovery_consul rabbitmq_prometheus && \ - chmod 755 /entrypoint.sh -# rabbitmq-plugins --offline enable rabbitmq_prometheus && \ +# RUN rabbitmq-plugins enable --offline rabbitmq_prometheus EXPOSE 5672 ENTRYPOINT ["/entrypoint.sh"] CMD ["rabbitmq-server"] + +HEALTHCHECK --interval=5s --timeout=1s --retries=20 CMD rabbitmq-diagnostics -q ping >/dev/null || exit 1 diff --git a/Makefile b/Makefile index 1b190e9..62b562b 100644 --- a/Makefile +++ b/Makefile @@ -8,5 +8,8 @@ build-image-dev: build-image-prod: - sh ${DEPLOY_DIR}/image-build.sh +push-image-dev: + - sh ${DEPLOY_DIR}/image-push.sh dev + push-image-prod: - sh ${DEPLOY_DIR}/image-push.sh diff --git a/api-eventbus/entrypoint.sh b/api-eventbus/entrypoint.sh index 568b72c..698ff1c 100755 --- a/api-eventbus/entrypoint.sh +++ b/api-eventbus/entrypoint.sh @@ -1,6 +1,8 @@ #!/usr/bin/env sh set +e +update-resolv + waitForService() { ./wait-for-it.sh $1 -t 2 1>/dev/null 2>&1 @@ -15,8 +17,11 @@ waitForService() } waitForService "api-registry:8500" +# waitForService "logger.service.ego.io:24224" waitForService "api-logger:24224" set -euo pipefail +register-service + exec "$@" diff --git a/api-eventbus/etc/conf.d/45-plugin-prometheus.conf b/api-eventbus/etc/conf.d/45-plugin-prometheus.conf index 14da7de..9f87a4a 100644 --- a/api-eventbus/etc/conf.d/45-plugin-prometheus.conf +++ b/api-eventbus/etc/conf.d/45-plugin-prometheus.conf @@ -1 +1 @@ -prometheus.tcp.port = 8084 +# prometheus.tcp.port = 8084 diff --git a/api-eventbus/etc/conf.d/50-plugin-consul.conf b/api-eventbus/etc/conf.d/50-plugin-consul.conf deleted file mode 100644 index 4c88b87..0000000 --- a/api-eventbus/etc/conf.d/50-plugin-consul.conf +++ /dev/null @@ -1,7 +0,0 @@ -cluster_formation.peer_discovery_backend = consul - -cluster_formation.consul.host = api-registry - -cluster_formation.consul.svc_addr_auto = false -cluster_formation.consul.svc = api-eventbus -cluster_formation.consul.svc_addr = api-eventbus diff --git a/deploy/image-build.sh b/deploy/image-build.sh index 63d2dbb..d7e5c9a 100755 --- a/deploy/image-build.sh +++ b/deploy/image-build.sh @@ -1,7 +1,7 @@ #!/bin/sh # RUN IN REPO ROOT DIR !! -export IMAGE_NAME="git.pbiernat.dev/egommerce/api-eventbus" +export IMAGE_NAME="git.pbiernat.io/egommerce/api-eventbus" TARGET=${1:-latest} diff --git a/deploy/image-push.sh b/deploy/image-push.sh index 3440aa2..b57d09d 100755 --- a/deploy/image-push.sh +++ b/deploy/image-push.sh @@ -1,9 +1,12 @@ #!/bin/sh # RUN IN REPO ROOT DIR !! -export IMAGE_NAME="git.pbiernat.dev/egommerce/api-eventbus" +export IMAGE_NAME="git.pbiernat.io/egommerce/api-eventbus" TARGET=${1:-latest} -echo $DOCKER_PASSWORD | docker login git.pbiernat.dev -u $DOCKER_USERNAME --password-stdin +echo $DOCKER_PASSWORD | docker login git.pbiernat.io -u $DOCKER_USERNAME --password-stdin docker push "$IMAGE_NAME:$TARGET" + +# Restart container +curl -X POST http://127.0.0.1:9001/api/webhooks/2d456377-d438-4617-88fc-8d06657e4f45