-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #27 from julianrojas87/dev
v1.4.1
- Loading branch information
Showing
11 changed files
with
146 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
node_modules/ | ||
dist/ | ||
*.md | ||
.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
### Multi-stage Docker image | ||
|
||
# STAGE 1: Start from a Node.js ready container | ||
FROM node:latest AS RCC | ||
# Create a new directory for app files | ||
RUN mkdir -p /opt/era-compatiblity-check | ||
# Set working directory in the container | ||
WORKDIR /opt/era-compatiblity-check | ||
# Copy source files | ||
COPY . . | ||
# Install dependencies | ||
RUN npm install | ||
# Install envsub to parse environment variables | ||
RUN npm install -g envsub | ||
# Define config variables | ||
ARG ERA_GEO_API=http://era.ilabt.imec.be/ldf | ||
ARG ZOOM=10 | ||
ARG FACETED_BASE_URI=https://linked.ec-dataplatform.eu/describe/?url= | ||
# Parse env variables and build app for production | ||
RUN envsub ./src/config/config.js && npm run build | ||
|
||
# STAGE 2: Start from NGINX ready container | ||
FROM nginx | ||
# Copy built application from stage 1 | ||
COPY --from=RCC /opt/era-compatiblity-check/dist /usr/share/nginx/html | ||
# Expose HTTP default port | ||
EXPOSE 80 | ||
# Start NGINX | ||
CMD ["nginx", "-g", "daemon off;"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,70 @@ | ||
# era-compatibility-check | ||
React application that performs route compatibility check over the ERA Knowledge Graph | ||
|
||
Web application to perform route compatibility checks based on data from the [ERA Knowledge Graph](https://linked.ec-dataplatform.eu/sparql). | ||
|
||
## Deploy WITH Docker | ||
|
||
This application has been _dockerized_ to facilitate its deployment. We use a [multi-stage approach](https://docs.docker.com/develop/develop-images/multistage-build/) to build a container that makes publishes a build of this Web application via a NGINX instance. | ||
|
||
To deploy this container follow these steps: | ||
|
||
1. Make sure to have a recent version of [Docker](https://docs.docker.com/engine/install/) installed. | ||
|
||
2. Set the application's configuration parameters and build the Docker image: | ||
|
||
```bash | ||
docker build -t era-rcc \ | ||
--build-arg ERA_GEO_API=http://era.ilabt.imec.be/ldf \ | ||
--build-arg ZOOM=10 \ | ||
--build-arg FACETED_BASE_URI=https://linked.ec-dataplatform.eu/describe/?url= \ | ||
./ | ||
``` | ||
|
||
Three configuration parameters need to be when building this image: | ||
|
||
- `ERA_GEO_API`: URL of the [geospatial API](https://github.com/julianrojas87/era-ldf/) that runs over the ERA KG. | ||
- `ZOOM`: Zoom level at which the geospatial data tiles are defined. According to the [Slippy Tiles spec](https://wiki.openstreetmap.org/wiki/Slippy_map_tilenames#Zoom_levels), the zoom parameter is an integer between 0 (zoomed out) and 18 (zoomed in). | ||
- `FACETED_BASE_URI`: Base URL to make entities in the application dereferenceable over the configured triple store. | ||
|
||
3. Start the application: | ||
|
||
```bash | ||
docker run -p ${PORT}:80 era-rcc | ||
``` | ||
|
||
Replace `${PORT}` for the TCP port where you want to run the application. | ||
|
||
## Deploy WITHOUT Docker | ||
|
||
To directly build this application you need to install first: | ||
|
||
- [Node.js](https://nodejs.org/en/download/) at least v12. | ||
|
||
Then follow these steps: | ||
|
||
1. Clone this repository: | ||
|
||
```bash | ||
git clone https://github.com/julianrojas87/era-compatibility-check.git | ||
``` | ||
|
||
2. Go inside the cloned folder and install the dependencies: | ||
|
||
```bash | ||
npm install | ||
``` | ||
|
||
3. Build the application: | ||
|
||
```bash | ||
npm run build | ||
``` | ||
|
||
4. Publish the compiled static site: | ||
|
||
```bash | ||
cd dist | ||
npx http-server -p 8080 | ||
``` | ||
|
||
The above commands will publish the application at `http://localhost:8080`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,15 @@ | ||
|
||
export const ERA_VOCABULARY = 'http://era.ilabt.imec.be/ldf/vocabulary'; | ||
export const ERA_VEHICLE_TYPES = 'http://era.ilabt.imec.be/ldf/vehicle-types'; | ||
export const ERA_VEHICLES = 'http://era.ilabt.imec.be/ldf/vehicles'; | ||
export const ABSTRACTION_TILES = 'http://era.ilabt.imec.be/ldf/sparql-tiles/abstraction'; | ||
export const ABSTRACTION_ZOOM = 10; | ||
export const IMPLEMENTATION_TILES = 'http://era.ilabt.imec.be/ldf/sparql-tiles/implementation'; | ||
export const IMPLEMENTATION_ZOOM = 10; | ||
//export const FACETED_BASE_URI = 'https://test-linked.ec-dataplatform.eu/describe/?url='; | ||
export const FACETED_BASE_URI = 'http://era.ilabt.imec.be/resource?uri='; | ||
export const APP_PATH = '/compatibility-check-demo'; | ||
const ERA_GEO_API = '${ERA_GEO_API}'; | ||
const ZOOM = '${ZOOM}'; | ||
export const FACETED_BASE_URI = '${FACETED_BASE_URI}' | ||
//export const FACETED_BASE_URI = 'https://linked.ec-dataplatform.eu/describe/?url='; for Virtuoso | ||
//export const FACETED_BASE_URI = 'http://era.ilabt.imec.be/resource?uri='; for GraphDB | ||
|
||
export const APP_PATH = '/compatibility-check-demo'; | ||
export const ERA_VOCABULARY = ERA_GEO_API + '/vocabulary'; | ||
export const ERA_VEHICLE_TYPES = ERA_GEO_API + '/vehicle-types'; | ||
export const ERA_VEHICLES = ERA_GEO_API + '/vehicles'; | ||
export const ABSTRACTION_TILES = ERA_GEO_API + '/sparql-tiles/abstraction'; | ||
export const IMPLEMENTATION_TILES = ERA_GEO_API + '/sparql-tiles/implementation'; | ||
export const ABSTRACTION_ZOOM = ZOOM; | ||
export const IMPLEMENTATION_ZOOM = ZOOM; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters