Skip to content

Commit 2827a46

Browse files
explain how to authenticate with GCP outside of GCP environment
fix
1 parent c5a991d commit 2827a46

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

.env.example

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ MARBLE_APP_HOST=localhost:3000
2222
# Leave the "test-project" value if you are using the firebase emulator
2323
GOOGLE_CLOUD_PROJECT=test-project
2424

25+
# Required for authentication if you are running with a real firebase app and cloud storage bucket, outside of a GCP environment
26+
GOOGLE_APPLICATION_CREDENTIALS=
27+
2528
SENTRY_DSN=
2629

2730

README.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,22 +121,30 @@ It will run out of the box with the firebase auth emulator. If you wish to run M
121121

122122
The first time you run the code, you should enter an organization name and organization admin user email to create using the `CREATE_ORG_NAME` and `CREATE_ORG_ADMIN_EMAIL` environment variables. Unless using the firebase emulator, you must enter an actual email address that you own so that you may verify it and login with firebase. You can always create new organizations later using the same procedure.
123123

124-
In a local demo setup:
124+
**In a local demo setup:**
125125

126126
> In a local test setup (meaning if you are running with the firebase auth emulator), the License key is not required. You can leave it empty. The full feature set is available.
127127
128128
- just run the docker-compose as it is, it should work
129129
- give the firebase emulator a moment to get started, it's a bit slow when first launched
130130
- create a Firebase user with the email you provided in the `CREATE_ORG_ADMIN_EMAIL` environment variable (you can do this on the Marble login page by using the SSO button or sign up with email)
131131

132-
In a production setup:
132+
**In a production setup:**
133133

134134
- set the `FIREBASE_AUTH_EMULATOR_HOST_SERVER` and `FIREBASE_AUTH_EMULATOR_HOST_CLIENT` env variables to empty strings in your .env file
135135
- create a Firebase project and a Firebase app, and set the relevant env variables (`FIREBASE_API_KEY` to `FIREBASE_APP_ID` as well as `GOOGLE_CLOUD_PROJECT`) in your .env file
136136
- if you plan to use the batch ingestion feature or the case manager with file storign feature, make sure you create the Google Cloud Storage buckets, set the corresponding env variables and run your code in a setup that will allow default application credentials detection
137137
- create a Firebase user with the email you provided in the `CREATE_ORG_ADMIN_EMAIL` environment variable (you can do this on the Marble login page by using the SSO button or sign up with email)
138138
- if you have a license key, set it in the `LICENSE_KEY` env variable in your .env file
139139

140+
**Firebase authentication:**
141+
142+
In a production setup, you need to authenticate to GCP to use Firebase and Cloud Storage. If you are not running the container directly in a GCP environment, here is how you could do this:
143+
144+
- create a volume attached to the marble-api container (see the )
145+
- place the json service account key for GCP in the local shared folder (or otherwise inject it into the docker container, depending on how you run Marble)
146+
- set the `GOOGLE_APPLICATION_CREDENTIALS` variable equal to the path to the service account key
147+
140148
Open the Marble console by visiting `http://localhost:3000`, and interact with the Marble API at `http://localhost:8080` (assuming you use the default ports). Change those values accordingly if you configured a different port or if you are calling a specific host.
141149

142150
### 🕵 **How to use Marble**

docker-compose.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ services:
3838
- ${HOST_API_PORT:-8080}:${API_PORT:-8080}
3939
volumes:
4040
- marble-tempfiles:/tempFiles
41+
# - ./local_shared:/shared # uncomment and adapt this line if you need to inject a service account key into the container
4142
environment:
4243
ENV: ${ENV:-}
4344
PORT: ${API_PORT:-}
@@ -52,6 +53,7 @@ services:
5253
MARBLE_APP_HOST: ${MARBLE_APP_HOST:-localhost:${HOST_APP_PORT:-3000}}
5354
# default value of GOOGLE_CLOUD_PROJECT must be kept if working with the emulator (and the emulator is running in the docker image below)
5455
GOOGLE_CLOUD_PROJECT: ${GOOGLE_CLOUD_PROJECT:-test-project}
56+
GOOGLE_APPLICATION_CREDENTIALS: ${GOOGLE_APPLICATION_CREDENTIALS:-}
5557
REQUEST_LOGGING_LEVEL: ${REQUEST_LOGGING_LEVEL:-}
5658
LOGGING_FORMAT: ${LOGGING_FORMAT:-}
5759
CREATE_GLOBAL_ADMIN_EMAIL: ${CREATE_GLOBAL_ADMIN_EMAIL:-}

0 commit comments

Comments
 (0)