Skip to content

Commit

Permalink
update minter migraiton deployment script
Browse files Browse the repository at this point in the history
  • Loading branch information
jsjiang committed Oct 10, 2023
1 parent b376a14 commit 36549b4
Showing 1 changed file with 52 additions and 19 deletions.
71 changes: 52 additions & 19 deletions deploy_minter_migration.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,38 +1,71 @@
# run shoulder-check-minters command to check minters before running deployment
python manager.py shoulder-check-minters
echo "Start minter migration steps ..."
echo "1. Check minters"

# fix minter issues if needed
read -p "Have you run the shoulder-check-minters command to check the minters? [yes/no]: " yn
if [[ "$yn" == "yes" ]]; then
read -p "Do you wish to continue to next step? [yes/no]: " next_step
if [[ "$next_step" != "yes" ]]; then
echo "Minter migration aborted."
exit
fi
elif [[ "$yn" == "no" ]]; then
cat <<EOF
Please finish checking minters before proceeding to the next step:
a. Run the shoulder-check-minters:
python manage.py shoulder-check-minters"
b. Review the output
c. Fix issues if needed
d. Rerun this minter migration script
EOF
exit
else
echo "Please answer yes or no."
exit
fi

#
## update/deploy EZID code
# set DB user to eziddba

echo "shutdown EZID servies"
echo "2. Shutdown EZID servies"
sudo cdlsysctl stop ezid
sudo cdlsysctl stop ezid-proc-*

echo "backup minter files"
echo "3. Update/Deploy EZID code"
read -p "Is EZID on the right tag/branch? [yes/no]: " yn
if [[ "$yn" != "yes" ]]; then
echo "Please update/deploy EZID code to the preferred tag/branch."
echo "On EZID Stg/Prd server, run the Puppet apply script to deploy EZID code:"
echo "uc3_pupapply.sh --exec --no-services"
exit
fi

echo "4. Modify EZID settings to use the eziddba account for data model migration."
read -p "Is EZID on the right tag/branch? [yes/no]: " yn
if [[ "$yn" != "yes" ]]; then
echo "Please update the database user to eziddba in the settings.py file."
exit
fi

echo "5. Backup minter files"
timestamp=`date '+%Y%m%d%H%M%S'`
minters_bk="minters.${timestamp}"

cp -r ~/var/minters ~/var/${minters_bk}

echo "backed up minter files to ${minters_bk}"
echo "Minter files are backed up to: ${minters_bk}"

echo "Generate a data migration files"
python manage.py makemigrations

echo "Apply the migration file to the database"
echo "6. Apply EZID migration files to the database"
python manage.py migrate

echo "run minter data migration script"
echo "7. Run the minter data migration script"
python manage.py migrate-minters-to-mysql

echo "rename var/minters to disable BDB minter"
echo "8. Rename var/minters to disable BDB version minters"
mv ~/var/minters ~/var/minters.sql_migration

echo "renamed to ~/var/minters.sql_migration"
echo "BDB minters has been renamed to ~/var/minters.sql_migration"

echo "Perform post-migration steps:"
echo "9. Review minter data migration results"
echo "10. Modify EZID settings to use the ezidrw account"
echo "11. Restart EZID services"


echo "restart EZID services"
sudo cdlsysctl start ezid

0 comments on commit 36549b4

Please sign in to comment.