Commit 1e4b431f authored by Pablo Roncero Fernandez's avatar Pablo Roncero Fernandez
Browse files

First commit

parent 96708beb
Pipeline #1395895 failed
{
"presets": [
"react",
"flow"
],
"retainLines": true
}
\ No newline at end of file
REACT_APP_BASE_URL=https://pljmac02.dyndns.cern.ch:8080/api
REACT_APP_OAUTH_CLIENT_ID=push-notifications
REACT_APP_AUTHORIZATION_URL=https://auth.cern.ch/auth/realms/cern/protocol/openid-connect/auth
REACT_APP_OAUTH_REDIRECT_URL=https://pljmac02.dyndns.cern.ch:3000/redirect
REACT_APP_NODE_TLS_REJECT_UNAUTHORIZED=0
\ No newline at end of file
parser: babel-eslint
extends:
- airbnb
- prettier
- plugin:prettier/recommended
- prettier/babel
- prettier/react
plugins:
- prettier
- react
- jsx-a11y
- import
rules:
prettier/prettier: error
react/jsx-filename-extension: off
react/prop-types:
- error
- ignore: [navigation]
no-console: off
settings:
import/resolver:
node:
moduleDirectory:
- node_modules
- src
env:
browser: true
[ignore]
[include]
[libs]
[lints]
[options]
[strict]
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# dependencies
/node_modules
/.pnp
.pnp.js
# testing
/coverage
# production
/build
# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# See https://help.github.com/ignore-files/ for more about ignoring files.
# dependencies
/node_modules
# testing
/coverage
# production
/build
# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
npm-debug.log*
yarn-debug.log*
yarn-error.log*
\ No newline at end of file
variables:
NAMESPACE_DEV: test-notifications-service
NAMESPACE_QA: notifications-service
NAMESPACE_PROD: notifications-service
OPENSHIFT_SERVER_PROD: https://openshift.cern.ch
OPENSHIFT_SERVER_DEV: https://openshift-dev.cern.ch
BUILD_ENV_DEV: staging
BUILD_ENV_PROD: production
BUILD_ENV_QA: qa
QA_TAG: qa
DEV_TAG: dev
RESOURCE: ${CI_PROJECT_NAME}
APP_NAME: ${CI_PROJECT_NAME}
stages:
#- test
- build_docker
- deploy
.docker_build_template: &docker_definition
stage: build_docker
tags:
- docker-image-build
script: "echo building $CI_REGISTRY_IMAGE for keycloak-rest-adapter" # No empty scripts are allowed
.deploy_template: &deploy_definition
stage: deploy
image: gitlab-registry.cern.ch/paas-tools/openshift-client:latest
script:
- LOWERCASE_PATH=$(echo ${CI_PROJECT_PATH} | awk '{ print tolower($0) } ')
# Adding || true to disable the error message when the image already exists
- oc import-image ${APP_NAME} --from="gitlab-registry.cern.ch/${LOWERCASE_PATH}:${TAG}" --confirm --token=${TOKEN} --server=${OPENSHIFT_SERVER} -n ${NAMESPACE} || true
- oc process --local -f openshift/adapter_configmap.yaml -p KC_ALIAS=$KC_ALIAS -p REALM=$REALM -p CLIENT_ID=$CLIENT_ID -p CLIENT_SECRET=$CLIENT_SECRET -p ROUTE_HOSTNAME=$ROUTE_HOSTNAME | oc replace -f - --token=${TOKEN} --server=${OPENSHIFT_SERVER} -n ${NAMESPACE}
- oc tag "gitlab-registry.cern.ch/${LOWERCASE_PATH}:${TAG}" "${APP_NAME}:latest" --token=${TOKEN} --server=${OPENSHIFT_SERVER} -n ${NAMESPACE}
### Testing
# test:
# stage: test
# image: "python:3.7-slim"
# before_script:
# - pip install -r requirements.txt
# - pip install -r test-requirements.txt
# script:
# - pytest
# services:
# - name: gitlab-registry.cern.ch/authzsvc/docker-images/keycloak
# alias: keycloak
# variables:
# KEYCLOAK_USER: "admin"
# KEYCLOAK_PASSWORD: "admin"
### Docker build definitions
build_docker_dev:
<<: *docker_definition
variables:
TO: ${CI_REGISTRY_IMAGE}:${DEV_TAG}
only:
- dev
build_docker_qa:
<<: *docker_definition
variables:
TO: ${CI_REGISTRY_IMAGE}:${QA_TAG}
only:
- master
build_docker_prod:
<<: *docker_definition
variables:
TO: ${CI_REGISTRY_IMAGE}:${CI_COMMIT_TAG}
only:
- tags # the branch you want to publish
### Deployment definitions
deploy_dev:
<<: *deploy_definition
variables:
KC_ALIAS: ${KEYCLOAK_SERVER_DEV}
REALM: ${KEYCLOAK_REALM_DEV}
CLIENT_SECRET: ${CLIENT_SECRET_DEV}
ENVIRONMENT: dev
OPENSHIFT_SERVER: ${OPENSHIFT_SERVER_DEV}
TOKEN: ${OPENSHIFT_DEV_TOKEN}
NAMESPACE: ${NAMESPACE_DEV}
TAG: ${DEV_TAG}
ROUTE_HOSTNAME: https://${NAMESPACE_DEV}.web.cern.ch
environment:
name: staging
url: https://test-keycloak-rest-adapter.web.cern.ch
only:
- dev
deploy_qa:
<<: *deploy_definition
variables:
KC_ALIAS: ${KEYCLOAK_SERVER_QA}
REALM: ${KEYCLOAK_REALM_QA}
CLIENT_SECRET: ${CLIENT_SECRET_QA}
ENVIRONMENT: qa
TOKEN: ${OPENSHIFT_QA_TOKEN}
OPENSHIFT_SERVER: ${OPENSHIFT_SERVER_PROD}
NAMESPACE: ${NAMESPACE_QA}
TAG: ${QA_TAG}
ROUTE_HOSTNAME: https://${NAMESPACE_QA}.web.cern.ch
environment:
name: qa
url: https://keycloak-rest-adapter-qa.web.cern.ch
only:
- master
deploy_prod:
<<: *deploy_definition
variables:
KC_ALIAS: ${KEYCLOAK_SERVER_PROD}
REALM: ${KEYCLOAK_REALM_PROD}
CLIENT_SECRET: ${CLIENT_SECRET_PROD}
ENVIRONMENT: prod
TOKEN: ${OPENSHIFT_PROD_TOKEN}
OPENSHIFT_SERVER: ${OPENSHIFT_SERVER_PROD}
NAMESPACE: ${NAMESPACE_PROD}
TAG: ${CI_COMMIT_TAG}
ROUTE_HOSTNAME: https://${NAMESPACE_PROD}.web.cern.ch
environment:
name: production
url: https://keycloak-rest-adapter.web.cern.ch
only:
- tags
\ No newline at end of file
FROM node:8.11.3
WORKDIR /usr/src/app
COPY . .
RUN cd server && yarn install
CMD if [ $NODE_ENV = "development" ] ; then yarn start; else yarn run start-prod --prefix $PUSH_SERVICE ; fi
This diff is collapsed.
-----BEGIN CERTIFICATE-----
MIIDZDCCAkwCCQCIOqnSZ8tYUDANBgkqhki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
RKvfsRAIbTSl0NyqWu4NAx+c5ChX6owrdkpkSEOaTSKxDDSmSmxVlHk+iyLghfpA
SlKBVlrtcpg=
-----END CERTIFICATE-----
{
"compilerOptions": {
"target": "ES6",
"module": "commonjs"
},
"exclude": [
"node_modules",
"**/node_modules/*"
]
}
\ No newline at end of file
-----BEGIN PRIVATE KEY-----
MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDn2GTewvjCHcKr
21WHxcBYj2c2MgsJUt0qTOXjC5I1xUpiS+IrnzOmD+RqsanKDSTQDESEC42YM9kQ
/9deFFIl+C33ljwDo/6MEFgkdh4SR5GeEAv3qwuv32KhHCUSufgTs4i8nJxJnvci
AuuohjWRrUgddZsvNMz7GHkkn78EaLML82UJKzXLb0Mvo/YzVgclUa1cIeI8W2aV
gTGe1PRp773oMvCFpXl1Kl+iWWGP6WdqiN8Glr44VVWOttlOWRSFT/f4Wh3+gg7c
/5ZtJqFj2eo+33yX1+eSaM5EiRbsE7xN5kXAicrta4jnYzazLCIivI4BHPXWsk+M
V52m6UcxAgMBAAECggEAdMxXRMIEgAZuJBYDKLs/A157KJpdZP0R3lWPGqqhpeUW
bB6+eith4a7v67BFUTz95rHHcp4/XwX/vMimvwaNvAMjZS+SXGMpwXYacYPv8lWL
zo1W+hZ5dMic7302UBDQIVy47gwX0B79cWz3O5chNZqOUgkFfOqkuXrCzOiNWrJO
xn1y8ulONADc8/af9rVvWCPlbvmmw04vMzS45EO9TxughUKpbOIT837z+kfEhYGn
h+jHnsvPORXalLszG/W30IhAWup06EZM4WD0x/fjju+kfxPplNRxGaOf0girbCdP
WR5KuIBSXu0CZCcoS88jD2lFPUlNzJl/zQm5rNGwgQKBgQD2BBswpXHKqj5rVaej
pldMS5OGC1dVx5CMjfGxiovLZEHHswSTYCKW6Ov9OJn+tn8vldMnRBtC06MA6KIg
v/A9SDrBeRujJ5Gh+NRnEyklNrjz+o94E6Y+0OmoJO1/4PVES3E6qv89rFl3lP5P
ARDrcM5WHC68mMedwvJzjhQXJQKBgQDxQRDjr15ZWQaH6zPPMNZ8tvsGOyZPMZMw
3IsAmU4sKeXqigOij+2x70ivgekUdr0NRA1e34xOwWST9j3ZMNxvuSS2sIlaINrM
e5ocHWmD0K2uwWzLcUo9RZXHW+XMWi/PaESBcqAduqe8tASpRR+ApY2J6OlsXwvo
og5U6MuIHQKBgQCtSfkpC/Cac86h5mS+BkZJrJaOfeCXwImWJ8nOaCvOKaGYHAYm
FTpoGEtaQ4tdeokeKKfiabvWF6Mi2bqR3QFI+V7Btx/7jbysXcynijyaRPCEksKK
LzUT3C4pzVEpmXjKEWYBkD9X3tXqQJ3dYn/bh8sfppxZJji9bHtBYBvQrQKBgFuB
zIAwEl9dbya6xcn+wjxHw2sXoG5FZYkQ/gBaJdaGhdiyRLKyWPw2wKEha2EBsK+J
cnDb5gIxRI8CxW7OI66U0SIiT9bJw3PwJgIn/c+rpVU1tKht7jTTYf5eEwmx45SN
/f4DlkvwcpMWzPXPbCWFpev7Vh5u5rt0TG9UZW7ZAoGATyj0gGLhPoXBd4r6wDPu
3UTAmYlWipVinj8jhAtRt/FOhdmr2mVwnqru38wbBXgaM5BE5uDtpusERshrr9JP
b5DG6fDQZs0fScMQ2Wzo/6eyFi4i7wQnEoo+gIMzWsXk0AKs1UoyIduShCVk9B/j
mtdeuTGSxPh6Cs1o2PTZSTU=
-----END PRIVATE KEY-----
{ "key": ".", "command": "" }
apiVersion: v1
Kind: Template
metadata:
name: web-portal-template-configmap
objects:
- apiVersion: v1
kind: ConfigMap
metadata:
labels:
app: web-portal-configuration
name: web-portal-configmap
data:
REACT_APP_BASE_URL: ${BASE_URL}
REACT_APP_OAUTH_CLIENT_ID: push-notifications
REACT_APP_AUTHORIZATION_URL: https://auth.cern.ch/auth/realms/cern/protocol/openid-connect/auth
REACT_APP_OAUTH_REDIRECT_URL: ${OAUTH_REDIRECT_URL}
parameters:
- name: BASE_URL
description: "Base URL of the API"
required: True
- name: OAUTH_REDIRECT_URL
description: "URL to which the user will be redirected after authenticating"
required: True
This diff is collapsed.
{
"name": "client",
"version": "0.1.0",
"private": true,
"dependencies": {
"@material-ui/core": "^1.4.1",
"@material-ui/icons": "^2.0.0",
"axios": "^0.18.0",
"build-url": "^1.1.2",
"classnames": "^2.2.6",
"cross-env": "^5.2.0",
"history": "^4.7.2",
"js-cookie": "^2.2.0",
"jwt-decode": "^2.2.0",
"node-sass-chokidar": "^1.3.0",
"npm-run-all": "^4.1.3",
"qs": "^6.5.2",
"react": "^16.4.1",
"react-dom": "^16.4.1",
"react-redux": "^5.0.7",
"react-router": "^4.3.1",
"react-router-dom": "^4.3.1",
"react-router-redux": "^5.0.0-alpha.9",
"react-scripts": "1.1.4",
"react-sidenav": "^2.1.3",
"redux": "^4.0.0",
"redux-api-middleware": "^2.3.0",
"redux-form": "^7.4.2",
"semantic-ui-react": "^0.88.2",
"serve": "^10.0.1"
},
"scripts": {
"build-css": "node-sass-chokidar --include-path ./src --include-path ./node_modules src/ -o src/",
"watch-css": "npm run build-css && node-sass-chokidar --include-path ./src --include-path ./node_modules src/ -o src/ --watch --recursive",
"start-js": "cross-env HTTPS=true react-scripts start",
"start": "cross-env NODE_PATH=./src npm-run-all -p watch-css start-js",
"build-js": "react-scripts build",
"build": "cross-env NODE_PATH=./src REACT_APP_BASE_URL=https://push-dev.web.cern.ch/api REACT_APP_OAUTH_CLIENT_ID=pushnotifications-service-prod REACT_APP_AUTHORIZATION_URL=https://oauth.web.cern.ch/OAuth/Authorize REACT_APP_OAUTH_REDIRECT_URL=https://push-dev.web.cern.ch/redirect npm-run-all build-css build-js",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject",
"start-prod": "serve -s ./build",
"prop-types": "^15.6.2"
},
"devDependencies": {
"@types/react": "^16.4.6",
"@types/react-dom": "^16.0.6",
"eslint": "^6.8.0",
"eslint-config-airbnb": "^17.0.0",
"eslint-config-prettier": "^6.10.0",
"eslint-plugin-import": "^2.14.0",
"eslint-plugin-jsx-a11y": "^6.1.1",
"eslint-plugin-prettier": "^3.1.2",
"eslint-plugin-react": "^7.10.0",
"husky": "^0.14.3",
"prettier": "^1.13.7",
"pretty-quick": "^1.6.0"
}
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="theme-color" content="#000000">
<!--
manifest.json provides metadata used when your web app is added to the
homescreen on Android. See https://developers.google.com/web/fundamentals/engage-and-retain/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json">
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/semantic-ui@2.4.2/dist/semantic.min.css" />
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>React App</title>
</head>
<body>
<noscript>
You need to enable JavaScript to run this app.
</noscript>
<div id="root"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.
To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
</body>
</html>
\ No newline at end of file
{
"short_name": "React App",
"name": "Create React App Sample",
"icons": [
{
"src": "favicon.ico",
"sizes": "64x64 32x32 24x24 16x16",
"type": "image/x-icon"
}
],
"start_url": "./index.html",
"display": "standalone",
"theme_color": "#000000",
"background_color": "#ffffff"
}
import React, { Component } from "react";
import { Route, Switch, Redirect } from "react-router-dom";
import PropTypes from "prop-types";
import LoginPageContainer from "auth/containers/pages/LoginPageContainer";
import RedirectPageContainer from "auth/containers/pages/RedirectPageContainer";
import * as authRoutes from "auth/routes";
import MainPageContainer from "./common/containers/pages/MainPageContainer";
const NoMatch = ({ location }) => (
<div>
<h3>
404 - No match for <code>{location.pathname}</code>
</h3>
</div>
);
NoMatch.propTypes = { location: PropTypes.isRequired };
class App extends Component {
render() {
return (
<Switch>
<Route path="/main" component={MainPageContainer} />
<Route
path={authRoutes.redirectRoute.path}
component={RedirectPageContainer}
/>
<Route
path={authRoutes.loginRoute.path}
component={LoginPageContainer}
/>
<Redirect to="/login" />
</Switch>
);
}
}
export default App;
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment