From b9b286717ee6f4907d14004b21dc7362c5ec8478 Mon Sep 17 00:00:00 2001 From: Ilya Mukhortov Date: Thu, 30 Jan 2025 10:10:54 +1000 Subject: [PATCH] pass --- bash_scripts/install-medicine.sh | 3 +++ bash_scripts/install-remd.sh | 3 +-- medicine/backup_database.sh | 1 + medicine/pull-and-migrate.sh | 7 +++++++ 4 files changed, 12 insertions(+), 2 deletions(-) create mode 100755 medicine/pull-and-migrate.sh diff --git a/bash_scripts/install-medicine.sh b/bash_scripts/install-medicine.sh index bbe722e..c488e14 100755 --- a/bash_scripts/install-medicine.sh +++ b/bash_scripts/install-medicine.sh @@ -9,6 +9,7 @@ unzip /root/medicine-config/backups/medicine.sql.zip -d /root/medicine-config/vo docker exec -i medicine-stack-postgres psql -U postgres -d medicine -f /files/medicine.sql read -p "Enter organization name: " ORGANIZATION_NAME +read -p "Enter organization id: " ORGANIZATION_ID SECRET_KEY=$(openssl rand -base64 32) @@ -18,6 +19,8 @@ SECRET_KEY=$SECRET_KEY SENTRY_SITE=$ORGANIZATION_NAME +ORGANIZATION_ID=$ORGANIZATION_ID + EOT cd /root/medicine-config/medicine diff --git a/bash_scripts/install-remd.sh b/bash_scripts/install-remd.sh index 6365428..20c5e1b 100755 --- a/bash_scripts/install-remd.sh +++ b/bash_scripts/install-remd.sh @@ -7,8 +7,7 @@ docker pull docker.med-logic.ru/medicine-remd:latest read -r -p "Create database? [y/N] " response if [[ $prompt =~ [yY](es)* ]] then - cd /root/medicine-config/medicine-stack - docker-compose exec postgres psql -c 'CREATE DATABASE medicine_remd' --username=postgres + docker exec medicine-stack-postgres psql -c 'CREATE DATABASE medicine_remd' --username=postgres fi read -p "Enter organization name: " ORGANIZATION_NAME diff --git a/medicine/backup_database.sh b/medicine/backup_database.sh index 2c275da..a59bf33 100755 --- a/medicine/backup_database.sh +++ b/medicine/backup_database.sh @@ -19,3 +19,4 @@ if test -f "${archive_filename}"; then fi tar -czf "${archive_filename}" "${backup_filename}" rm "${backup_filename}" + diff --git a/medicine/pull-and-migrate.sh b/medicine/pull-and-migrate.sh new file mode 100755 index 0000000..5c9f243 --- /dev/null +++ b/medicine/pull-and-migrate.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +set -e + +echo "readonly" | docker login docker.med-logic.ru --username readonly --password-stdin +docker pull docker.med-logic.ru/medicine:latest +docker run --rm --env-file .env --name medicine-apply-migrations docker.med-logic.ru/medicine:latest python manage.py migrate