Skip to content

Instantly share code, notes, and snippets.

@icyleaf
Last active November 26, 2023 13:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save icyleaf/e2d3a0698da853b026801fd92c655920 to your computer and use it in GitHub Desktop.
Save icyleaf/e2d3a0698da853b026801fd92c655920 to your computer and use it in GitHub Desktop.
Gitea migrate storage from local to minio auto script

Gitea migrate storage script

This is based on offically cli tool built-in subcommand calls migrate-storage.

#!/usr/bin/env bash
MINIO_ENDPOINT=localhost:8080
MINIO_USE_SSL=false
MINIO_SSL_INSECURE_VERIFY=false
MINIO_ACCESS_KEY=123
MINIO_SECRET_KEY=456
MINIO_BUCKET=gitea
GITEA_MIGRATE_TYPES=(attachments lfs avatars repo-avatars repo-archivers packages actions-log)
for type in "${GITEA_MIGRATE_TYPES[@]}"; do
minio_base_path=${type//-/_}
echo "Migrating ${type} ..."
gitea migrate-storage --type=${type} \
--storage=minio \
--minio-endpoint=${MINIO_ENDPOINT} \
--minio-access-key-id=${MINIO_ACCESS_KEY} \
--minio-secret-access-key=${MINIO_SECRET_KEY} \
--minio-bucket=${MINIO_BUCKET} \
--minio-base-path=${minio_base_path}/ \
--minio-use-ssl=${MINIO_USE_SSL} \
--minio-insecure-skip-verify=${MINIO_SSL_INSECURE_VERIFY}
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment