0

I need some direction because I am a bit lost currently. I have my create-react-app frontend that builds in a CI/CD pipeline into google app engine. It serves the app frontend properly on the proejct url eg.. https://project.appspot.com/. So the build works fine.

Now I would like to have a production and staging enviroment, where the staging is password protected (via a .htpassword file or the like) so staged changes can be viewed internally. Im not sure what the technical name for this type of dev, staging, production enviroment thing is or if it is even possible with what im trying to do. Would be nice if someone could point me in the right direction or knows the name of it so I can start googling.

Here is my cloudbuild file:

`steps:
- name: 'gcr.io/cloud-builders/git'
  args: ['clone', '<GIT-URL>']

- name: 'gcr.io/cloud-builders/npm'
  args: ['install']
  dir: 'frontend-stage/'

- name: 'gcr.io/cloud-builders/npm'
  args: ['install', 'react-scripts']
  dir: 'frontend-stage/'

- name: 'gcr.io/cloud-builders/npm'
  args: ['run', 'build']
  dir: 'frontend-stage/'

- name: "gcr.io/cloud-builders/gcloud"
  args: ["app", "deploy"]
  dir: 'frontend-stage/'`

And my app.yaml:

`runtime: nodejs10

handlers:

- url: /(.*\..+)$
  static_files: build/\1
  upload: build/(.*\..+)$

- url: /.*
  static_files: build/index.html
  upload: build/index.html
  
- url: /.*
  secure: always
  script: auto`

Thank you very much!

boscoe
  • 181
  • 1
  • 5
  • Based on the description, you want to restrict people to entering to the URL that GAE is creating for your dev service, right? If that's the case, you can use [IAP](https://cloud.google.com/iap/docs). – bhito Jun 24 '20 at 12:02

1 Answers1

0

.htpassword is handled at the webserver apache level, in this case apache is not present in App Engine, but you might use NodeJS code to do basic auth, there are several options described in this post that could be useful.

For App Engine official authentication options you can check this documentation

Andres S
  • 1,168
  • 7
  • 11