Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into oz-702
Browse files Browse the repository at this point in the history
  • Loading branch information
VaishSiddharth committed Dec 2, 2024
2 parents 61db9f3 + 7d0cebc commit 6b58ded
Show file tree
Hide file tree
Showing 14 changed files with 125 additions and 22 deletions.
31 changes: 30 additions & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ OPENMRS_DB_NAME=openmrs
#
# OpenMRS frontend
#
SPA_CONFIG_URLS=/openmrs/spa/ozone/ozone-frontend-config.json
SPA_CONFIG_URLS=/openmrs/spa/configs/ozone-frontend-config.json
SPA_DEFAULT_LOCALE=en

# OpenMRS frontend and backend Docker image tag
Expand Down Expand Up @@ -122,6 +122,8 @@ OPENMRS_PROPERTIES_PATH=
OPENMRS_CORE_PATH=
OPENMRS_MODULES_PATH=
OPENMRS_CONFIG_PATH=
OPENMRS_PERSON_IMAGES_PATH=
OPENMRS_COMPLEX_OBS_PATH=
SPA_PATH=
OZONE_CONFIG_PATH=
OPENMRS_OWAS_PATH=
Expand Down Expand Up @@ -157,3 +159,30 @@ ODOO_HOSTNAME=erp-172-17-0-1.traefik.me
SENAITE_HOSTNAME=lims-172-17-0-1.traefik.me
ERPNEXT_HOSTNAME=erpnext-172-17-0-1.traefik.me
FHIR_ODOO_HOSTNAME=fhir-erp-172-17-0-1.traefik.me

#
# Backup
#
RESTIC_REPOSITORY=/restic_data

# Used to encrypt the restic repository
RESTIC_PASSWORD=password

# The snapshot to restore from
RESTIC_RESTORE_SNAPSHOT=latest

RESTIC_KEEP_DAILY=7
RESTIC_KEEP_WEEKLY=4
RESTIC_KEEP_MONTHLY=12
RESTIC_KEEP_YEARLY=3

LOG_LEVEL=info
CRON_SCHEDULE=*/5 * * * *

# Amazon S3 access (Provide if RESTIC_REPOSITORY points to an S3 bucket)
AWS_DEFAULT_REGION=eu-west-1
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=

# Backup path for local restic repository
BACKUP_PATH=
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<p align="center">
<a href="https://docs.ozone-his.com/"><img src="https://www.ozone-his.com/wp-content/uploads/2021/11/Ozone-Logo.png" alt="Ozone" width="30%"/></a>
<a href="https://docs.ozone-his.com/"><img src="https://raw.githubusercontent.com/ozone-his/.github/refs/heads/main/profile/ozone-logo.png" alt="Ozone" width="30%"/></a>
</p>

<h3 align="center">Health Information System</h3>
<h3 align="center">The Instant HIS</h3>

