Skip to content

Commit

Permalink
Release 2.13.1 (#141)
Browse files Browse the repository at this point in the history
* Add CASEARCHIVEDAYS and EVENTARCHIVEDAYS to docker-compose

* pg_dump: schedule crons on a random basis. Keep dumps for 5 hours (default)

* remove cron entries for db_dump in docker-compose.yml

* less jobs during night times and keep the last 10 dumps

* Setup documents directory and corresponding docker volume

Related to SORMAS-Foundation/SORMAS-Project#2328

* release 2.13.1

Co-authored-by: nliakm <[email protected]>
Co-authored-by: akm <[email protected]>
Co-authored-by: Tom Hutter <[email protected]>
Co-authored-by: Thomas Broyer <[email protected]>
Co-authored-by: Adrian Sorge <[email protected]>
  • Loading branch information
6 people authored Nov 23, 2020
1 parent 2295025 commit ef7effa
Show file tree
Hide file tree
Showing 10 changed files with 30 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
SORMAS_POSTGRES_PASSWORD=password

SORMAS_POSTGRES_USER=sormas_user
SORMAS_DOCKER_VERSION=2.13.0
SORMAS_DOCKER_VERSION=2.13.1
SORMAS_VERSION=1.51.1
SORMAS_SERVER_URL=sormas-docker-test.com
SORMAS_URL=https://github.com/hzi-braunschweig/SORMAS-Project/releases/download/
Expand Down
6 changes: 5 additions & 1 deletion docker-compose-external-db.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,12 @@ services:
- JVM_MAX=${APPSERVER_JVM_MAX}
- GEO_UUID=${GEO_UUID}
- DEVMODE=${DEVMODE}
- JSON_LOGGING=${JSON_LOGGING}
- JSON_LOGGING=${JSON_LOGGING}
- CASEARCHIVEDAYS=${CASEARCHIVEDAYS}
- EVENTARCHIVEDAYS=${EVENTARCHIVEDAYS}

volumes:
- ${SORMAS_PATH}/documents:/opt/sormas/documents
- ${SORMAS_PATH}/custom:/opt/sormas/custom
- ${SORMAS_PATH}/sormas-logs:/opt/domains/sormas/logs
depends_on:
Expand Down
3 changes: 3 additions & 0 deletions docker-compose-keycloak.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,10 @@ services:
- GEO_TEMPLATE=${GEO_TEMPLATE}
- GEO_LONG_TEMPLATE=${GEO_LONG_TEMPLATE}
- GEO_LAT_TEMPLATE=${GEO_LAT_TEMPLATE}
- CASEARCHIVEDAYS=${CASEARCHIVEDAYS}
- EVENTARCHIVEDAYS=${EVENTARCHIVEDAYS}
volumes:
- ${SORMAS_PATH}/documents:/opt/sormas/documents
- ${SORMAS_PATH}/custom:/opt/sormas/custom
- ${SORMAS_PATH}/sormas-logs:/opt/domains/sormas/logs
- ./apache2/certs:/tmp/certs
Expand Down
3 changes: 3 additions & 0 deletions docker-compose-s2s.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,10 @@ services:
- SORMAS_HTTPS_PORT=443
- SORMAS_S2S_CERT_PASS=${SORMAS_S2S_CERT_PASS}password
- SORMAS_S2S_REST_PASSWORD=${SORMAS_S2S_REST_PASSWORD}passwordpassword
- CASEARCHIVEDAYS=${CASEARCHIVEDAYS}
- EVENTARCHIVEDAYS=${EVENTARCHIVEDAYS}
volumes:
- ${SORMAS_PATH}/documents:/opt/sormas/documents
- ${SORMAS_PATH}/custom:/opt/sormas/custom
- ${SORMAS_PATH}/sormas2sormas:/opt/sormas/sormas2sormas
- ${SORMAS_PATH}/sormas-logs:/opt/domains/sormas/logs
Expand Down
6 changes: 3 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ services:
- GEO_TEMPLATE=${GEO_TEMPLATE}
- GEO_LONG_TEMPLATE=${GEO_LONG_TEMPLATE}
- GEO_LAT_TEMPLATE=${GEO_LAT_TEMPLATE}
- CASEARCHIVEDAYS=${CASEARCHIVEDAYS}
- EVENTARCHIVEDAYS=${EVENTARCHIVEDAYS}
volumes:
- ${SORMAS_PATH}/documents:/opt/sormas/documents
- ${SORMAS_PATH}/custom:/opt/sormas/custom
- ${SORMAS_PATH}/sormas2sormas:/opt/sormas/sormas2sormas
- ${SORMAS_PATH}/sormas-logs:/opt/domains/sormas/logs
Expand Down Expand Up @@ -94,9 +97,6 @@ services:
- PGPASSWORD=${SORMAS_POSTGRES_PASSWORD}
- SORMAS_POSTGRES_USER=${SORMAS_POSTGRES_USER}
- TZ=${TZ}
- MIN=15,45 # Twice the hour on 15 and 45 (use crontab notation)
- HOUR= # Keep empty for every hour. Use crontab notation otherwise
- KEEP=1 # keep db dumps for one day in backup folder
volumes:
- /backup:/var/opt/db_dumps
cpus: ${DB_DUMP_CPUS}
Expand Down
4 changes: 4 additions & 0 deletions docker-compose_nginx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ services:
- GEO_UUID=${GEO_UUID}
- DEVMODE=${DEVMODE}
- JSON_LOGGING=${JSON_LOGGING}
- CASEARCHIVEDAYS=${CASEARCHIVEDAYS}
- EVENTARCHIVEDAYS=${EVENTARCHIVEDAYS}

volumes:
- ${SORMAS_PATH}/documents:/opt/sormas/documents
- ${SORMAS_PATH}/custom:/opt/sormas/custom
- ${SORMAS_PATH}/sormas2sormas:/opt/sormas/sormas2sormas
- ${SORMAS_PATH}/sormas-logs:/opt/domains/sormas/logs
Expand Down
6 changes: 4 additions & 2 deletions pg_dump/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@ set -e
# MIN="17"
# HOUR="*/2"

MIN=${MIN:-15,45}
HOUR=${HOUR:-*}
RAND=$(( $RANDOM % 19 + 1 ))

MIN=${MIN:-${RAND},$(( ${RAND} + 30 ))}
HOUR=${HOUR:-0,4,7,8,9,10,11,12,13,14,15,16,17,18,20}

cat<<EOF | crontab -
# min hour day month weekday command
Expand Down
9 changes: 4 additions & 5 deletions pg_dump/pg_dump
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
DATE=$( date +%F-%T )
DUMP_PATH=/var/opt/db_dumps
LOG=${DUMP_PATH}/pg_dump.log
KEEP=${KEEP:-1}
KEEP=${KEEP:-300}

DBS="${DB_NAME} ${DB_NAME_AUDIT}"

Expand All @@ -21,7 +21,6 @@ for d in ${DBS};do
done

echo "Deleting old dumps" >> ${LOG}
# keep 1 day => delete all files with mtime +0
find ${DUMP_PATH} -name \*.sql.gz -mtime +$(( ${KEEP} - 1 )) | xargs -r rm
find ${DUMP_PATH} -name \*.sql -mtime +$(( ${KEEP} - 1 )) | xargs -r rm
echo >> ${LOG};echo >> ${LOG}
# keep 1 day => delete all but the last 10 dumps
ls -rt ${DUMP_PATH}/sormas.20*.gz | head -n -10 | xargs -r rm
ls -rt ${DUMP_PATH}/sormas_audit.20*.gz | head -n -10 | xargs -r rm
2 changes: 2 additions & 0 deletions sormas/setup-server.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ USER_NAME=payara
PAYARA_HOME=${ROOT_PREFIX}/opt/payara5
DOMAINS_HOME=${ROOT_PREFIX}/opt/domains
TEMP_DIR=${ROOT_PREFIX}/opt/${DOMAIN_NAME}/temp
DOCUMENTS_DIR=${ROOT_PREFIX}/opt/${DOMAIN_NAME}/documents
GENERATED_DIR=${ROOT_PREFIX}/opt/${DOMAIN_NAME}/generated
CUSTOM_DIR=${ROOT_PREFIX}/opt/${DOMAIN_NAME}/custom

Expand All @@ -23,6 +24,7 @@ LOG_FILE_NAME=server_update_`date +"%Y-%m-%d_%H-%M-%S"`.log
mkdir -p ${PAYARA_HOME}
mkdir -p ${DOMAINS_HOME}
mkdir -p ${TEMP_DIR}
mkdir -p ${DOCUMENTS_DIR}
mkdir -p ${GENERATED_DIR}
mkdir -p ${CUSTOM_DIR}
mkdir -p ${DEPLOY_PATH}
Expand Down
1 change: 1 addition & 0 deletions sormas/start-server.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ USER_NAME=payara
PAYARA_HOME=${ROOT_PREFIX}/opt/payara5
DOMAINS_HOME=${ROOT_PREFIX}/opt/domains
TEMP_DIR=${ROOT_PREFIX}/opt/${DOMAIN_NAME}/temp
DOCUMENTS_DIR=${ROOT_PREFIX}/opt/${DOMAIN_NAME}/documents
GENERATED_DIR=${ROOT_PREFIX}/opt/${DOMAIN_NAME}/generated
CUSTOM_DIR=${ROOT_PREFIX}/opt/${DOMAIN_NAME}/custom

Expand Down

0 comments on commit ef7effa

Please sign in to comment.