1
0
Fork 0
This commit is contained in:
Ilya Mukhortov 2024-04-04 20:49:12 +10:00
parent 0a6680dc7b
commit 407d1ff18d
3 changed files with 6 additions and 114 deletions

View File

@ -4,13 +4,18 @@ echo "readonly" | docker login docker.med-logic.ru --username readonly --passwor
docker pull docker.med-logic.ru/medicine-remd:latest docker pull docker.med-logic.ru/medicine-remd:latest
read -r -p "Create database? [y/N] " prompt read -r -p "Create database? [y/N] " response
if [[ $prompt =~ [yY](es)* ]] if [[ $prompt =~ [yY](es)* ]]
then then
cd /root/medicine-config/medicine-stack cd /root/medicine-config/medicine-stack
docker-compose exec postgres psql -c 'CREATE DATABASE medicine_remd' --username=postgres docker-compose exec postgres psql -c 'CREATE DATABASE medicine_remd' --username=postgres
fi fi
#if docker exec -it medicine-stack-postgres psql -lqt --username=postgres | cut -d \| -f 1 | grep -qw medicine_remd; then
#else
# docker exec -it medicine-stack-postgres psql -c 'CREATE DATABASE medicine_remd' --username=postgres
#fi
read -p "Enter organization name: " ORGANIZATION_NAME read -p "Enter organization name: " ORGANIZATION_NAME
SECRET_KEY=$(openssl rand -base64 32) SECRET_KEY=$(openssl rand -base64 32)

View File

@ -1,37 +0,0 @@
#!/bin/sh
set -e
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
}
post_update() {
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
}
docker_cleanup() {
docker rmi $(docker images -f "dangling=true" -q)
}
update() {
pull_images
docker-compose stop
docker-compose up -d
post_update
docker_cleanup
}
${COMMAND}

View File

@ -1,76 +0,0 @@
version: '3'
services:
nginx:
image: docker.med-logic.ru/medicine-nginx:latest
container_name: medicine2-nginx
restart: "always"
volumes:
- medicine-public-data:/app/public:ro
links:
- "app:app-host"
ports:
- "810:80"
- "811:443"
networks:
- default
- medicine-network
logging:
driver: "json-file"
options:
max-size: "200k"
max-file: "10"
app:
image: docker.med-logic.ru/medicine-app:latest
container_name: medicine2-app
restart: "always"
environment:
UWSGI_PROCESSES: 2
UWSGI_THREADS: 2
expose:
- "840"
command: /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf
volumes:
- medicine-public-data:/app/public
- ./.env:/app/.env
networks:
- default
- medicine-network
external_links:
- "postgres:postgres-host"
- "redis:redis-host"
logging:
driver: "json-file"
options:
max-size: "200k"
max-file: "10"
tasks:
image: docker.med-logic.ru/medicine-app:latest
container_name: medicine2-tasks
restart: "always"
command: /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord-tasks.conf
volumes:
- ./.env:/app/.env
- medicine-public-data:/app/public
networks:
- default
- medicine-network
external_links:
- "postgres:postgres-host"
- "redis:redis-host"
logging:
driver: "json-file"
options:
max-size: "200k"
max-file: "10"
volumes:
medicine-public-data:
networks:
medicine-network:
external:
name: "medicine-network"