<p align="center">
Welcome to Ozone's open-source repositories!
Expand Down
4 changes: 2 additions & 2 deletions bundled-docker/frontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
FROM openmrs/openmrs-reference-application-3-frontend:nightly
ADD distro/binaries/openmrs/frontend /usr/share/nginx/html
ADD distro/configs/openmrs/frontend_config /usr/share/nginx/html/ozone
ADD distro/configs/openmrs/frontend_config /usr/share/nginx/html/configs
RUN mkdir -p /app
WORKDIR /app
COPY bundled-docker/frontend/startup.sh /app
RUN chmod +x /app/startup.sh
CMD ["/app/startup.sh"]
CMD ["/app/startup.sh"]
6 changes: 2 additions & 4 deletions bundled-docker/frontend/startup.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
#!/bin/sh
set -e
# if [ -f "/usr/share/nginx/html/ozone/ozone-frontend-config.json" ]; then
# envsubst < "/usr/share/nginx/html/ozone/ozone-frontend-config.json" | sponge "/usr/share/nginx/html/ozone/ozone-frontend-config.json"
# fi
for f in /usr/share/nginx/html/ozone/*.json; do

for f in /usr/share/nginx/html/configs/*.json; do
echo "processing===> $f";
envsubst < $f | sponge $f;
done
Expand Down
25 changes: 25 additions & 0 deletions docker-compose-backup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
services:
backup:
image: mekomsolutions/restic-compose-backup
volumes:
- /var/run/docker.sock:/tmp/docker.sock:ro
# Map local restic repository
- ${BACKUP_PATH:-./restic_data}:/restic_data
# Map restic cache
- restic_cache:/cache
environment:
RESTIC_REPOSITORY: ${RESTIC_REPOSITORY}
RESTIC_PASSWORD: ${RESTIC_PASSWORD}
RESTIC_KEEP_DAILY: ${RESTIC_KEEP_DAILY}
RESTIC_KEEP_WEEKLY: ${RESTIC_KEEP_WEEKLY}
RESTIC_KEEP_MONTHLY: ${RESTIC_KEEP_MONTHLY}
RESTIC_KEEP_YEARLY: ${RESTIC_KEEP_YEARLY}
LOG_LEVEL: ${LOG_LEVEL}
CRON_SCHEDULE: ${CRON_SCHEDULE}
AWS_DEFAULT_REGION: ${AWS_DEFAULT_REGION}
AWS_ACCESS_KEY_ID: ${AWS_ACCESS_KEY_ID}
AWS_SECRET_ACCESS_KEY: ${AWS_SECRET_ACCESS_KEY}
networks:
- ozone
volumes:
restic_cache: ~
4 changes: 4 additions & 0 deletions docker-compose-common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ services:
volumes:
- "${MYSQL_DATADIR:-mysql-data}:/var/lib/mysql"
- "${SQL_SCRIPTS_PATH}/mysql/create_db.sh:/docker-entrypoint-initdb.d/create_db.sh"
labels:
restic-compose-backup.mariadb: true

postgresql:
command: "postgres -c wal_level=logical -c max_wal_senders=10 -c max_replication_slots=10"
Expand All @@ -58,6 +60,8 @@ services:
volumes:
- "${POSTGRES_DATADIR:-postgresql-data}:/var/lib/postgresql/data"
- "${SQL_SCRIPTS_PATH}/postgresql/create_db.sh:/docker-entrypoint-initdb.d/create_db.sh"
labels:
restic-compose-backup.postgres: true

volumes:
mysql-data: ~
Expand Down
4 changes: 4 additions & 0 deletions docker-compose-odoo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ services:
traefik.http.middlewares.sslheader.headers.customrequestheaders.X-Forwarded-Proto: https
traefik.http.middlewares.limit.buffering.memRequestBodyBytes: 20971520
traefik.http.middlewares.limit.buffering.maxRequestBodyBytes: 20971520

#=====================================================backup================================================================
restic-compose-backup.volumes: true
restic-compose-backup.volumes.include: "${ODOO_FILESTORE:-odoo-filestore},${ODOO_CONFIG_CHECKSUMS_PATH:-odoo-checksums}"
networks:
- ozone
- web
Expand Down
11 changes: 9 additions & 2 deletions docker-compose-openmrs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ services:
timeout: 5s
retries: 48
start_period: 120s
image: openmrs/openmrs-reference-application-3-backend:${O3_DOCKER_IMAGE_TAG:-nightly}
image: openmrs/openmrs-reference-application-3-backend:3.1.1
labels:
traefik.enable: "true"
traefik.http.routers.openmrs.rule: "Host(`${O3_HOSTNAME}`) && PathPrefix(`/openmrs`)"
Expand All @@ -31,6 +31,9 @@ services:
traefik.http.routers.openmrs.middlewares: openmrs-spa-redirectregex
traefik.http.middlewares.openmrs-spa-redirectregex.redirectregex.regex: https://${O3_HOSTNAME}/openmrs/spa
traefik.http.middlewares.openmrs-spa-redirectregex.redirectregex.replacement: https://${O3_HOSTNAME}/openmrs/spa/home
#=====================================================backup================================================================
restic-compose-backup.volumes: true
restic-compose-backup.volumes.include: "${OPENMRS_CONFIG_CHECKSUMS_PATH:-openmrs-config-checksums},${OPENMRS_PERSON_IMAGES_PATH:-openmrs-person-images},${OPENMRS_COMPLEX_OBS_PATH:-openmrs-complex-obs}"
networks:
- ozone
- web
Expand All @@ -44,6 +47,8 @@ services:
- "${OPENMRS_CONFIG_CHECKSUMS_PATH:-openmrs-config-checksums}:/openmrs/data/configuration_checksums"
- "${OPENMRS_PROPERTIES_PATH}:/etc/properties/"
- "${OPENMRS_PROPERTIES_PATH}/fhirproxy.properties:/openmrs/data/fhirproxy/config.properties"
- "${OPENMRS_PERSON_IMAGES_PATH:-openmrs-person-images}:/openmrs/data/person_images"
- "${OPENMRS_COMPLEX_OBS_PATH:-openmrs-complex-obs}:/openmrs/data/complex_obs"

# OpenMRS 3 Frontend
frontend:
Expand Down Expand Up @@ -84,7 +89,7 @@ services:
restart: unless-stopped
volumes:
- "${OPENMRS_FRONTEND_BINARY_PATH}:/usr/share/nginx/html"
- "${OPENMRS_FRONTEND_CONFIG_PATH}:/usr/share/nginx/html/ozone"
- "${OPENMRS_FRONTEND_CONFIG_PATH}:/usr/share/nginx/html/configs"

mysql:
environment:
Expand All @@ -105,3 +110,5 @@ volumes:
openmrs-data: ~
openmrs-modules: ~
openmrs-owas: ~
openmrs-person-images: ~
openmrs-complex-obs: ~
33 changes: 33 additions & 0 deletions docker-compose-restore.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
services:
openmrs:
depends_on:
restore:
condition: service_completed_successfully
profiles:
- openmrs-restore
odoo:
depends_on:
restore:
condition: service_completed_successfully
profiles:
- odoo-restore
backup:
depends_on:
restore:
condition: service_completed_successfully
restore:
image: mekomsolutions/restic-compose-backup-restore
volumes:
- /var/run/docker.sock:/tmp/docker.sock:ro
# Map local restic repository
- ${BACKUP_PATH:-./restic_data}:/restic_data
environment:
RESTIC_REPOSITORY: ${RESTIC_REPOSITORY}
RESTIC_PASSWORD: ${RESTIC_PASSWORD}
RESTIC_RESTORE_SNAPSHOT: ${RESTIC_RESTORE_SNAPSHOT}
LOG_LEVEL: ${LOG_LEVEL}
AWS_DEFAULT_REGION: ${AWS_DEFAULT_REGION}
AWS_ACCESS_KEY_ID: ${AWS_ACCESS_KEY_ID}
AWS_SECRET_ACCESS_KEY: ${AWS_SECRET_ACCESS_KEY}
networks:
- ozone
2 changes: 2 additions & 0 deletions scripts/destroy-demo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ exportPaths

# Read PROJECT_NAME from the temporary file
PROJECT_NAME=$(cat /tmp/project_name.txt)
# Unset the RESTORE variable if it is set, as the restore Docker Compose files introduces restore specific profiles that will make the Docker Compose file invalid
unset RESTORE

echo "$INFO Destroying $PROJECT_NAME project..."

Expand Down
1 change: 1 addition & 0 deletions scripts/docker-compose-files.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ docker-compose-common.yml
docker-compose-odoo.yml
docker-compose-openmrs.yml
docker-compose-senaite.yml
docker-compose-backup.yml
docker-compose-orthanc.yml
13 changes: 3 additions & 10 deletions scripts/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,11 @@ echo "$PROJECT_NAME" > /tmp/project_name.txt

if ! isOzoneRunning "$PROJECT_NAME"; then
echo "$INFO Starting Ozone project with name: $PROJECT_NAME"
else
echo "$WARN Ozone project with name: $PROJECT_NAME is already running"
echo "$INFO Re-applying Docker Compose up command to ensure all services are up-to-date..."
fi

# Check if an instance of Ozone is already running
suffix=0
while isOzoneRunning "$PROJECT_NAME"; do
echo "$WARN An instance of Ozone is already running with the name: $PROJECT_NAME"
suffix=$((suffix + 1))
export PROJECT_NAME="$PROJECT_NAME-$suffix"
echo "$INFO Starting a new instance of Ozone with name: $PROJECT_NAME"
echo "$PROJECT_NAME" > /tmp/project_name.txt
done

INSTALLED_DOCKER_VERSION=$(docker version -f "{{.Server.Version}}")
MINIMUM_REQUIRED_DOCKER_VERSION_REGEX="^((([2-9][1-9]|[3-9][0]|[0-9]{3,}).*)|(20\.([0-9]{3,}|[1-9][1-9]|[2-9][0]).*)|(20\.10\.([0-9]{3,}|[2-9][0-9]|[1][3-9])))"
if [[ $INSTALLED_DOCKER_VERSION =~ $MINIMUM_REQUIRED_DOCKER_VERSION_REGEX ]]; then
Expand Down
3 changes: 2 additions & 1 deletion scripts/stop-demo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ exportPaths

# Read PROJECT_NAME from the temporary file
PROJECT_NAME=$(cat /tmp/project_name.txt)

# Unset the RESTORE variable if it is set, as the restore Docker Compose files introduces restore specific profiles that will make the Docker Compose file invalid
unset RESTORE
INSTALLED_DOCKER_VERSION=$(docker version -f "{{.Server.Version}}")
MINIMUM_REQUIRED_DOCKER_VERSION_REGEX="^((([2-9][1-9]|[3-9][0]|[0-9]{3,}).*)|(20\.([0-9]{3,}|[1-9][1-9]|[2-9][0]).*)|(20\.10\.([0-9]{3,}|[2-9][0-9]|[1][3-9])))"
if [[ $INSTALLED_DOCKER_VERSION =~ $MINIMUM_REQUIRED_DOCKER_VERSION_REGEX ]]; then
Expand Down
6 changes: 6 additions & 0 deletions scripts/utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,12 @@ function setDockerComposeCLIOptions () {
export dockerComposeFilesCLIOptions="$dockerComposeFilesCLIOptions -f ../$file"
done

# Add restore file if restore env is set

if [ "$RESTORE" == "true" ]; then
export dockerComposeFilesCLIOptions="$dockerComposeFilesCLIOptions -f ../docker-compose-restore.yml"
fi

# Set the default env file
export dockerComposeEnvFilePath="../.env"

Expand Down

0 comments on commit 6b58ded

Please sign in to comment.