This commit is contained in:
Piotr Biernat 2024-12-05 16:43:16 +01:00
parent 03d1859ab9
commit e96bbe3d4e
6 changed files with 45 additions and 6 deletions

16
.app.config Normal file
View File

@ -0,0 +1,16 @@
{
"ID": "logger",
"Name": "logger",
"Address": "__IP__",
"Tags": ["api-logger", "logger", "tcp", "fluentd"],
"Port": 24224,
"Connect": {
"Native": true
},
"Check": {
"TCP": "__IP__:24224",
"Interval": "10s",
"Timeout": "10s",
"DeregisterCriticalServiceAfter": "5m"
}
}

View File

@ -9,8 +9,14 @@ USER root
RUN ["fluent-gem", "install", "fluent-plugin-rabbitmq"]
USER fluent
COPY ./api-logger/etc /fluentd/etc
CMD ["fluentd"]
COPY ./api-logger/etc /etc/fluent
COPY ./api-logger/entrypoint.sh /
COPY ./.app.config /
EXPOSE 24224
USER root
ENTRYPOINT ["/entrypoint.sh"]
# USER fluent
CMD ["fluentd"]

View File

@ -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

11
api-logger/entrypoint.sh Executable file
View File

@ -0,0 +1,11 @@
#!/bin/sh
set -e
update-ca-certificates
# su fluent
update-resolv # FIXME: lack of permissions to /etc/resolv.conf
register-service
exec "$@"

View File

@ -1,7 +1,7 @@
#!/bin/sh
# RUN IN REPO ROOT DIR !!
export IMAGE_NAME="git.pbiernat.dev/egommerce/api-logger"
export IMAGE_NAME="git.pbiernat.io/egommerce/api-logger"
TARGET=${1:-latest}

View File

@ -1,9 +1,12 @@
#!/bin/sh
# RUN IN REPO ROOT DIR !!
export IMAGE_NAME="git.pbiernat.dev/egommerce/api-logger"
export IMAGE_NAME="git.pbiernat.io/egommerce/api-logger"
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/14bae058-088f-4895-99ef-ec9383857c41