File tree Expand file tree Collapse file tree 2 files changed +24
-11
lines changed Expand file tree Collapse file tree 2 files changed +24
-11
lines changed Original file line number Diff line number Diff line change @@ -7,14 +7,22 @@ Container to sync backups to Amazon S3 and get them from there using s3cmd.
7
7
- Mount local path ` /abs/path/to/backups ` to container in ` /data `
8
8
- Sync all files from local path to S3 bucket ` foobar-bucket `
9
9
10
- ```
10
+ ``` console
11
11
docker run -it -e ACCESS_KEY=foobar -e SECRET_KEY=foobar -e S3_PATH=s3://foobar-bucket \
12
12
-v /abs/path/to/backups:/data druidfi/s3-sync sync
13
13
```
14
14
15
- ## Run in cron mode
15
+ ## Use custom s3cmd configuration
16
16
17
+ ``` console
18
+ docker run -it -e S3_PATH=s3://foobar-bucket \
19
+ -v /abs/path/to/.s3cfg:/root/.s3cfg:ro \
20
+ -v /abs/path/to/backups:/data druidfi/s3-sync
17
21
```
22
+
23
+ ## Run in cron mode
24
+
25
+ ``` console
18
26
docker run -it -e ACCESS_KEY=foobar -e SECRET_KEY=foobar -e S3_PATH=s3://foobar-bucket -e CRON_SCHEDULE="*/5 * * * *" \
19
27
-v /abs/path/to/backups:/data druidfi/s3-sync
20
28
```
@@ -24,9 +32,9 @@ docker run -it -e ACCESS_KEY=foobar -e SECRET_KEY=foobar -e S3_PATH=s3://foobar-
24
32
- See the documentation in https://s3tools.org/usage
25
33
- Sync specific documentation in https://s3tools.org/s3cmd-sync
26
34
27
- ## How to give access to S3 bucket
35
+ ## How to give access to AWS S3 bucket
28
36
29
- ```
37
+ ``` json
30
38
{
31
39
"Version" : " 2008-10-17" ,
32
40
"Statement" : [
@@ -50,4 +58,4 @@ docker run -it -e ACCESS_KEY=foobar -e SECRET_KEY=foobar -e S3_PATH=s3://foobar-
50
58
}
51
59
]
52
60
}
53
- ```
61
+ ```
Original file line number Diff line number Diff line change 2
2
# shellcheck disable=SC2086
3
3
4
4
DATA_PATH=" /data/"
5
+ S3CMD_BIN=" /usr/bin/s3cmd"
5
6
6
- : " ${ACCESS_KEY:? " ACCESS_KEY env variable is required" } "
7
- : " ${SECRET_KEY:? " SECRET_KEY env variable is required" } "
8
- REGION=${REGION:- eu-central-1}
7
+ if [ -n " ${REGION} " ]; then
8
+ $S3CMD_BIN =" ${$S3CMD_BIN } --region=${REGION} "
9
+ fi
10
+
11
+ if [ -n " ${ACCESS_KEY} " ]; then
12
+ $S3CMD_BIN =" ${$S3CMD_BIN } --access_key=${ACCESS_KEY} "
13
+ fi
9
14
10
- S3CMD_BIN= " /usr/bin/s3cmd --region= $REGION "
11
- S3CMD_BIN=" $S3CMD_BIN --access_key= $ACCESS_KEY "
12
- S3CMD_BIN= " $S3CMD_BIN --secret_key= $SECRET_KEY "
15
+ if [ -n " ${SECRET_KEY} " ] ; then
16
+ $ S3CMD_BIN =" ${ $ S3CMD_BIN} --secret_key= ${SECRET_KEY} "
17
+ fi
13
18
14
19
if [ " $1 " = ' conf' ]; then
15
20
echo -e " \n\nsc3cmd:" " $S3CMD_BIN " " \n\n"
You can’t perform that action at this time.
0 commit comments