Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Base URL Fixes #63

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
1 change: 0 additions & 1 deletion .env

This file was deleted.

2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.env
.DS_Store
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,22 @@ git clone --recurse-submodules [email protected]: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.

## Environment Variables

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.

+ **TRUSTED_ORIGINS** comma delimited whitelist of base URLs (with no trailing slash) for CORS aware endpoints
+ **ES_DEPLOY_ADDRESS** base URL + /tools/xtext/editors
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be good to explain why this is needed. Why not, instead, simply have a BASE_URL variable and compute the rest from there?

+ **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=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
This builds the docker images and starts the platform servers.
```
Expand Down Expand Up @@ -94,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.
aryaei2000 marked this conversation as resolved.
Show resolved Hide resolved
20 changes: 19 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -81,8 +84,23 @@ services:
- 8074:8080
- 10001:10001
- 9000:9000
environment:
- TRUSTED_ORIGINS
- ES_DEPLOY_ADDRESS
aryaei2000 marked this conversation as resolved.
Show resolved Hide resolved
- ES_ADDRESS
build:
context: platformtools
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
4 changes: 4 additions & 0 deletions env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
TS_PORT=10000
ES_DEPLOY_ADDRESS=
TRUSTED_ORIGINS=
ES_ADDRESS=
Loading