Skip to content

Instantly share code, notes, and snippets.

@Darkflib
Last active November 19, 2022 06:00
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save Darkflib/8c40e9e0bb60883bd70fb34972b5954a to your computer and use it in GitHub Desktop.
Save Darkflib/8c40e9e0bb60883bd70fb34972b5954a to your computer and use it in GitHub Desktop.
minio gateway to s3 compatible wasabi with cache + s3fs and ecryptfs
mkdir /mnt/wasabi-cache
lvcreate -L 100G -n wasabi-cache vg0
mkfs.ext4 /dev/vg0/wasabi-cache
docker run -d -p 9000:9000 --name minio-wasabi -e "MINIO_CACHE_DRIVES=/mnt/wasabi-cache" -e "MINIO_CACHE_EXPIRY=40" \
-e "MINIO_ACCESS_KEY=AKKEYKEYKEYKEYKEY" -e "MINIO_SECRET_KEY=mysecret123123123123123" \
minio/minio gateway s3 https://s3.wasabisys.com:443
mkdir /mnt/.s3
mkdir /mnt/s3
# this is one of the default locations, the others being /etc or env vars.
# if you change this location to something other than the defaults, please use
# -o passwd_file=/my/path/mypasswd-s3fs
# if you need multiple different passwords for different buckets, then use the alt syntax on each line BUCKET,KEY,SECRET
echo AKKEYKEYKEYKEYKEY:Lzdsmysecret123123123123123 > ~/.passwd-s3fs
chmod 600 ~/.passwd-s3fs
s3fs mybucket /mnt/.s3 -o url=http://127.0.0.1:9000/ -o use_path_request_style
mount -t ecryptfs /mnt/.s3 /mnt/s3
###########################################################################################################
#
# One thing to note is that while this works, it doesn't work from multiple simultaneous machines due
# to inode numbering issues...
#
# I believe this is a side-effect of ecryptfs encoding the inode as part of the salt for the filenames.
# I have no checked this yet, so please bear with me if my hunch is wrong.
#
# In addition, s3fs supports its own caching system, but done at the minio level
# (assuming only active-passive failover) it allows it to be shared between multiple machines.
#
#
# Why would I want to do this?
#
#
# Writes are actually pretty fast...
#
# root@nbg03:~# docker run -it -v minio:/root -v `pwd`/test:/root/test minio/mc cp /root/test/test.file wasabi/wwff-backup/
# ...t/test/test.file: 1024.00 MB / 1024.00 MB ┃▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓┃ 100.00% 81.05 MB/s 12s
#
# Reads not so much...
#
# root@nbg03:~# docker run -it -v minio:/root -v `pwd`/test:/root/test minio/mc cp wasabi/wwff-backup/test.file .
# ...backup/test.file: 1024.00 MB / 1024.00 MB ┃▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓┃ 100.00% 24.26 MB/s 42s
#
# With the minio gateway doing write-through caching?
#
# Writes aren't much slower
#
# root@nbg03:~# docker run -it -v minio:/root -v `pwd`/test:/root/test minio/mc cp /root/test/test.file mys3/wwff-backup/
# ...t/test/test.file: 1024.00 MB / 1024.00 MB ┃▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓┃ 100.00% 76.12 MB/s 14s
#
# ...and reads?
#
# root@nbg03:~# docker run -it -v minio:/root -v `pwd`/test:/root/test minio/mc cp mys3/wwff-backup/test.file .
# ...backup/test.file: 1024.00 MB / 1024.00 MB ┃▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓┃ 100.00% 753.34 MB/s 1s
#
#
# I believe the term w00t is justified here.
#
###########################################################################################################
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment