Skip to content

Commit d0ae31c

Browse files
celinepelletierCéline PelletierCéline Pelletier
authored
SKFP-16: Use Keycloak instead of Ego (#40)
* SKFP-16: Use Keycloak instead of Ego and convert app to typescript * SKFP-16: Fix Dockerfile * SKFP-16: Fix Jenkinsfile entrypoint * SKFP-16: Fix review comments * SKFP-16: Fix review comment * SKFP-82: Deploy keycloak branch to QA * SKFP-82: Rename project shorter * SKFP-82: Add configs in .env.example * SKFP-82: Use real realm in QA * Remove branch deployment before merging to master * Change to original project name Co-authored-by: Céline Pelletier <[email protected]> Co-authored-by: Céline Pelletier <[email protected]>
1 parent 4154fa9 commit d0ae31c

Some content is hidden

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

55 files changed

+11819
-8912
lines changed

.babelrc

-8
This file was deleted.

.circleci/config.yml

+20-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ version: 2.1
33
executors:
44
node-executor:
55
docker:
6-
- image: circleci/node:13
6+
- image: circleci/node:16.4.2
77
working_directory: ~/repo
88

99
jobs:
@@ -19,13 +19,28 @@ jobs:
1919
- v1-dependencies-{{ checksum "package.json" }}
2020
- v1-dependencies-
2121

22-
- run: npm i
22+
- run: npm ci
2323

2424
- save_cache:
2525
paths:
2626
- node_modules
2727
key: v1-dependencies-{{ checksum "package.json" }}
2828

29+
build:
30+
executor: node-executor
31+
32+
steps:
33+
- checkout
34+
- restore_cache:
35+
keys:
36+
- v1-dependencies-{{ checksum "package.json" }}
37+
- v1-dependencies-
38+
- run: npm run build
39+
- save_cache:
40+
paths:
41+
- node_modules
42+
key: v1-dependencies-{{ checksum "package.json" }}
43+
2944
tests:
3045
executor: node-executor
3146

@@ -52,6 +67,9 @@ workflows:
5267
tests:
5368
jobs:
5469
- install
70+
- build:
71+
requires:
72+
- install
5573
- tests:
5674
requires:
5775
- install

.dockerignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Dockerfile
2+
.git
3+
node_modules

.env schema

+4-2
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,7 @@ PORT=4000
66
ES_HOST=http://kf-arranger-es-qa.kids-first.io:9200
77
#ES_HOST=localhost:9100
88

9-
# Ego host
10-
EGO_URL=https://ego-qa.kids-first.io
9+
# Keycloak configs
10+
KEYCLOAK_URL=
11+
KEYCLOAK_REALM=
12+
KEYCLOAK_CLIENT=

.eslintignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules
2+
dist

.eslintrc

+29-18
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,35 @@
11
{
2+
"env": {
3+
"commonjs": true,
4+
"node": true,
5+
"es6": true
6+
},
7+
"parser": "@typescript-eslint/parser",
8+
"parserOptions": {
9+
"ecmaVersion": 2020,
10+
"sourceType": "module"
11+
},
212
"extends": [
3-
"react-app",
4-
"airbnb",
5-
"plugin:jsx-a11y/recommended",
6-
"prettier",
7-
"prettier/react"
8-
],
9-
"plugins": [
10-
"jsx-a11y",
11-
"prettier"
13+
"plugin:@typescript-eslint/recommended",
14+
"plugin:prettier/recommended"
1215
],
1316
"rules": {
14-
"semi": 0,
15-
"react/jsx-filename-extension": [1, { "extensions": [".js", ".jsx"] }],
16-
"prettier/prettier": [
17-
"error", {
18-
"semi": true,
19-
"singleQuote": true,
20-
"trailingComma": true
21-
}
22-
]
17+
"arrow-body-style": ["error", "as-needed"],
18+
"complexity": ["warn", 16],
19+
"template-curly-spacing": "off",
20+
"indent": "off",
21+
"default-case": 0,
22+
"max-len": [
23+
"error",
24+
{
25+
"code": 160,
26+
"ignoreComments": true
27+
}
28+
],
29+
"no-console": ["error", { "allow": ["warn", "error"] }],
30+
"no-unused-vars": "off",
31+
"@typescript-eslint/no-unused-vars": ["warn", { "argsIgnorePattern": "^_" }],
32+
"prefer-spread": "error",
33+
"prettier/prettier": ["error"]
2334
}
2435
}

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,6 @@ typings/
6666

6767
# folder used to keep notes in dev
6868
.ignore
69+
70+
# Compiled typescript files
71+
dist

.mocharc.json

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"extension": ["ts"],
3+
"spec": "src/**/*.test.ts",
4+
"require": "ts-node/register"
5+
}

.prettierrc

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"semi": true,
3+
"trailingComma": "all",
4+
"singleQuote": true,
5+
"printWidth": 120,
6+
"tabWidth": 4
7+
}

Dockerfile

+14-16
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
1-
FROM node:10-alpine
2-
3-
# Create app directory
4-
WORKDIR /usr/src/app
5-
6-
# Install app dependencies
7-
# A wildcard is used to ensure both package.json AND package-lock.json are copied
8-
# where available (npm@5+)
9-
COPY package*.json ./
10-
11-
RUN npm install
12-
RUN npm ci --only=production
13-
14-
# Bundle app source
1+
# First image to compile typescript to javascript
2+
FROM node:16.5.0-alpine AS build-image
3+
WORKDIR /app
154
COPY . .
16-
17-
CMD [ "node", "index.js" ]
5+
RUN npm ci
6+
RUN npm run clean
7+
RUN npm run build
8+
9+
# Second image, that creates an image for production
10+
FROM node:16.5.0-alpine AS prod-image
11+
WORKDIR /app
12+
COPY --from=build-image ./app/dist ./dist
13+
COPY package* ./
14+
RUN npm ci --production
15+
CMD [ "node", "./dist/index.js" ]

Jenkinsfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ ecs_service_type_1_standard {
66
environments = "dev,qa,prd"
77
docker_image_type = "alpine"
88
create_default_iam_role = "1"
9-
entrypoint_command = "node index.js"
9+
entrypoint_command = "node ./dist/index.js"
1010
quick_deploy = "true"
1111
container_port = "80"
1212
health_check_path = "/status"

babelCfg.js

-15
This file was deleted.

index.js

-4
This file was deleted.

index.ts

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/usr/bin/env node
2+
require('./src/index');

0 commit comments

Comments
 (0)