Skip to content

Commit

Permalink
Merge pull request #367 from cioos-siooc/feature/update-firebase-to-xml
Browse files Browse the repository at this point in the history
Feature/migrate-metadata-form-to-cioos-firebase-database
  • Loading branch information
JessyBarrette authored Nov 1, 2024
2 parents 835a075 + f20bae7 commit f9dba74
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 23 deletions.
4 changes: 2 additions & 2 deletions .firebaserc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"projects": {
"default": "cioos-metadata-form",
"dev": "cioos-metadata-form-dev"
"default": "cioos-metadata-form-8d942",
"dev": "cioos-metadata-form-dev-258dc"
},
"targets": {},
"etags": {}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/firebase-hosting-delete-channel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ jobs:
args: hosting:channel:delete pr${{github.event.number}}-${{steps.get-short-name.outputs.id}} --force
env:
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}
PROJECT_ID: cioos-metadata-form-dev
PROJECT_ID: cioos-metadata-form-dev-258dc
GITHUB_AUTH: ${{ secrets.ISSUE_CREATOR_PAT }}
2 changes: 1 addition & 1 deletion .github/workflows/firebase-hosting-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_CIOOS_METADATA_FORM }}'
expires: 30d
entryPoint: '.'
projectId: cioos-metadata-form-dev
projectId: cioos-metadata-form-dev-258dc
env:
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}
GMAIL_USER: ${{ secrets.GMAIL_USER }}
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,6 @@ firebase-debug.log
.Rproj.user

yarn.lock
.env
.env
.env.*
*.log
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,12 @@ We use a GitHub Actions workflow named `firebase-deploy` for deploying Firebase

### Deploying to Development Project

To deploy updated Firebase functions to the "cioos-metadata-form-dev" development project, follow these steps:
To deploy updated Firebase functions to the "cioos-metadata-form-dev-258dc" development project, follow these steps:

1. **Ensure your local setup is linked to the correct Firebase project** by using the Firebase CLI to login and select the "cioos-metadata-form-dev" project.
1. **Ensure your local setup is linked to the correct Firebase project** by using the Firebase CLI to login and select the "cioos-metadata-form-dev-258dc" project.

```bash
firebase use cioos-metadata-form-dev
firebase use cioos-metadata-form-dev-258dc
```

2. **Make necessary changes to your Firebase functions.**
Expand All @@ -103,7 +103,7 @@ The workflow utilizes the following secrets to create the virtual `.env` file fo
- `GITHUB_AUTH` used to push to github pages branch and other github action type stuff
- `REACT_APP_DEV_DEPLOYMENT` used to switch between development and production databases. Default False, set to True to use Dev database
- `REACT_APP_GOOGLE_CLOUD_API_KEY` found at https://console.cloud.google.com/apis/credentials?project=cioos-metadata-form
- `REACT_APP_GOOGLE_CLOUD_API_KEY_DEV` found at https://console.cloud.google.com/apis/credentials?project=cioos-metadata-form-dev
- `REACT_APP_GOOGLE_CLOUD_API_KEY_DEV` found at https://console.cloud.google.com/apis/credentials?project=cioos-metadata-form-dev-258dc

### Using Parameterized Configuration in Firebase Functions

Expand Down Expand Up @@ -137,12 +137,12 @@ Deploying Firebase Realtime Database security rules via the Firebase CLI is reco

### Define targets

This project has two databases: `cioos-metadata-form` (this is the default/main db for production) and `cioos-metadata-form-dev` (dev).
This project has two databases: `cioos-metadata-form` (this is the default/main db for production) and `cioos-metadata-form-dev-258dc` (dev).
Use Firebase CLI targets to manage rules deployment:

```bash
firebase target:apply database prod cioos-metadata-form
firebase target:apply database dev cioos-metadata-form-dev
firebase target:apply database dev cioos-metadata-form-dev-258dc
```

### Configure firebase.json
Expand Down Expand Up @@ -188,10 +188,10 @@ When hosting the application in a new place there are a couple of things to upda

- You must add your new domain to the allowed list for authenication in firebase.
https://console.firebase.google.com/u/0/project/cioos-metadata-form/authentication/settings
https://console.firebase.google.com/u/0/project/cioos-metadata-form-dev/authentication/settings
https://console.firebase.google.com/u/0/project/cioos-metadata-form-dev-258dc/authentication/settings

- You have to allow your domain under Website restrictions for the firebase browser key
https://console.cloud.google.com/apis/credentials/key/405d637a-efd4-48f5-95c6-f0af1d7f4889?project=cioos-metadata-form
https://console.cloud.google.com/apis/credentials/key/23d360a3-4b55-43f2-bc1c-b485371c0e07?project=cioos-metadata-form-dev
https://console.cloud.google.com/apis/credentials/key/23d360a3-4b55-43f2-bc1c-b485371c0e07?project=cioos-metadata-form-dev-258dc


12 changes: 6 additions & 6 deletions firebase-functions/.firebaserc
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
{
"projects": {
"default": "cioos-metadata-form",
"dev": "cioos-metadata-form-dev"
"default": "cioos-metadata-form-8d942",
"dev": "cioos-metadata-form-dev-258dc"
},
"targets": {
"cioos-metadata-form": {
"database": {
"prod": [
"cioos-metadata-form"
"cioos-metadata-form-8d942"
],
"dev": [
"cioos-metadata-form-dev"
"cioos-metadata-form-dev-258dc"
]
}
},
"development": {
"database": {
"prod": [
"cioos-metadata-form"
"cioos-metadata-form-8d942"
],
"dev": [
"cioos-metadata-form-dev"
"cioos-metadata-form-dev-258dc"
]
}
}
Expand Down
2 changes: 1 addition & 1 deletion firebase-functions/functions/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions src/firebase.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const deployedOnTestServer = process.env.REACT_APP_DEV_DEPLOYMENT;

const prodConfig = {
// see https://console.cloud.google.com/apis/credentials?project=cioos-metadata-form
// and https://console.cloud.google.com/apis/credentials?project=cioos-metadata-form-dev
// and https://console.cloud.google.com/apis/credentials?project=cioos-metadata-form-dev-258dc
// for api key location which is then stored in a github secret and added to several
// github actions to support testing and deployment.
// see https://firebase.google.com/docs/projects/api-keys for a discussion of why we
Expand All @@ -19,7 +19,7 @@ const prodConfig = {
storageBucket: "cioos-metadata-form-8d942.appspot.com",
messagingSenderId: "467286137979",
appId: "1:467286137979:web:250b09e3db2a56716016de",
measurementId: "G-BEMJG40RHN"
measurementId: "G-BEMJG40RHN",
};

const devConfig = {
Expand All @@ -30,7 +30,7 @@ const devConfig = {
storageBucket: "cioos-metadata-form-dev-258dc.appspot.com",
messagingSenderId: "141560007794",
appId: "1:141560007794:web:861d99b02210ea4d17c6eb",
measurementId: "G-BSKRHNR1EW"
measurementId: "G-BSKRHNR1EW",
};


Expand Down

0 comments on commit f9dba74

Please sign in to comment.