Skip to content

Commit 048ea81

Browse files
feat: update rclone configuration with env variable (#53)
Signed-off-by: Jeffrey Tang <jeffrey@swirldslabs.com>
1 parent d41aa7a commit 048ea81

File tree

6 files changed

+24
-13
lines changed

6 files changed

+24
-13
lines changed

docker/backup-uploader/Dockerfile

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
FROM rclone/rclone:1.69.1 as rclone
22

3-
FROM ubuntu:18.04
3+
FROM ubuntu:noble-20250127
44

55
ARG UNAME=hedera
66
ARG UID=2000
@@ -16,12 +16,23 @@ RUN apt-get update && \
1616
ca-certificates \
1717
jq
1818

19+
# Create Application Folders
20+
RUN mkdir -p "/app"
21+
1922
COPY cron /etc/cron.d/backup
20-
ADD backup.sh /
21-
ADD entrypoint.sh /
22-
RUN chmod ugo+x /backup.sh /entrypoint.sh
23+
ADD backup.sh /app/
24+
ADD entrypoint.sh /app/
25+
RUN chmod ugo+x /app/backup.sh /app/entrypoint.sh
2326

2427
COPY rclone.conf /root/.config/rclone/rclone.conf
2528
COPY rclone.conf /home/hedera/.config/rclone/rclone.conf
2629

27-
ENTRYPOINT ["bash", "-c", "./entrypoint.sh"]
30+
ENTRYPOINT ["bash", "-c", "./app/entrypoint.sh"]
31+
32+
# Define Application Environment Variables
33+
ENV RCLONE_CONFIG_BACKUPS_TYPE="s3"
34+
ENV RCLONE_CONFIG_BACKUPS_PROVIDER="GCS"
35+
ENV RCLONE_CONFIG_BACKUPS_REGION="us-central1"
36+
ENV RCLONE_CONFIG_BACKUPS_ENDPOINT="https://storage.googleapis.com"
37+
ENV AWS_ACCESS_KEY_ID=""
38+
ENV AWS_SECRET_ACCESS_KEY=""

docker/backup-uploader/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ val appVersion = project.version.toString()
2626
docker {
2727
name = "${repo}/${registry}/${containerName}:${appVersion}"
2828
version = appVersion
29-
files("entrypoint.sh")
29+
files("/app/entrypoint.sh")
3030
buildx(true)
3131
if (!System.getenv("CI").isNullOrEmpty()) {
3232
platform("linux/arm64", "linux/amd64")

docker/backup-uploader/cron

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# backup
2-
*/10 * * * * root /backup.sh
2+
*/10 * * * * root /app/backup.sh
33
# backup

docker/backup-uploader/entrypoint.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ do
88
#
99
# 1. all environment variables are passed in
1010
# 2. ensure multiple copies can't be running (as there is no copy)
11-
( . ./backup.sh)
11+
( . /app/backup.sh)
1212
sleep 300
1313
done

docker/backup-uploader/image.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

docker/backup-uploader/rclone.conf

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
[backups]
2-
type = google cloud storage
3-
location = us-west2
4-
bucket_policy_only = true
5-
service_account_file = /sa.json
2+
type = ${RCLONE_CONFIG_BACKUPS_TYPE}
3+
provider = ${RCLONE_CONFIG_BACKUPS_PROVIDER}
4+
env_auth = true
5+
region = ${RCLONE_CONFIG_BACKUPS_REGION}
6+
endpoint = ${RCLONE_CONFIG_BACKUPS_ENDPOINT}

0 commit comments

Comments
 (0)