Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added cache setup to zs3server #156

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 30 additions & 3 deletions blimp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ WALLET_ID=0chainwalletid
WALLET_PUBLIC_KEY=0chainwalletpublickey
WALLET_PRIVATE_KEY=0chainwalletprivatekey
WALLET_MNEMONICS=0chainmnemonics
DOCKER_IMAGE=v1.17.1
DOCKER_IMAGE=v1.17.2
IS_ENTERPRISE=isenterprise
EDOCKER_IMAGE=v1.17.1

Expand Down Expand Up @@ -50,6 +50,10 @@ docker-compose --version
curl -L https://github.com/0chain/zboxcli/releases/download/v1.4.4/zbox-linux.tar.gz -o /tmp/zbox-linux.tar.gz
sudo tar -xvf /tmp/zbox-linux.tar.gz -C /usr/local/bin

echo "download yaml query"
sudo wget -qO /usr/local/bin/yq https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64
sudo chmod a+x /usr/local/bin/yq

# create config dir
mkdir -p ${CONFIG_DIR}
mkdir -p ${CONFIG_DIR_BLIMP}
Expand Down Expand Up @@ -107,7 +111,8 @@ cat <<EOF >${CONFIG_DIR_BLIMP}/zs3server.json
"compress": false,
"max_batch_size": 100,
"batch_wait_time": 500,
"batch_workers": 5
"batch_workers": 5,
"max_concurrent_requests": 300
}
EOF

Expand Down Expand Up @@ -236,6 +241,28 @@ volumes:

EOF

sudo umount -l ${CONFIG_DIR}/mnt/mcache || true

mkdir -p ${CONFIG_DIR}/mcache
truncate -s 1G ${CONFIG_DIR}/mcache/data
mkfs.xfs ${CONFIG_DIR}/mcache/data
mkdir -p ${CONFIG_DIR}/mnt/mcache
rm -rf ${CONFIG_DIR}/mnt/mcache/* || true
sudo mount -o relatime ${CONFIG_DIR}/mcache/data ${CONFIG_DIR}/mnt/mcache

yq e -i '.services.minioserver.environment.MINIO_CACHE_DRIVES = "/mcache"' ${CONFIG_DIR}/docker-compose.yml
yq e -i '.services.minioserver.environment.MINIO_CACHE_EXPIRY = 90' ${CONFIG_DIR}/docker-compose.yml
yq e -i '.services.minioserver.environment.MINIO_CACHE_COMMIT = "writeback"' ${CONFIG_DIR}/docker-compose.yml
yq e -i '.services.minioserver.environment.MINIO_CACHE_QUOTA = 99' ${CONFIG_DIR}/docker-compose.yml
yq e -i '.services.minioserver.environment.MINIO_CACHE_WATERMARK_LOW = 90' ${CONFIG_DIR}/docker-compose.yml
yq e -i '.services.minioserver.environment.MINIO_CACHE_WATERMARK_HIGH = 95' ${CONFIG_DIR}/docker-compose.yml
yq e -i '.services.minioserver.environment.MINIO_WRITE_BACK_INTERVAL = 900' ${CONFIG_DIR}/docker-compose.yml
yq e -i '.services.minioserver.environment.MINIO_MAX_CACHE_FILE_SIZE = 1073741824' ${CONFIG_DIR}/docker-compose.yml
yq e -i '.services.minioserver.environment.MINIO_WRITE_BACK_UPLOAD_WORKERS = 50' ${CONFIG_DIR}/docker-compose.yml
yq e -i '.services.minioserver.environment.MINIO_UPLOAD_QUEUE_TH = 10' ${CONFIG_DIR}/docker-compose.yml

yq eval '.services.minioserver.volumes += ["./mnt/mcache:/mcache"]' -i ${CONFIG_DIR}/docker-compose.yml

if [ "$IS_ENTERPRISE" = true ]; then
sed -i "s/blimp-logsearchapi:${DOCKER_IMAGE}/blimp-logsearchapi:${EDOCKER_IMAGE}/g" ${CONFIG_DIR}/docker-compose.yml
sed -i "s/blimp-minioserver:${DOCKER_IMAGE}/blimp-minioserver:${EDOCKER_IMAGE}/g" ${CONFIG_DIR}/docker-compose.yml
Expand All @@ -252,4 +279,4 @@ while [ ! -d ${CONFIG_DIR}/${CERTIFICATES_DIR}/${BLIMP_DOMAIN} ]; do
sleep 2
done

echo "S3 Server deployment completed."
echo "S3 Server deployment completed."