pass
This commit is contained in:
parent
b1b470cbec
commit
2049e224da
|
|
@ -0,0 +1,21 @@
|
|||
|
||||
sudo apt-get update
|
||||
sudo apt-get install \
|
||||
apt-transport-https \
|
||||
ca-certificates \
|
||||
curl \
|
||||
gnupg-agent \
|
||||
software-properties-common
|
||||
|
||||
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
|
||||
sudo apt-key fingerprint 0EBFCD88
|
||||
|
||||
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
|
||||
|
||||
sudo apt-get update
|
||||
sudo apt-get install docker-ce docker-ce-cli containerd.io
|
||||
|
||||
docker ps
|
||||
|
||||
apt-get install python-pip3
|
||||
pip3 install docker-compose
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
|
||||
set -e
|
||||
|
||||
cd /root
|
||||
git clone https://bitbucket.org/med-logic/medicine-config.git
|
||||
|
||||
echo "readonly" | docker login docker.med-logic.ru --username readonly --password-stdin
|
||||
|
||||
docker network create medicine-network
|
||||
|
||||
docker pull docker.med-logic.ru/medicine-nginx:latest
|
||||
docker pull docker.med-logic.ru/medicine-app:latest
|
||||
docker pull docker.med-logic.ru/tfoms-patient:latest
|
||||
docker pull docker.med-logic.ru/medicine-timetable
|
||||
|
||||
cd /root/medicine-config/thirdparty-apps
|
||||
docker-compose pull
|
||||
docker-compose build
|
||||
|
||||
cd /root/medicine-config/medicine-stack
|
||||
docker-compose up -d
|
||||
sleep 10
|
||||
docker-compose exec postgres psql -c 'CREATE DATABASE medicine' --username=postgres
|
||||
docker-compose exec postgres psql -c 'CREATE DATABASE tfoms_patient' --username=postgres
|
||||
|
||||
docker-compose exec postgres psql -d medicine -c "CREATE ROLE readonly; GRANT USAGE ON SCHEMA public TO readonly; GRANT SELECT ON ALL TABLES IN SCHEMA public TO readonly; ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO readonly; CREATE USER readonly_user WITH PASSWORD 'readonly_password'; GRANT readonly TO readonly_user; ALTER ROLE readonly WITH LOGIN;" --username=postgres
|
||||
|
||||
cd /root/medicine-config/thirdparty-apps
|
||||
docker-compose up -d
|
||||
|
||||
cd /root/medicine-config/tfoms-patient
|
||||
docker-compose up -d
|
||||
|
||||
cd /root/medicine-config/medicine
|
||||
|
||||
|
||||
docker exec -i medicine-stack-postgres pg_dump --no-owner -U postgres -F c medicine > /root/medicine-backups/latest_database.tar.gz --exclude-table-data=riisz_logging --exclude-table-data=reversion_*
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
|
||||
version: '3'
|
||||
|
||||
services:
|
||||
|
||||
nginx:
|
||||
external_links:
|
||||
- "tfoms-patient:patient-search-host"
|
||||
|
||||
app:
|
||||
external_links:
|
||||
- "tfoms-patient:patient-search-host"
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
#!/bin/sh
|
||||
|
||||
COMMAND="$1"
|
||||
ARGUMENT="$2"
|
||||
|
||||
pull_images() {
|
||||
echo "readonly" | docker login docker.med-logic.ru --username readonly --password-stdin
|
||||
docker pull docker.med-logic.ru/medicine-app:latest
|
||||
docker pull docker.med-logic.ru/medicine-nginx:latest
|
||||
}
|
||||
|
||||
backup_database() {
|
||||
year_month=$(date +%Y%m)
|
||||
backup_date = $(date %Y%m%d_%H%M)
|
||||
mkdir -p foo "/root/medicine-backups/${year_month}"
|
||||
docker exec -i medicine-stack-postgres \
|
||||
pg_dump --no-owner -U postgres -F c \
|
||||
medicine > "/root/medicine-backups/${year_month}/${backup_date}_database.tar.gz" \
|
||||
--exclude-table-data=riisz_logging --exclude-table-data=reversion_*
|
||||
}
|
||||
|
||||
update() {
|
||||
pull_images
|
||||
backup_database
|
||||
|
||||
docker-compose stop
|
||||
docker-compose up -d
|
||||
docker-compose run --rm app python manage.py migrate directory --noinput
|
||||
docker-compose run --rm app python manage.py directory_importdata all
|
||||
docker-compose run --rm app python manage.py migrate --noinput
|
||||
docker-compose run --rm app python manage.py collectstatic --noinput
|
||||
docker-compose run --rm app python manage.py post_update
|
||||
}
|
||||
|
||||
fast_update() {
|
||||
pull_images
|
||||
docker-compose stop
|
||||
docker-compose up -d
|
||||
}
|
||||
|
||||
${COMMAND}
|
||||
34
run
34
run
|
|
@ -1,34 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
COMMAND="$1"
|
||||
ARGUMENT="$2"
|
||||
|
||||
bash() {
|
||||
docker-compose exec ${ARGUMENT} bash
|
||||
}
|
||||
|
||||
git_ignore_filemode() {
|
||||
git config core.fileMode false
|
||||
}
|
||||
|
||||
update_thirdparty_apps() {
|
||||
docker-compose -f docker-compose.thirdparty-apps.yml stop
|
||||
docker-compose -f docker-compose.thirdparty-apps.yml build
|
||||
docker-compose -f docker-compose.thirdparty-apps.yml up -d
|
||||
}
|
||||
|
||||
update_tfoms_patient() {
|
||||
docker pull docker.med-logic.ru/tfoms-patient:latest
|
||||
docker-compose -f docker-compose.tfoms-patient.yml stop
|
||||
docker-compose -f docker-compose.tfoms-patient.yml up -d
|
||||
}
|
||||
|
||||
update_medicine() {
|
||||
docker pull docker.med-logic.ru/medicine-app:latest
|
||||
docker pull docker.med-logic.ru/medicine-nginx:latest
|
||||
docker-compose -f docker-compose.medicine.yml stop
|
||||
docker-compose -f docker-compose.medicine.yml up -d
|
||||
|
||||
}
|
||||
|
||||
${COMMAND}
|
||||
Loading…
Reference in New Issue