4 Commits

Author SHA1 Message Date
fa961f48f0 add some logs
All checks were successful
Build Docker image / docker (push) Successful in 4m18s
2025-05-11 18:11:01 +03:00
44159904b2 update version 2025-05-11 17:23:28 +03:00
deb90b0e50 add curl
All checks were successful
Build Docker image / docker (push) Successful in 1m41s
2025-05-11 17:19:18 +03:00
a49c4c4526 update version 2025-05-11 17:11:25 +03:00
4 changed files with 15 additions and 3 deletions

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
run.sh

View File

@@ -3,9 +3,9 @@ FROM postgres:17
WORKDIR /root
RUN apt update && \
apt -y install restic ca-certificates
apt -y install restic ca-certificates curl
COPY docker-entrypoint.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]

View File

@@ -12,6 +12,7 @@ tasks:
cmds:
- |
helm upgrade --install -n system pg-backup ./pg_backup \
--set "image.tag=0.0.9" \
--set "postgres_host=db.mak-sim.ru" \
--set postgres_password=$POSTGRES_PASSWORD \
--set "aws_access_key_id=$AWS_ACCESS_KEY_ID" \

View File

@@ -15,12 +15,22 @@ POSTGRES_PORT="${POSTGRES_PORT:-5432}"
POSTGRES_SSL_MODE=${POSTGRES_SSL_MODE:-"require"}
RESTIC_TAG=${RESTIC_TAG:-"pg_basebackup"}
LOKI_URL="http://loki.montoring:3100/loki/api/v1/push"
LOKI_URL="http://loki.monitoring:3100/loki/api/v1/push"
SERVICE_NAME="pg_backup"
send_loki_status() {
local status="$1"
local timestamp_ns=$(date +%s%N)
echo "{
\"streams\": [
{
\"stream\": { \"service_name\": \"$SERVICE_NAME\" },
\"values\": [
[ \"$timestamp_ns\", \"$status\" ]
]
}
]
}"
curl -H "Content-Type: application/json" \
-s -X POST "$LOKI_URL" \
--data-raw "{