build(#187): add india config

keep-around/44e70269ba4e4c3ea8c912424bbb3a0e479f07f4
Andrei Dekterev 3 years ago
parent 5e259d1cdf
commit fb76eaa14e
  1. 147
      .drone.yml
  2. 53
      Makefile
  3. 1
      package.json
  4. 9
      run.sh
  5. 3
      src/config/clients/index.tsx
  6. 15
      src/config/clients/india.tsx
  7. 2
      src/config/clients/types.tsx
  8. 6
      src/config/routes.tsx
  9. 2
      src/features/AuthServiceApp/config/clients/index.tsx
  10. 9
      src/features/AuthServiceApp/config/clients/india.tsx
  11. 9
      src/features/AuthStore/helpers.tsx
  12. 2
      src/react-app-env.d.ts

@ -15,9 +15,27 @@ trigger:
- refs/heads/master
steps:
- name: deploy script
- name: npm-install
image: node:16-alpine
environment:
REACT_APP_STRIPE_PK:
from_secret: REACT_APP_STRIPE_PK
commands:
- apk add --no-cache make
- npm install --legacy-peer-deps
- name: make-prod
image: node:16-alpine
environment:
REACT_APP_STRIPE_PK:
from_secret: REACT_APP_STRIPE_PK
commands:
- make prod
depends_on:
- npm-install
- name: deploy script
image: amazon/aws-cli:latest
environment:
AWS_ACCESS_KEY_ID:
from_secret: AWS_ACCESS_KEY_ID
@ -25,27 +43,126 @@ steps:
from_secret: AWS_SECRET_ACCESS_KEY
AWS_DEFAULT_REGION:
from_secret: AWS_DEFAULT_REGION
REACT_APP_STRIPE_PK:
from_secret: REACT_APP_STRIPE_PK
SSH_KEY_AUTH:
from_secret: SSH_KEY_AUTH
commands:
- apk add --no-cache aws-cli bash git openssh-client make rsync
- npm install --legacy-peer-deps
- make prod
# - aws s3 sync build s3://insports-prod --delete
# - aws cloudfront create-invalidation --distribution-id E3KY6BCU3AYHEW --paths "/*"
- aws s3 sync build s3://instat-frontend-test-a --delete
- aws cloudfront create-invalidation --distribution-id E1WZHVCHZ48SG6 --paths "/*"
depends_on:
- make-prod
- name: make-auth
image: node:16-alpine
environment:
REACT_APP_STRIPE_PK:
from_secret: REACT_APP_STRIPE_PK
commands:
- make auth-production-build
depends_on:
- npm-install
- name: deploy-S3-auth
image: amazon/aws-cli:latest
environment:
AWS_ACCESS_KEY_ID:
from_secret: AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY:
from_secret: AWS_SECRET_ACCESS_KEY
AWS_DEFAULT_REGION:
from_secret: AWS_DEFAULT_REGION
commands:
- aws s3 sync build s3://insports-auth --delete
- aws cloudfront create-invalidation --distribution-id EERIKX9X2SRPJ --paths "/*"
depends_on:
- make-auth
- name: deploy-old-auth-server
image: node:16-alpine
environment:
SSH_KEY_AUTH:
from_secret: SSH_KEY_AUTH
commands:
- apk add --no-cache openssh-client rsync
- eval $(ssh-agent -s)
- echo -n "$SSH_KEY_AUTH" | tr -d '\r' | ssh-add -
- mkdir -p ~/.ssh && chmod 700 ~/.ssh
- ssh-keyscan auth.insports.tv >> ~/.ssh/known_hosts
- rsync -v -r -C build_auth/ ubuntu@auth.insports.tv:/home/ubuntu/ott-auth/src/frontend/
- rsync -v -r -C build_auth/clients/* ubuntu@auth.insports.tv:/home/ubuntu/ott-auth/src/frontend/templates
- ssh ubuntu@auth.insports.tv 'bash -s' < ./run.sh OTT-2535 docker-compose-stage.yaml
depends_on:
- make-auth
- name: make-india
image: node:16-alpine
environment:
REACT_APP_STRIPE_PK:
from_secret: REACT_APP_STRIPE_PK
commands:
- make india-build
depends_on:
- npm-install
- name: deploy-india
image: amazon/aws-cli:latest
environment:
AWS_ACCESS_KEY_ID:
from_secret: AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY:
from_secret: AWS_SECRET_ACCESS_KEY
AWS_DEFAULT_REGION:
from_secret: AWS_DEFAULT_REGION
commands:
- aws s3 sync build_india s3://insports-india --delete
- aws cloudfront create-invalidation --distribution-id E5DKN8IPOMASO --paths "/*"
depends_on:
- make-india
- name: make-facr
image: node:16-alpine
environment:
REACT_APP_STRIPE_PK:
from_secret: REACT_APP_STRIPE_PK
commands:
- make facr-build
depends_on:
- npm-install
- name: deploy-facr
image: amazon/aws-cli:latest
environment:
AWS_ACCESS_KEY_ID:
from_secret: AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY:
from_secret: AWS_SECRET_ACCESS_KEY
AWS_DEFAULT_REGION:
from_secret: AWS_DEFAULT_REGION
commands:
- aws s3 sync build_facr s3://insports-facr-tv --delete
- aws cloudfront create-invalidation --distribution-id E1ZYJS9RAJO89D --paths "/*"
depends_on:
- make-facr
- name: make-lff
image: node:16-alpine
environment:
REACT_APP_STRIPE_PK:
from_secret: REACT_APP_STRIPE_PK
commands:
- make lff-build
depends_on:
- npm-install
- name: deploy-lff
image: amazon/aws-cli:latest
environment:
AWS_ACCESS_KEY_ID:
from_secret: AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY:
from_secret: AWS_SECRET_ACCESS_KEY
AWS_DEFAULT_REGION:
from_secret: AWS_DEFAULT_REGION
commands:
- aws s3 sync build_lff s3://insports-tv-lff-lv --delete
- aws cloudfront create-invalidation --distribution-id E2127IDW4TEH4S --paths "/*"
depends_on:
- make-lff
---
kind: pipeline
@ -131,7 +248,6 @@ steps:
## - ssh-keyscan auth.insports.tv >> ~/.ssh/known_hosts
## - rsync -v -r -C build_auth/ ubuntu@auth.insports.tv:/home/ubuntu/ott-auth/src/frontend/
## - rsync -v -r -C build_auth/clients/* ubuntu@auth.insports.tv:/home/ubuntu/ott-auth/src/frontend/templates
## - ssh ubuntu@auth.insports.tv 'bash -s' < ./run.sh OTT-2535 docker-compose-stage.yaml
---
@ -536,4 +652,5 @@ steps:
- ssh-keyscan auth.test.insports.tv >> ~/.ssh/known_hosts
- rsync -v -r -C build_auth/ ubuntu@auth.test.insports.tv:/home/ubuntu/ott-auth/src/frontend/
- rsync -v -r -C build_auth/clients/* ubuntu@auth.test.insports.tv:/home/ubuntu/ott-auth/src/frontend/templates
- ssh ubuntu@auth.test.insports.tv 'bash -s' < ./run.sh OTT-2535-test docker-compose-test.yaml
- aws s3 sync build s3://auth-insports-test --delete
- aws cloudfront create-invalidation --distribution-id E10YI3RFOZZDLZ --paths "/*"

@ -120,14 +120,24 @@ auth-production-build:
facr-build: clean
REACT_APP_TYPE=ott \
REACT_APP_ENV=staging \
REACT_APP_CLIENT=facr \
REACT_APP_ENV=production \
REACT_APP_STRIPE_PK=pk_live_51J5TEYEDSxVnTgDW7v2lF8GGogrm7XaaICZ9CN876sITIBBauZgB2ommUTUOiY868jzpbhQjZcoBOjIRX5Vs54Aq00y4C3USyB \
BUILD_PATH=build_facr \
npm run build
india-build: clean
REACT_APP_TYPE=ott \
REACT_APP_ENV=production \
REACT_APP_STRIPE_PK=pk_live_51J5TEYEDSxVnTgDW7v2lF8GGogrm7XaaICZ9CN876sITIBBauZgB2ommUTUOiY868jzpbhQjZcoBOjIRX5Vs54Aq00y4C3USyB \
BUILD_PATH=build_india \
npm run build
lff-build: clean
REACT_APP_TYPE=ott \
REACT_APP_ENV=staging \
REACT_APP_ENV=production \
REACT_APP_STRIPE_PK=pk_live_51J5TEYEDSxVnTgDW7v2lF8GGogrm7XaaICZ9CN876sITIBBauZgB2ommUTUOiY868jzpbhQjZcoBOjIRX5Vs54Aq00y4C3USyB \
REACT_APP_CLIENT=lff \
BUILD_PATH=build_lff \
npm run build
.PHONY: build
@ -151,6 +161,13 @@ preprod: clean
REACT_APP_STRIPE_PK=pk_live_ANI76cBhSo69DZUxPmyRVIZW \
npm run build
india-prod: clean
REACT_APP_TYPE=ott \
REACT_APP_ENV=production \
REACT_APP_CLIENT=india \
REACT_APP_STRIPE_PK=pk_live_51J5TEYEDSxVnTgDW7v2lF8GGogrm7XaaICZ9CN876sITIBBauZgB2ommUTUOiY868jzpbhQjZcoBOjIRX5Vs54Aq00y4C3USyB \
npm run build && cp -r .well-known build
facr-prod: clean
REACT_APP_TYPE=ott \
REACT_APP_ENV=production \
@ -175,36 +192,6 @@ lff-prod: clean
deploy-all: prod preprod facr-prod lff-prod
stage: build-stage
rsync -zavP --delete-before build/ -e 'ssh -p 666' ott-staging@137.74.33.74:/usr/local/www/ott-staging/wwwroot/
a-stage: build-a
rsync -zavP --delete-before build/ -e 'ssh -p 666' ott-staging@137.74.33.74:/usr/local/www/ott-staging/a-wwwroot/
b-stage: build-b
rsync -zavP --delete-before build/ -e 'ssh -p 666' ott-staging@137.74.33.74:/usr/local/www/ott-staging/b-wwwroot/
c-stage: build-c
rsync -zavP --delete-before build/ -e 'ssh -p 666' ott-staging@137.74.33.74:/usr/local/www/ott-staging/c-wwwroot/
d-stage: build-d
rsync -zavP --delete-before build/ -e 'ssh -p 666' ott-staging@137.74.33.74:/usr/local/www/ott-staging/d-wwwroot/
e-stage: build-e
rsync -zavP --delete-before build/ -e 'ssh -p 666' ott-staging@137.74.33.74:/usr/local/www/ott-staging/e-wwwroot/
f-stage: build-f
rsync -zavP --delete-before build/ -e 'ssh -p 666' ott-staging@137.74.33.74:/usr/local/www/ott-staging/f-wwwroot/
g-stage: build-g
rsync -zavP --delete-before build/ -e 'ssh -p 666' ott-staging@137.74.33.74:/usr/local/www/ott-staging/g-wwwroot/
h-stage: build-h
rsync -zavP --delete-before build/ -e 'ssh -p 666' ott-staging@137.74.33.74:/usr/local/www/ott-staging/h-wwwroot/
i-stage: build-i
rsync -zavP --delete-before build/ -e 'ssh -p 666' ott-staging@137.74.33.74:/usr/local/www/ott-staging/i-wwwroot/
test:
npm test

@ -16,6 +16,7 @@
"test:auth": "REACT_APP_TYPE=auth-service react-scripts test",
"facr": "REACT_APP_CLIENT=facr react-scripts start",
"lff": "REACT_APP_CLIENT=lff react-scripts start",
"india": "REACT_APP_CLIENT=india react-scripts start",
"insports": "REACT_APP_CLIENT=insports react-scripts start"
},
"dependencies": {

@ -1,9 +0,0 @@
#!/bin/bash
branch=$1
composefile=$2
cd /home/ubuntu/ott-auth
docker-compose -f $composefile down
docker-compose -f $composefile up -d
echo "[>] Deployment done."

@ -4,6 +4,7 @@ import { facr } from './facr'
import { instat } from './instat'
import { lff } from './lff'
import { insports } from './insports'
import { india } from './india'
export const currentClient = process.env.REACT_APP_CLIENT || 'insports'
@ -11,9 +12,11 @@ export const isLffClient = currentClient === 'lff'
export const isInSportsClient = currentClient === 'insports'
export const isInstatClient = currentClient === 'instat'
export const isFacrClient = currentClient === 'facr'
export const isIndiaClient = currentClient === 'india'
const clients = {
facr,
india,
insports,
instat,
lff,

@ -0,0 +1,15 @@
import {
ClientConfig,
ClientIds,
ClientNames,
} from './types'
import { insports } from './insports'
export const india: ClientConfig = {
...insports,
auth: {
clientId: ClientIds.India,
},
name: ClientNames.India,
}

@ -6,6 +6,7 @@ type StyledCss = ReturnType<typeof css>
export enum ClientIds {
Facr = 'facr-ott-web',
India = 'india-ott-web',
Insports = 'insports-ott-web',
Instat = 'ott-web',
Lff = 'lff-ott-web',
@ -13,6 +14,7 @@ export enum ClientIds {
export enum ClientNames {
Facr = 'facr',
India = 'india',
Insports = 'insports',
Instat = 'instat',
Lff = 'lff',

@ -5,15 +5,15 @@ import { ENV, isProduction } from './env'
export const APIS = {
preproduction: {
api: 'https://api.insports.tv',
auth: 'https://api.auth.insports.tv',
auth: 'https://auth.insports.tv',
},
production: {
api: 'https://api.insports.tv',
auth: 'https://api.auth.insports.tv',
auth: 'https://auth.insports.tv',
},
staging: {
api: 'https://api.test.insports.tv',
auth: 'https://api.auth.test.insports.tv',
auth: 'https://auth.test.insports.tv',
},
}

@ -4,12 +4,14 @@ import { facr } from './facr'
import { insports } from './insports'
import { instat } from './instat'
import { lff } from './lff'
import { india } from './india'
const clients = {
[ClientIds.Facr]: facr,
[ClientIds.Instat]: instat,
[ClientIds.Lff]: lff,
[ClientIds.Insports]: insports,
[ClientIds.India]: india,
}
const params = new URLSearchParams(window.location.search)

@ -0,0 +1,9 @@
import { insports as platformInsports } from 'config/clients/insports'
import type { ClientConfig } from './types'
import { insports } from './insports'
export const india: ClientConfig = {
...platformInsports,
...insports,
}

@ -23,6 +23,8 @@ export const getClientNameByRedirectUri = () => {
switch (client.name) {
case ClientNames.Lff:
return 'lff.instat'
case ClientNames.India:
return 'india.insports'
case ClientNames.Facr:
return ClientNames.Facr
case ClientNames.Instat:
@ -35,7 +37,12 @@ export const getClientNameByRedirectUri = () => {
const redirectUrl = () => {
const clientName = getClientNameByRedirectUri()
switch (true) {
case (process.env.NODE_ENV === 'development' || client.name === 'lff' || client.name === 'facr'):
case (
process.env.NODE_ENV === 'development'
|| client.name === 'lff'
|| client.name === 'facr'
|| client.name === 'india'
):
return `${window.origin}/redirect`
case (ENV === 'staging' || ENV === 'preproduction'):
return `https://${stageENV}.insports.tv/redirect`

@ -3,7 +3,7 @@
declare namespace NodeJS {
export interface ProcessEnv {
REACT_APP_CLIENT: 'instat' | 'facr' | 'lff' | 'insports',
REACT_APP_CLIENT: 'instat' | 'facr' | 'lff' | 'insports' | 'india',
REACT_APP_ENV: 'production' | 'preproduction' | 'staging',
REACT_APP_STAGE: 'staging' | 'test-a' | 'test-b' | 'test-c' | 'test-d' | 'test-e' | 'test-f' | 'test-g' | 'test-h' | 'test-i' | 'test-j' | 'test',
REACT_APP_TYPE: 'auth-service' | 'ott',

Loading…
Cancel
Save