Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Deploy swedish admin #357

Merged
merged 3 commits into from
Apr 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .env

This file was deleted.

2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
HOST=localhost
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this used for anything? AFAIK know REACT_APP_* envs are let through

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no idea? 🤷 Global search for process.env.HOST or similar should yield results if it's used.

REACT_APP_API_URL=http://localhost:3000
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ npm-debug.log*
yarn-debug.log*
yarn-error.log*
.eslintcache
src/config/config.ts
fellmirr marked this conversation as resolved.
Show resolved Hide resolved
.env
fellmirr marked this conversation as resolved.
Show resolved Hide resolved
16 changes: 10 additions & 6 deletions cloudbuild.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
steps:
- name: 'gcr.io/cloud-builders/npm'
- id: 'install'
name: 'gcr.io/cloud-builders/npm'
args: ['install']
- name: 'gcr.io/cloud-builders/npm'

- id: 'type-check'
name: 'gcr.io/cloud-builders/npm'
args: ['run', 'typecheck']
fellmirr marked this conversation as resolved.
Show resolved Hide resolved

- id: 'test'
name: 'gcr.io/cloud-builders/npm'
env: ['CI=true']
args: ['run', 'test']
- name: 'gcr.io/cloud-builders/npm'
env: ['CI=true']
args: ['run', 'build']
args: ['run', 'test']
38 changes: 32 additions & 6 deletions clouddeploy.dev.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,37 @@
steps:
- name: 'gcr.io/cloud-builders/npm'
- id: 'install'
name: 'gcr.io/cloud-builders/npm'
args: ['install']
- name: 'gcr.io/cloud-builders/npm'

- id: 'type-check'
name: 'gcr.io/cloud-builders/npm'
args: ['run', 'typecheck']

- id: 'test'
name: 'gcr.io/cloud-builders/npm'
env: ['CI=true']
args: ['run', 'test']
- name: 'gcr.io/cloud-builders/npm'
env: ['CI=true']

# The build and deploy steps for each region must happen in direct sequence
# or the wrong build might get deployed to the wrong place
# 1. Build for region A
# 2. Deploy to region A
# 3. Build for region B
# 4. Deploy to region B
- id: 'build-norway'
name: 'gcr.io/cloud-builders/npm'
env: ['CI=true', 'REACT_APP_API_URL=https://data.gieffektivt.no']
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NO dev is using the same backend from what I can tell? But also login doesn't work it seems 🤔

args: ['run', 'build']

- id: 'deploy-norway'
name: 'gcr.io/cloud-builders/gsutil'
args: ['-m', 'cp', '-r', 'build/*', 'gs://effekt-admin-dev/']

- id: 'build-sweden'
name: 'gcr.io/cloud-builders/npm'
env: ['CI=true', 'REACT_APP_API_URL=https://api.dev.geeffektivt.se']
args: ['run', 'build']
- name: 'gcr.io/cloud-builders/gsutil'
args: ['-m', 'cp', '-r', 'build/*', 'gs://effekt-admin-dev/']

- id: 'deploy-sweden'
name: 'gcr.io/cloud-builders/gsutil'
args: ['-m', 'cp', '-r', 'build/*', 'gs://admin.dev.geeffektivt.se/']
39 changes: 33 additions & 6 deletions clouddeploy.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,38 @@
steps:
- name: 'gcr.io/cloud-builders/npm'
- id: 'install'
name: 'gcr.io/cloud-builders/npm'
args: ['install']
- name: 'gcr.io/cloud-builders/npm'

- id: 'type-check'
name: 'gcr.io/cloud-builders/npm'
args: ['run', 'typecheck']

- id: 'test'
name: 'gcr.io/cloud-builders/npm'
env: ['CI=true']
args: ['run', 'test']
- name: 'gcr.io/cloud-builders/npm'
env: ['CI=true']

# The build and deploy steps for each region must happen in direct sequence
# or the wrong build might get deployed to the wrong place
# 1. Build for region A
# 2. Deploy to region A
# 3. Build for region B
# 4. Deploy to region B
- id: 'build-norway'
name: 'gcr.io/cloud-builders/npm'
env: ['CI=true', 'REACT_APP_API_URL=https://data.gieffektivt.no']
args: ['run', 'build']

- id: 'deploy-norway'
name: 'gcr.io/cloud-builders/gsutil'
args: ['-m', 'cp', '-r', 'build/*', 'gs://static.gieffektivt.no/']

# TODO: Swap to prod api url and bucket when available
- id: 'build-sweden'
name: 'gcr.io/cloud-builders/npm'
env: ['CI=true', 'REACT_APP_API_URL=https://api.dev.geeffektivt.se']
args: ['run', 'build']
- name: 'gcr.io/cloud-builders/gsutil'
args: ['-m', 'cp', '-r', 'build/*', 'gs://static.gieffektivt.no/']

- id: 'deploy-sweden'
name: 'gcr.io/cloud-builders/gsutil'
args: ['-m', 'cp', '-r', 'build/*', 'gs://admin.dev.geeffektivt.se/']
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"typecheck": "tsc --noEmit",
"test": "",
"eject": "react-scripts eject"
},
Expand Down
2 changes: 1 addition & 1 deletion src/config/config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export const DEV_ENVIRONMENT: boolean = process.env.NODE_ENV === 'development' ? true : false;
export const API_URL: string = DEV_ENVIRONMENT ? 'http://localhost:5050' : 'https://data.gieffektivt.no';
export const API_URL: string = process.env.REACT_APP_API_URL || 'http://localhost:5050';
export const API_AUTH: IApiAuth = {
clientId: '1b43d77677588cfe9302fa729d1ab',
permissions: [
Expand Down