Skip to content

Commit

Permalink
refactor: Replace cron with supercronic
Browse files Browse the repository at this point in the history
  • Loading branch information
pcfreak30 committed Dec 22, 2024
1 parent d28bbec commit ffbf62a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
ARG ETCD_VERSION=3.5
ARG SUPERCRONIC_VERSION=0.2.33

FROM docker.io/bitnami/etcd:${ETCD_VERSION}

Expand All @@ -9,15 +10,15 @@ USER root
RUN apt-get update && apt-get install -y \
wget \
ca-certificates \
cronie \
&& rm -rf /var/lib/apt/lists/*

# Install minio client
RUN wget https://dl.min.io/client/mc/release/linux-amd64/mc -O /usr/local/bin/mc && \
chmod +x /usr/local/bin/mc

# Create backup directory
RUN mkdir -p /backup
# Install supercronic
RUN wget https://github.com/aptible/supercronic/releases/download/v${SUPERCRONIC_VERSION}/supercronic-linux-amd64 -O /usr/local/bin/supercronic && \
chmod +x /usr/local/bin/supercronic

VOLUME ["/bitnami/etcd"]

Expand All @@ -32,4 +33,3 @@ RUN chmod +x /usr/local/bin/docker-entrypoint.sh
# Use our custom entrypoint
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
CMD ["/opt/bitnami/scripts/etcd/run.sh"]

12 changes: 6 additions & 6 deletions backup/init-backup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ if [ "$BACKUP_ENABLED" != "true" ]; then
exit 0
fi

# Install crontab
crontab /backup/crontab

# Start crond in background
/usr/sbin/crond

# Configure mc client
mc alias set s3 $S3_ENDPOINT $S3_ACCESS_KEY $S3_SECRET_KEY

# Create crontab file
echo "0 0 * * * /usr/local/bin/backup-etcd.sh" > /etc/crontab

# Start supercronic in background
/usr/local/bin/supercronic /etc/crontab &

echo "Backup system initialized successfully"

0 comments on commit ffbf62a

Please sign in to comment.