Skip to content

Commit 20a8fe7

Browse files
authored
Support for AWS Cognito auth (#75)
* vboard-ws: - support for AWS Cognito auth - elasticsearch:6.4.3 compatibility - build now done in Dockerfile pre-step vboard-front: - fixing config parsing - allowing an $HTTP_PROXY to be injected in httpd.conf - build now done in Dockerfile pre-step vboard-batchs: - now using logstash
1 parent b110462 commit 20a8fe7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+895
-795
lines changed

.dockerignore

100644100755
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
/vboard-front/node_modules/
2-
/vboard-front/src/
32
/vboard-ws/target/

.mvn/wrapper/maven-wrapper.jar

-47.2 KB
Binary file not shown.

.mvn/wrapper/maven-wrapper.properties

Lines changed: 0 additions & 1 deletion
This file was deleted.

.pre-commit-config.yaml

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
repos:
12
- repo: https://github.com/pre-commit/pre-commit-hooks
2-
sha: v0.9.2
3+
rev: v2.4.0
34
hooks:
45
- id: check-merge-conflict
56
- id: trailing-whitespace
@@ -8,7 +9,7 @@
89
- id: check-json
910
- id: check-yaml
1011
- repo: https://github.com/Lucas-C/pre-commit-hooks
11-
sha: v1.1.4
12+
rev: v1.1.7
1213
hooks:
1314
- id: remove-crlf
1415
- id: remove-tabs
@@ -27,13 +28,15 @@
2728
- LICENSE-short.txt
2829
- --comment-style
2930
- <!--| ~| -->
30-
- repo: https://github.com/Lucas-C/pre-commit-hooks-nodejs
31-
sha: v1.0.1
32-
hooks:
33-
- id: markdown-toc
34-
files: ^README\.md$
35-
- id: markdown-toc
36-
files: ^CONTRIBUTING\.md$
31+
# The following hook installation always end up failing due to connection issues,
32+
# so I (Lucas) am disabling it for now.
33+
# - repo: https://github.com/Lucas-C/pre-commit-hooks-nodejs
34+
# rev: v1.1.0
35+
# hooks:
36+
# - id: markdown-toc
37+
# files: ^README\.md$
38+
# - id: markdown-toc
39+
# files: ^CONTRIBUTING\.md$
3740
# vboard-front
3841
- repo: local
3942
hooks:

.travis.yml

100644100755
Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
language: java
2+
jdk: openjdk8
23

34
front:
45
- build
@@ -7,21 +8,37 @@ front:
78
jobs:
89
include:
910
- stage: build
11+
env: Docker frontend image build
12+
services:
13+
- docker
1014
script:
11-
- mvn clean install -Dmaven.test.skip=true
12-
- vboard-front/install-build.sh
15+
- cd vboard-front
16+
# The front image includes a call to "grunt validate":
17+
- docker build .
18+
- stage: build
19+
env: Docker backend image build
20+
services:
21+
- docker
22+
script:
23+
- cd vboard-ws
24+
- docker build .
1325
- stage: test
26+
env: Pre-commit checks
1427
script:
15-
- mvn test
1628
# Installing pre-commit globally fails with:
1729
# Installing collected packages: aspy.yaml, cached-property, identify, nodeenv, pre-commit
1830
# File "/usr/lib/python2.7/shutil.py", line 83, in copyfile
1931
# with open(dst, 'wb') as fdst:
2032
# IOError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/aspy.yaml-1.0.0-nspkg.pth'
2133
- pip install --user pre-commit && pre-commit run --all-files
34+
- stage: test
35+
env: Backend unit tests
36+
script:
37+
- cd vboard-ws
38+
- mvn --version
39+
- mvn test
2240

2341
cache:
2442
pip: true
2543
directories:
26-
- node_modules # npm packages
2744
- $HOME/.m2 # Maven packages

README.md

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ The public, open-source version of this project was publish in January 2018. It'
2222
- [Usage](#usage)
2323
- [Contributing](#contributing)
2424
- [Architecture](#architecture)
25+
* [Authentication](#authentication)
2526
* [Docker services](#docker-services)
2627
* [Release on Docker hub](#release-on-docker-hub)
2728

@@ -45,14 +46,12 @@ with comments and a search bar
4546
The following command starts V.Board locally from the published images:
4647

4748
export TAG=latest
48-
docker-compose -f docker-compose.yml pull
49-
docker-compose -f docker-compose.yml up -d --no-build
49+
docker-compose pull
50+
docker-compose up -d --no-build
5051

5152
You can also rebuild the images locally:
5253

53-
mvn clean install
54-
vboard-front/install-build.sh # requires npm
55-
docker-compose -f docker-compose.yml build
54+
docker-compose build
5655
docker-compose -f docker-compose.yml -f docker-compose.dev.yml up -d --no-build
5756

5857
You can then access the website through http://localhost
@@ -72,6 +71,15 @@ V.Board is made of the folling modules, launched as `docker-compose` services:
7271
- `front`: [AngularJS](https://angularjs.org) 1.5 web app served by Apache (front)
7372
- `batchs`: Java batch job to update the ElasticSearch index
7473

74+
## Authentication
75+
There are 3 supported mode of authentication, that are activated in this order:
76+
77+
- through a [Keycloak instance](https://www.keycloak.org), if the environment variables `$KCK_PUBLIC_HOST` & `$KCK_REALM_KEY` are defined,
78+
_cf_. [KeycloakEnabledInEnv.java](https://github.com/voyages-sncf-technologies/vboard/blob/master/vboard-ws/src/main/java/com/vsct/vboard/config/KeycloakEnabledInEnv.java)
79+
- through [AWS Cognito](https://aws.amazon.com/fr/cognito/), with a `X-AMZN-OIDC-DATA` HTTP header containing a JWT token,
80+
if the environment variable `$AWS_COGNITO_ENABLED` is defined
81+
- anonymous mode
82+
7583
## Docker services
7684
Some extra `docker-compose` services are used:
7785

docker-compose.dev.yml

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,18 @@
11
version: '2'
22
services:
33
ws:
4-
ports:
5-
- 8080:8080
64
environment:
7-
- PROXY_HOST=
85
- JAVA_OPTS=-Derror.whitelabel.enabled=true -Dendpoints.enabled=true -Dendpoints.sensitive=false
96
# - JAVA_OPTS=-Dspring.profiles.active=dev
107
volumes:
118
- ./statics:/usr/local/tomcat/data
129

1310
front:
14-
ports:
15-
- 80:80
1611
environment:
17-
- VBOARD_API_ENDPOINT=/vboard
18-
#- VBOARD_API_ENDPOINT=http://localhost:8080
12+
- VBOARD_API_ENDPOINT=http://localhost:8080
1913
volumes:
2014
- ./statics:/var/vboard/statics
2115
# Mouting the following directory "overrides" the one in the built container.
2216
# We do this to benefit from "grunt watch" regenerating the statics
2317
#!! Does not work atm because grunt delete/recreate this directory
2418
- ./vboard-front/grunt-target:/var/www/vboard
25-
26-
wsdb:
27-
ports:
28-
- 3306:3306
29-
30-
elasticsearch:
31-
ports:
32-
- 9200:9200

docker-compose.yml

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,15 @@ services:
99
- SERVICE_8080_VERSION=${TAG}
1010
environment:
1111
- VBOARD_DB_HOST=wsdb
12-
- VBOARD_ELASTICSEARCH_HOST=elasticsearch
12+
- VBOARD_ELASTICSEARCH=http://elasticsearch:9200
1313
- VBOARD_HOSTNAME=localhost
1414
- VBOARD_IMAGES_DIRECTORY=/usr/local/tomcat/data/
15-
- affinity:container==~*${PROJECT_NAME}_front*
15+
- VBOARD_WORDPRESS_IMAGES_DIRECTORY=/usr/local/tomcat/data/blog/
16+
- MYSQL_USER=root
17+
- MYSQL_ROOT_PASSWORD=root
18+
- MYSQL_DATABASE=vboard_pins
1619
ports:
17-
- 8080
20+
- 8080:8080
1821
networks:
1922
- back
2023
volumes:
@@ -31,10 +34,12 @@ services:
3134
- SERVICE_80_NAME=${PROJECT_NAME}-front
3235
- SERVICE_80_VERSION=${TAG}
3336
environment:
37+
- VBOARD_API_ENDPOINT=/api/v1
3438
- VBOARD_HOSTNAME=localhost
35-
- VBOARD_WS_HOST=ws:8080
39+
- VBOARD_WS_HOST=http://ws:8080
40+
- VBOARD_WP_PUBLIC_HOST=
3641
ports:
37-
- 80
42+
- 80:80
3843
networks:
3944
- back
4045
volumes:
@@ -45,9 +50,11 @@ services:
4550
restart: always
4651
image: vboard/vboard-batchs:${TAG}
4752
environment:
48-
- JAVA_OPTS=-Xms512m -Xmx512m
49-
- VBOARD_DB_HOST=wsdb:3306
50-
- VBOARD_ELASTICSEARCH_HOST=elasticsearch
53+
- VBOARD_DB_HOST=wsdb:3306
54+
- VBOARD_ELASTICSEARCH=http://elasticsearch:9200
55+
- MYSQL_USER=root
56+
- MYSQL_ROOT_PASSWORD=root
57+
- MYSQL_DATABASE=vboard_pins
5158
networks:
5259
- back
5360

@@ -60,24 +67,22 @@ services:
6067
- MYSQL_ROOT_PASSWORD=root
6168
- MYSQL_DATABASE=vboard_pins
6269
ports:
63-
- 3306
70+
- 3306:3306
6471
networks:
6572
- back
6673
volumes:
6774
- wsdb-data:/var/lib/mysql
6875

6976
elasticsearch:
7077
restart: always
71-
image: elasticsearch:1.5.2
78+
image: elasticsearch:6.4.3
7279
labels:
7380
- SERVICE_9200_NAME=${PROJECT_NAME}-elasticsearch
7481
- SERVICE_9200_VERSION=${TAG}
7582
ports:
76-
- 9200
83+
- 9200:9200
7784
networks:
7885
- back
79-
volumes:
80-
- ./vboard-es-conf:/usr/share/elasticsearch/config
8186

8287
networks:
8388
back:

0 commit comments

Comments
 (0)