Fixes s3 playbook + adds notice to run migration directly on the servers

This commit is contained in:
Maximilian Kratz 2023-03-29 07:31:15 +02:00
parent 5bc985b2a6
commit 8ae3c2b474
5 changed files with 40 additions and 2 deletions

2
.gitignore vendored
View File

@ -18,3 +18,5 @@ vars/woodpecker_production.yml
vars/woodpecker_staging.yml
vars/backup.yml
s3-migration/local-storage/

View File

@ -11,6 +11,8 @@ Steps (in theory):
- Re-deploy a new instance with the new backend version to replace the old instance
- Migrate metadata + bucket data from temporary instance to the new instance
Please notice: `mc` copies the whole data over the network. Due to slow speeds at home/office, it is recommend to run the migration on one of the servers.
## Commands/Steps to run

10
s3-migration/install-mc.sh Executable file
View File

@ -0,0 +1,10 @@
#!/bin/bash
set -e
curl https://dl.min.io/client/mc/release/linux-amd64/mc \
--create-dirs \
-o $HOME/minio-binaries/mc
chmod +x $HOME/minio-binaries/mc
export PATH=$PATH:$HOME/minio-binaries/

View File

@ -0,0 +1,24 @@
#!/bin/bash
set -e
# Check for existing ENVs
if [[ -z "$ACCESSKEY" ]]; then
echo "=> No ACCESSKEY ENV found. Exit."; exit 1 ;
fi
if [[ -z "$SECRETKEY" ]]; then
echo "=> No SECRETKEY ENV found. Exit."; exit 1 ;
fi
if [[ -z "$SOURCE" ]]; then
echo "=> No SOURCE ENV found. Exit."; exit 1 ;
fi
if [[ -z "$TARGET" ]]; then
echo "=> No TARGET ENV found. Exit."; exit 1 ;
fi
mc alias set s3src $SOURCE $ACCESSKEY $SECRETKEY
mc mirror -preserve --watch s3src/gitea $TARGET

View File

@ -2,9 +2,9 @@
- name: Check SSH port
import_playbook: ssh.yaml
- name: (Re-)Deploy Minio S3
hosts: staging
hosts: all
roles:
- minio-dc
become: true
vars:
instance_url: "{{staging_url}}"
instance_url: "{{prod_url}}"