From 5443712115e3a2f6592f3188fcbc3f46745e5192 Mon Sep 17 00:00:00 2001 From: mozzy11 Date: Wed, 30 Oct 2024 19:21:26 +0300 Subject: [PATCH 1/7] add action to build docker image files --- .github/workflows/build-installer.yml | 49 +++++++++++++++++ build.sh | 79 +++++++++++++++++++++++++++ install/loadImages.sh | 11 ++++ 3 files changed, 139 insertions(+) create mode 100644 .github/workflows/build-installer.yml create mode 100755 build.sh create mode 100755 install/loadImages.sh diff --git a/.github/workflows/build-installer.yml b/.github/workflows/build-installer.yml new file mode 100644 index 0000000..28783fe --- /dev/null +++ b/.github/workflows/build-installer.yml @@ -0,0 +1,49 @@ +name: Build OpenELIS-Global-2 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 }} + + - 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 + diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..26efdcd --- /dev/null +++ b/build.sh @@ -0,0 +1,79 @@ +#!/bin/bash +projectVersion=${1:-"latest"} +INSTALLER_CREATION_DIR="OEDockerImages " + +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}_dockerImages" + + echo "creating installer for context ${context}" + mkdir -p ${INSTALLER_CREATION_DIR}/${installerName} + 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 +} + + +echo "saving docker image as OpenELIS-Global_DockerImage.tar.gz" +docker pull itechuw/openelis-global-2:develop +docker save itechuw/openelis-global-2:develop | gzip > OpenELIS-Global_DockerImage.tar.gz + +echo "saving React frontend docker image" +docker pull itechuw/openelis-global-2-frontend:develop +docker save itechuw/openelis-global-2-frontend:develop | gzip > ReactFrontend_DockerImage.tar.gz + +echo "saving JPA Server docker image" +docker pull itechuw/openelis-global-2-fhir:develop +docker save itechuw/openelis-global-2-fhir:develop | 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:develop +docker save itechuw/openelis-global-2-proxy:develop | 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 + + +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 + diff --git a/install/loadImages.sh b/install/loadImages.sh new file mode 100755 index 0000000..3a67da6 --- /dev/null +++ b/install/loadImages.sh @@ -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 + + From a91d1902f60fd7f440d93e2a4084ab7e3790c7c3 Mon Sep 17 00:00:00 2001 From: mozzy11 Date: Wed, 30 Oct 2024 19:43:03 +0300 Subject: [PATCH 2/7] update --- build.sh | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/build.sh b/build.sh index 26efdcd..9f8cf5a 100755 --- a/build.sh +++ b/build.sh @@ -1,7 +1,9 @@ #!/bin/bash projectVersion=${1:-"latest"} -INSTALLER_CREATION_DIR="OEDockerImages " +INSTALLER_CREATION_DIR="OEDockerImages" +CALL_DIR=$PWD +cd ${CALL_DIR} if [ -d "${INSTALLER_CREATION_DIR}" ] then while true; do @@ -18,7 +20,7 @@ fi echo "creating docker images" createLinuxInstaller() { - context="OpenELIS-Global " + context="OpenELIS-Global" installerName="${context}_${projectVersion}_dockerImages" echo "creating installer for context ${context}" @@ -35,9 +37,11 @@ createLinuxInstaller() { cd ${INSTALLER_CREATION_DIR} tar -cf ${installerName}.tar ${installerName} gzip ${installerName}.tar -} + cd ${CALL_DIR} +} +cd ${CALL_DIR} echo "saving docker image as OpenELIS-Global_DockerImage.tar.gz" docker pull itechuw/openelis-global-2:develop docker save itechuw/openelis-global-2:develop | gzip > OpenELIS-Global_DockerImage.tar.gz @@ -66,7 +70,7 @@ 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 From daae9ee6a051f96be61c0ebf70aff6d4da294b73 Mon Sep 17 00:00:00 2001 From: mozzy11 Date: Wed, 30 Oct 2024 19:58:09 +0300 Subject: [PATCH 3/7] fix dir --- build.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.sh b/build.sh index 9f8cf5a..8f22096 100755 --- a/build.sh +++ b/build.sh @@ -21,10 +21,10 @@ echo "creating docker images" createLinuxInstaller() { context="OpenELIS-Global" - installerName="${context}_${projectVersion}_dockerImages" + installerName="${context}_${projectVersion}_docker_images" echo "creating installer for context ${context}" - mkdir -p ${INSTALLER_CREATION_DIR}/${installerName} + 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 From 16a535b16c4eb80d9d6fdb74b1c7c3d1c5d34bd9 Mon Sep 17 00:00:00 2001 From: mozzy11 Date: Wed, 30 Oct 2024 20:15:58 +0300 Subject: [PATCH 4/7] fix --- .github/workflows/build-installer.yml | 2 +- build.sh | 18 ++++++++++-------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build-installer.yml b/.github/workflows/build-installer.yml index 28783fe..abde112 100644 --- a/.github/workflows/build-installer.yml +++ b/.github/workflows/build-installer.yml @@ -14,7 +14,7 @@ jobs: repository: ${{github.repository}} - name: Build installer - run: ./build.sh ${{ github.ref_name }} + run: ./build.sh ${{github.ref_name}} develop - name: check installer run: ls OEDockerImages diff --git a/build.sh b/build.sh index 8f22096..c2f958b 100755 --- a/build.sh +++ b/build.sh @@ -1,5 +1,7 @@ #!/bin/bash projectVersion=${1:-"latest"} +dockerVersion=${2:-"develop"} + INSTALLER_CREATION_DIR="OEDockerImages" CALL_DIR=$PWD @@ -43,16 +45,16 @@ createLinuxInstaller() { cd ${CALL_DIR} echo "saving docker image as OpenELIS-Global_DockerImage.tar.gz" -docker pull itechuw/openelis-global-2:develop -docker save itechuw/openelis-global-2:develop | gzip > 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:develop -docker save itechuw/openelis-global-2-frontend:develop | gzip > ReactFrontend_DockerImage.tar.gz +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:develop -docker save itechuw/openelis-global-2-fhir:develop | gzip > JPAServer_DockerImage.tar.gz +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 @@ -63,8 +65,8 @@ 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:develop -docker save itechuw/openelis-global-2-proxy:develop | gzip > NGINX_DockerImage.tar.gz +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 From 30c928184a9b3a5553290e100d84d11a96e25090 Mon Sep 17 00:00:00 2001 From: mozzy11 Date: Wed, 30 Oct 2024 20:35:20 +0300 Subject: [PATCH 5/7] remove unziped installer file --- build.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/build.sh b/build.sh index c2f958b..40b8800 100755 --- a/build.sh +++ b/build.sh @@ -40,6 +40,7 @@ createLinuxInstaller() { tar -cf ${installerName}.tar ${installerName} gzip ${installerName}.tar + rm -r ${installerName} cd ${CALL_DIR} } From a18c6d48f08526ecfab50bb2acb01383d84240e9 Mon Sep 17 00:00:00 2001 From: mozzy11 Date: Wed, 30 Oct 2024 21:23:25 +0300 Subject: [PATCH 6/7] add read me instructions for offline setup --- README.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/README.md b/README.md index 36a9c88..23972a1 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,7 @@ 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) +## ONLINE INSTALLATION ### Running OpenELIS Global 3x with docker-compose docker-compose up -d @@ -25,3 +26,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__docker_images.tar.gz``` + +1. Move to directory of the Unziped Docker Images file + ```cd OpenELIS-Global__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``` + From 60062d924904cc5cfb9feb2b4ff2bf43437a4c67 Mon Sep 17 00:00:00 2001 From: mozzy11 Date: Wed, 30 Oct 2024 21:29:11 +0300 Subject: [PATCH 7/7] update read me --- .github/workflows/build-installer.yml | 2 +- README.md | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-installer.yml b/.github/workflows/build-installer.yml index abde112..52edff8 100644 --- a/.github/workflows/build-installer.yml +++ b/.github/workflows/build-installer.yml @@ -1,4 +1,4 @@ -name: Build OpenELIS-Global-2 Docker Images +name: Build OpenELIS-Global-2 Offline Docker Images on: release: types: [published] diff --git a/README.md b/README.md index 23972a1..65ad7a2 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,8 @@ 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 @@ -32,7 +34,7 @@ You can find more information on how to set up OpenELIS at our [docs page](http: 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. 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__docker_images.tar.gz```