Skip to content

Commit

Permalink
Merge pull request #15 from mozzy11/main
Browse files Browse the repository at this point in the history
Add Offline installtion option
  • Loading branch information
mozzy11 authored Oct 30, 2024
2 parents b64c179 + 60062d9 commit fe71b4f
Show file tree
Hide file tree
Showing 4 changed files with 170 additions and 0 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/build-installer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Build OpenELIS-Global-2 Offline Docker Images
on:
release:
types: [published]

jobs:
build-installer-and-upload-installer:
runs-on: ubuntu-latest
steps:

- name: Checkout OpenELIS-Global2
uses: actions/checkout@v2
with:
repository: ${{github.repository}}

- name: Build installer
run: ./build.sh ${{github.ref_name}} develop

- name: check installer
run: ls OEDockerImages


- name: Find installer file
id: find_file
run: |
# Find the file in OEDockerImages with .tar.gz extension
FILE_PATH=$(find OEDockerImages -name "*.tar.gz" -print -quit)
if [ -z "$FILE_PATH" ]; then
echo "No .tar.gz file found in OEDockerImages directory."
exit 1
fi
echo "File path: $FILE_PATH"
# Extract the file name from the path
FILE_NAME=$(basename "$FILE_PATH")
echo "File name: $FILE_NAME"
# Pass the file path and name to outputs
echo "FILE_PATH=$FILE_PATH" >> $GITHUB_ENV
echo "FILE_NAME=$FILE_NAME" >> $GITHUB_ENV
- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ${{ env.FILE_PATH }}
asset_name: ${{ env.FILE_NAME }}
asset_content_type: application/gzip

