From 0b164ceaaf4eaf7ccab47d4d7cd285255171cb80 Mon Sep 17 00:00:00 2001 From: Mehdi Mehtarizadeh Date: Mon, 9 Sep 2024 22:40:28 +0100 Subject: [PATCH 01/14] Added .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2eea525 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.env \ No newline at end of file From deda75906fbdfcb1763f23336ac87d037c2705f6 Mon Sep 17 00:00:00 2001 From: Mehdi Mehtarizadeh Date: Mon, 9 Sep 2024 22:41:33 +0100 Subject: [PATCH 02/14] Added .DS_Store --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 2eea525..3323b34 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -.env \ No newline at end of file +.env +.DS_Store From 80c89efd04df6c927b5ab5f160f5d837e34fddb9 Mon Sep 17 00:00:00 2001 From: Mehdi Mehtarizadeh Date: Mon, 9 Sep 2024 22:41:49 +0100 Subject: [PATCH 03/14] Created example dotenv --- env.example | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 env.example diff --git a/env.example b/env.example new file mode 100644 index 0000000..ad91c5b --- /dev/null +++ b/env.example @@ -0,0 +1,4 @@ +TS_PORT=10000 +ES_DEPLOY_ADDRESS= +TRUSTED_ORIGINS= +ES_ADDRESS= \ No newline at end of file From 67878a39ec7cba04aad8f9171733aca36f606859 Mon Sep 17 00:00:00 2001 From: Mehdi Mehtarizadeh Date: Mon, 9 Sep 2024 22:42:25 +0100 Subject: [PATCH 04/14] Fix: Added environment variables to mdenet-tool-xtext --- docker-compose.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/docker-compose.yml b/docker-compose.yml index 5cf4cd0..506e9e1 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -81,8 +81,23 @@ services: - 8074:8080 - 10001:10001 - 9000:9000 + environment: + - TRUSTED_ORIGINS + - ES_DEPLOY_ADDRESS + - ES_ADDRESS build: context: platformtools dockerfile: xtext/Dockerfile + args: + - TRUSTED_ORIGINS=$TRUSTED_ORIGINS + - ES_ADDRESS=$ES_ADDRESS restart: unless-stopped + mdenet-service-discovery: + image: + ports: + - 3000:3000 + build: + context: educationplatform + dockerfile: discovery-service/Dockerfile + restart: unless-stopped From 46162990f756f94297841daae0fd8064b40141fa Mon Sep 17 00:00:00 2001 From: Nadine Spychala Date: Tue, 1 Oct 2024 17:26:29 +0100 Subject: [PATCH 05/14] update README to incorporate .env file --- README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/README.md b/README.md index f2f171f..ba5b299 100644 --- a/README.md +++ b/README.md @@ -65,6 +65,18 @@ git clone --recurse-submodules git@github.com:mdenet/educationplatform-docker.gi > Note that for ssh access you must [configure](https://docs.github.com/en/authentication/connecting-to-github-with-ssh) your account with a key. +## Specify .env + +The ```env.example``` file lists variables (equally listed below) that need to be specified before building the platform. Those variables specify a base URL for the platform and a few extensions. + +The ```.env``` file contains URLs for running the platform on https://mdenet-dev.sites.er.kcl.ac.uk (the base URL in this case). When deploying the platform on a new server/with a new website, those variables will need to be changed. + +``` +TRUSTED_ORIGINS=[insert base URL, e. g., https://mdenet-dev.sites.er.kcl.ac.uk] +ES_DEPLOY_ADDRESS=[insert base URL + /tools/xtext/editors] +ES_ADDRESS=[insert base URL + /tools/xtext/project] +``` + ## Build and run the docker image This builds the docker images and starts the platform servers. ``` From f112df31a0dd27654dba7500f6a220c0baa6d45f Mon Sep 17 00:00:00 2001 From: Mehdi Mehtarizadeh <50746457+aryaei2000@users.noreply.github.com> Date: Wed, 2 Oct 2024 14:15:53 +0100 Subject: [PATCH 06/14] Update README.md and enhanced env variable examples --- README.md | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index ba5b299..fbc478d 100644 --- a/README.md +++ b/README.md @@ -65,16 +65,20 @@ git clone --recurse-submodules git@github.com:mdenet/educationplatform-docker.gi > Note that for ssh access you must [configure](https://docs.github.com/en/authentication/connecting-to-github-with-ssh) your account with a key. -## Specify .env +## Environment Variables -The ```env.example``` file lists variables (equally listed below) that need to be specified before building the platform. Those variables specify a base URL for the platform and a few extensions. +Before building the platform the ```env.example``` file should be renamed to ```.env``` and the environment variables listed below must be populated with relevant values listed below. -The ```.env``` file contains URLs for running the platform on https://mdenet-dev.sites.er.kcl.ac.uk (the base URL in this case). When deploying the platform on a new server/with a new website, those variables will need to be changed. + + **TRUSTED_ORIGINS** comma delimited whitelist of base URLs (with no trailing slash) for CORS aware endpoints + + **ES_DEPLOY_ADDRESS** base URL + /tools/xtext/editors + + **ES_ADDRESS** base URL + /tools/xtext/project + +Here is an example of the ```.env``` file provided that the base URl of the platform server is https://ep.mde-network.org: ``` -TRUSTED_ORIGINS=[insert base URL, e. g., https://mdenet-dev.sites.er.kcl.ac.uk] -ES_DEPLOY_ADDRESS=[insert base URL + /tools/xtext/editors] -ES_ADDRESS=[insert base URL + /tools/xtext/project] +TRUSTED_ORIGINS=https://ep.mde-network.org +ES_DEPLOY_ADDRESS=https://ep.mde-network.org/tools/xtext/editors +ES_ADDRESS=https://ep.mde-network.org/tools/xtext/project ``` ## Build and run the docker image From eefb0e451259445fb773054932fd21fb00dff6a5 Mon Sep 17 00:00:00 2001 From: Mehdi Mehtarizadeh <50746457+aryaei2000@users.noreply.github.com> Date: Wed, 2 Oct 2024 14:17:07 +0100 Subject: [PATCH 07/14] Delete .env --- .env | 1 - 1 file changed, 1 deletion(-) delete mode 100644 .env diff --git a/.env b/.env deleted file mode 100644 index bb9fd29..0000000 --- a/.env +++ /dev/null @@ -1 +0,0 @@ -TS_PORT=10000 From 80af6995fd258723db058195c4ae1a5de57b5191 Mon Sep 17 00:00:00 2001 From: Mehdi Mehtarizadeh Date: Tue, 8 Oct 2024 11:06:02 +0100 Subject: [PATCH 08/14] Added image name for mdenet-service-discovery --- docker-compose.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 506e9e1..fcf5059 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -94,10 +94,10 @@ services: restart: unless-stopped mdenet-service-discovery: - image: + image: mdenet-service-discovery:latest ports: - 3000:3000 build: - context: educationplatform + context: discovery-service dockerfile: discovery-service/Dockerfile restart: unless-stopped From 2cedbf888168df9cbe660a27c5779c34fc221f7f Mon Sep 17 00:00:00 2001 From: Mehdi Mehtarizadeh Date: Tue, 8 Oct 2024 11:07:48 +0100 Subject: [PATCH 09/14] Fixed mdenet-service-discovery dockerfile path. --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index fcf5059..04368a4 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -99,5 +99,5 @@ services: - 3000:3000 build: context: discovery-service - dockerfile: discovery-service/Dockerfile + dockerfile: Dockerfile restart: unless-stopped From 8c8333d655f067ed05cb6077574911557dfc44fa Mon Sep 17 00:00:00 2001 From: Mehdi Mehtarizadeh Date: Wed, 6 Nov 2024 16:36:33 +0000 Subject: [PATCH 10/14] Added section for load balancer deployment. --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index fbc478d..164db42 100644 --- a/README.md +++ b/README.md @@ -110,3 +110,10 @@ chmod -R 755 {public,educationplatform-examples} ## Stopping the platform To safely stop the platform use `ctrl-c` in the terminal running the platform. + + +## Deployment on a Server Behind a Load Balancer + +It is quite common to have a web server running behind a firewall or load balancer. In this scenario, the public IP of the server or the FQDN can only be accessed on either port 443 (HTTPS) or 80 (HTTP). Therefore, it is not possible to interact with containers that run on other ports of the server directly. + +The containerised version of the platform can be deployed on a web server behind a load balancer using reverse proxy. For instance, an Nginx server can be configured to directly run on the host machine and map URL segments to ports so that each request is routed to the right container. \ No newline at end of file From 1cf73f77cdb03d56ecd6b3db0a750989bea12804 Mon Sep 17 00:00:00 2001 From: Mehdi Mehtarizadeh <50746457+aryaei2000@users.noreply.github.com> Date: Thu, 21 Nov 2024 14:14:52 +0000 Subject: [PATCH 11/14] Update docker-compose.yml --- docker-compose.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 04368a4..28a44a4 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -4,10 +4,13 @@ services: image: mdenet-educationplatform:latest ports: - "8080:80" + environment: + - TOKEN_SERVER_URL build: context: educationplatform dockerfile: ./platform/Dockerfile - + args: + - TOKEN_SERVER_URL=$TOKEN_SERVER_URL volumes: - ./config/list-redirect.conf:/etc/nginx/conf.d/default.conf - ./public/list.html:/usr/share/nginx/html/list.html @@ -98,6 +101,6 @@ services: ports: - 3000:3000 build: - context: discovery-service - dockerfile: Dockerfile + context: educationplatform + dockerfile: ./discovery-service/Dockerfile restart: unless-stopped From 27e76fb4203fad53067ef5a4967b08628721cbdc Mon Sep 17 00:00:00 2001 From: Mehdi Mehtarizadeh <50746457+aryaei2000@users.noreply.github.com> Date: Wed, 27 Nov 2024 00:43:09 +0000 Subject: [PATCH 12/14] Prepare the env file --- .github/workflows/ci.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6ac44f5..fc92faa 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,7 +13,12 @@ jobs: - uses: actions/checkout@v3 with: submodules: recursive - + - name: Populate env file + run : | + sed -i 's#ES_DEPLOY_ADDRESS=#ES_DEPLOY_ADDRESS=http://127.0.0.1:8074/#' env.example + sed -i 's#TRUSTED_ORIGINS=#TRUSTED_ORIGINS=http://127.0.0.1#' env.example + sed -i 's#ES_ADDRESS=#ES_ADDRESS=http://127.0.0.1:10001/#' env.example + mv env.example .env - name: Docker build and run run : docker compose up --build -d From 2193dbc18613315caa85e3032a8d7f293a354964 Mon Sep 17 00:00:00 2001 From: Mehdi Mehtarizadeh Date: Wed, 4 Dec 2024 12:29:28 +0000 Subject: [PATCH 13/14] Deleted service discovery. --- docker-compose.yml | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 28a44a4..f5acc62 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -90,17 +90,10 @@ services: - ES_ADDRESS build: context: platformtools + platforms: + - "linux/amd64" dockerfile: xtext/Dockerfile args: - TRUSTED_ORIGINS=$TRUSTED_ORIGINS - ES_ADDRESS=$ES_ADDRESS restart: unless-stopped - - mdenet-service-discovery: - image: mdenet-service-discovery:latest - ports: - - 3000:3000 - build: - context: educationplatform - dockerfile: ./discovery-service/Dockerfile - restart: unless-stopped From 086d5dad0f6a32a4c2b58b8344df87218ee83635 Mon Sep 17 00:00:00 2001 From: Mehdi Mehtarizadeh Date: Tue, 10 Dec 2024 11:26:41 +0000 Subject: [PATCH 14/14] Removed platform from xtext service. --- docker-compose.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index f5acc62..5f654e0 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -90,8 +90,6 @@ services: - ES_ADDRESS build: context: platformtools - platforms: - - "linux/amd64" dockerfile: xtext/Dockerfile args: - TRUSTED_ORIGINS=$TRUSTED_ORIGINS