Skip to main content

Install VersityGW

Install VersityGW

https://github.com/versity/versitygw

From Github

wget https://github.com/versity/versitygw/releases/download/v1.0.20/versitygw_1.0.20_linux_amd64.deb
wget https://github.com/versity/versitygw/releases/download/v1.0.20/checksums.txt
sha256sum -c checksums.txt --ignore-missing
dpkg -i ./versitygw_*.deb

Create user and Service

useradd -m -s /bin/bash -d /poolname/versitygw/home -u 1100 -g 1100 versitygw
echo "versitygw:$(openssl rand -base64 100 | tr -d '=+/\n\r' | cut -c 1-70)" | chpasswd

Edit file:

nano /etc/versitygw.d/versitygw.conf

Paste content:

VGW_BACKEND=posix

# When VGW_BACKEND is posix or scoutfs, VGW_BACKEND_ARG must be defined
# as the the top level directory for the gateway.
# All sub directories of the top level directory are treated as buckets,
# and all files/directories below the "bucket directory" are treated as
# the objects. The object name is split on "/" separator to translate
# to posix storage.
# For example:
# (VGW_BACKEND_ARG) top level: /mnt/fs/gwroot
# bucket: mybucket
# object: a/b/c/myobject
# will be translated into the file /mnt/fs/gwroot/mybucket/a/b/c/myobject
VGW_BACKEND_ARG=/poolname/versitygw/buckets

ROOT_ACCESS_KEY_ID=
ROOT_SECRET_ACCESS_KEY=

VGW_PORT=:7070

VGW_ADMIN_PORT=:17070

VGW_IAM_DIR=/poolname/versitygw/accounts

 

Usage

access=<admin_access_key_id>
secret=<admin_secret_access_key>
port=17070
# Create user
versitygw admin -a $access -s $secret -er http://127.0.0.1:$port create-user -a <user_access_key_id> -s <user_secret_access_key> -r <user_role> -ui <user_userID> -gi <user_groupID>
#user role: 'user', 'admin', 'userplus' (userplus is able to create buckets, user not)
#ui and gi are optional

# Delete user
versitygw admin -a $access -s $secret -er http://127.0.0.1:$port delete-user -a <user_access_key_id>

# List users
versitygw admin -a $access -s $secret -er http://127.0.0.1:$port list-users

# Change Bucket Owner
versitygw admin -a $access -s $secret -er http://127.0.0.1:$port change-bucket-owner -b <bucket_name> -o <new_owner_access>

# List Buckets and Owners
versitygw admin -a $access -s $secret -er http://127.0.0.1:$port list-buckets

Update Script

#!/bin/bash
v=$(curl -s https://api.github.com/repos/versity/versitygw/releases/latest | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
wget "https://github.com/versity/versitygw/releases/download/${v}/versitygw_${v:1}_linux_amd64.deb"
wget "https://github.com/versity/versitygw/releases/download/${v}/checksums.txt"

sha256sum -c checksums.txt --ignore-missing
if [ $? == 0 ]
then
        rm checksums.txt
        read -p "Do you want to install $v? (y/N) " confirm
        [[ "$confirm" != "y" ]] && exit 0
        dpkg -i ./versitygw_${v:1}_linux_amd64.deb
        systemctl daemon-reload
        systemctl restart versitygw@*
        sleep 3
        systemctl status versitygw@*
fi