24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ You can find more information on how to set up OpenELIS at our [docs page](http:

[![Publish Docker Image Status](https://github.com/I-TECH-UW/OpenELIS-Global-2/actions/workflows/publish-and-test.yml/badge.svg)](https://github.com/I-TECH-UW/OpenELIS-Global-2/actions/workflows/publish-and-test.yml)

[![Build Off Line Docker Images](https://github.com/I-TECH-UW/openelis-docker/actions/workflows/build-installer.yml/badge.svg)](https://github.com/I-TECH-UW/openelis-docker/actions/workflows/build-installer.yml)

## ONLINE INSTALLATION
### Running OpenELIS Global 3x with docker-compose
docker-compose up -d

Expand All @@ -25,3 +28,24 @@ You can find more information on how to set up OpenELIS at our [docs page](http:
| Instance | URL | credentials (user: password)|
|---------- |:-------------:|------: |
| OpenElis | https://localhost:8443/OpenELIS-Global/  | admin: adminADMIN! |


## OFFLINE INSTALLTION

For offline Installtion,where theres no Intenet acess,

1. Download the prepackaged Docker images from the [Release Artifacts](https://github.com/I-TECH-UW/openelis-docker/releases)

1. Unzip the OpenELIS-Global Docker images zip file
```tar xzf OpenELIS-Global_<verion>_docker_images.tar.gz```

1. Move to directory of the Unziped Docker Images file
```cd OpenELIS-Global_<verion>_docker_images```
1. Load the images by running
```./loadImages.sh```

1. Then Move to the root of this project
```cd openelis-docker```
1. Start the containers
``` docker-compose up -d```

86 changes: 86 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
#!/bin/bash
projectVersion=${1:-"latest"}
dockerVersion=${2:-"develop"}

INSTALLER_CREATION_DIR="OEDockerImages"
CALL_DIR=$PWD

cd ${CALL_DIR}
if [ -d "${INSTALLER_CREATION_DIR}" ]
then
while true; do
read -p "Installer directory has been detected, replace it? [Y]es [N]o: " yn
case $yn in
[Yy][Ee][Ss]|[Yy] ) break;;
[Nn][Oo]|[Nn] ) exit;;
* ) echo "Please answer yes or no.";;
esac
done
rm -r ${INSTALLER_CREATION_DIR}
fi

echo "creating docker images"

createLinuxInstaller() {
context="OpenELIS-Global"
installerName="${context}_${projectVersion}_docker_images"

echo "creating installer for context ${context}"
mkdir -p ${INSTALLER_CREATION_DIR}/${installerName}/dockerImage
cp ./install/loadImages.sh ${INSTALLER_CREATION_DIR}/${installerName}/loadImages.sh
cp OpenELIS-Global_DockerImage.tar.gz ${INSTALLER_CREATION_DIR}/${installerName}/dockerImage/OpenELIS-Global_DockerImage.tar.gz
cp Postgres_DockerImage.tar.gz ${INSTALLER_CREATION_DIR}/${installerName}/dockerImage/Postgres_DockerImage.tar.gz
cp JPAServer_DockerImage.tar.gz ${INSTALLER_CREATION_DIR}/${installerName}/dockerImage/JPAServer_DockerImage.tar.gz
cp AutoHeal_DockerImage.tar.gz ${INSTALLER_CREATION_DIR}/${installerName}/dockerImage/AutoHeal_DockerImage.tar.gz
cp NGINX_DockerImage.tar.gz ${INSTALLER_CREATION_DIR}/${installerName}/dockerImage/NGINX_DockerImage.tar.gz
cp ReactFrontend_DockerImage.tar.gz ${INSTALLER_CREATION_DIR}/${installerName}/dockerImage/ReactFrontend_DockerImage.tar.gz
cp Certs_DockerImage.tar.gz ${INSTALLER_CREATION_DIR}/${installerName}/dockerImage/Certs_DockerImage.tar.gz

cd ${INSTALLER_CREATION_DIR}
tar -cf ${installerName}.tar ${installerName}
gzip ${installerName}.tar

rm -r ${installerName}
cd ${CALL_DIR}
}

cd ${CALL_DIR}
echo "saving docker image as OpenELIS-Global_DockerImage.tar.gz"
docker pull itechuw/openelis-global-2:${dockerVersion}
docker save itechuw/openelis-global-2:${dockerVersion} | gzip > OpenELIS-Global_DockerImage.tar.gz

echo "saving React frontend docker image"
docker pull itechuw/openelis-global-2-frontend:${dockerVersion}
docker save itechuw/openelis-global-2-frontend:${dockerVersion} | gzip > ReactFrontend_DockerImage.tar.gz

echo "saving JPA Server docker image"
docker pull itechuw/openelis-global-2-fhir:${dockerVersion}
docker save itechuw/openelis-global-2-fhir:${dockerVersion} | gzip > JPAServer_DockerImage.tar.gz

echo "saving Postgres docker image"
docker pull postgres:14.4
docker save postgres:14.4 | gzip > Postgres_DockerImage.tar.gz

echo "saving Autoheal docker image"
docker pull willfarrell/autoheal:1.2.0
docker save willfarrell/autoheal:1.2.0 | gzip > AutoHeal_DockerImage.tar.gz

echo "saving NGINX docker image"
docker pull itechuw/openelis-global-2-proxy:${dockerVersion}
docker save itechuw/openelis-global-2-proxy:${dockerVersion} | gzip > NGINX_DockerImage.tar.gz

echo "saving Certs docker image"
docker pull itechuw/certgen:main
docker save itechuw/certgen:main | gzip > Certs_DockerImage.tar.gz

cd ${CALL_DIR}
createLinuxInstaller

rm OpenELIS-Global_DockerImage*.tar.gz
rm Postgres_DockerImage.tar.gz
rm JPAServer_DockerImage.tar.gz
rm AutoHeal_DockerImage.tar.gz
rm NGINX_DockerImage.tar.gz
rm ReactFrontend_DockerImage.tar.gz
rm Certs_DockerImage.tar.gz

11 changes: 11 additions & 0 deletions install/loadImages.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash
cd dockerImage
gunzip -c OpenELIS-Global_DockerImage.tar.gz | docker load
gunzip -c Postgres_DockerImage.tar.gz | docker load
gunzip -c JPAServer_DockerImage.tar.gz | docker load
gunzip -c AutoHeal_DockerImage.tar.gz | docker load
gunzip -c NGINX_DockerImage.tar.gz | docker load
gunzip -c ReactFrontend_DockerImage.tar.gz | docker load
gunzip -c Certs_DockerImage.tar.gz | docker load


0 comments on commit fe71b4f

Please sign in to comment.