Skip to content

Commit 2cbd371

Browse files
committed
save
1 parent 672675a commit 2cbd371

File tree

5 files changed

+47
-3
lines changed

5 files changed

+47
-3
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@
55
/.idea
66
/rootfs/cn_s3_api/__pycache__
77
.DS_Store
8+
conf/id_ed25519

data/storage/README.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# syncS3
2+
sync a local folder to S3.
3+
4+
## Description
5+
SyncS3 is a little utlity that watch file changes in a directory and push them in a S3
6+
it uses notification of the kernel to see what files are wrote
7+
8+
## How to use it
9+
All is ready in a docker image. You have just to set some parameters
10+
11+
### docker-compose.yml
12+
```
13+
services:
14+
app:
15+
env_file: .env
16+
build: .
17+
container_name: "sync"
18+
volumes:
19+
- ./data/storage:/data
20+
- ./logs:/var/log/s3sync
21+
```
22+
the directory to watch must mounted in volume. In this exemple (for bareos : /home/docker/bareos-sd/data/storage)
23+
24+
### variables
25+
fichier .env
26+
```
27+
## Endpoint S3
28+
S3_ENDPOINT=https://s3.rbx.io.cloud.ovh.net/
29+
## Key Id
30+
S3_KEY_ID=xx
31+
## Secret
32+
S3_KEY_SECRET=xx
33+
## Region
34+
S3_REGION=RBX
35+
## bucket
36+
S3_BUCKET=My-Bucket
37+
## dir_source (always /data) mounted volume
38+
DIR_SOURCE=/data
39+
## Prefix S3 exemple file foo.txt will be named /data-sd1/foo.txt in S3
40+
S3_DIR_DEST=/data-sd1
41+
```
42+

docker-compose.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ services:
66
volumes:
77
- ./data/storage:/data
88
- ./logs:/var/log/s3sync
9+
- ./conf:/conf

rootfs/template/config_sftp.conf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[config]
22
type=sftp
3-
host= ${SFTP_HOST}
4-
user= ${SFTP_USER}
3+
host=${SFTP_HOST}
4+
user=${SFTP_USER}
55
private_key_file=${SFTP_PRIVATE_KEY_FILE}
66
dir_source=${DIR_SOURCE}
77
dir_dest=${DIR_DEST}

rootfs/utils/sftp_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ def open_ssh_conn():
1010
try :
1111
pkey = paramiko.Ed25519Key.from_private_key_file(key_file)
1212
except Exception as e:
13-
# print("An exception occurred: {}".format(e))
13+
print("An exception occurred reading key: {}".format(e))
1414
pass
1515
try:
1616
pkey = paramiko.RSAKey.from_private_key_file(key_file)

0 commit comments

Comments
 (0)