Skip to content

Commit

Permalink
remove .env
Browse files Browse the repository at this point in the history
comment out emulator code and remove unneeded db dump file

clean up

update readme

add heading to readme

remove db backup and import on emulator start
  • Loading branch information
fostermh committed Nov 30, 2023
1 parent 45b0965 commit 0398b45
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 13 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,19 @@ This will start a hot-reloading dev server. Click on the link that it outputs to

### Running the Firebase emulator

#### Local Install Alternative

Install firebase CLI [as described here](https://firebase.google.com/docs/emulator-suite/install_and_configure).

Run `firebase emulators:start` from the `firebase-functions/functions` directory.
Redirect function calls to this emulator by uncommenting the call to `useFunctionsEmulator` in [firebase.js](firebase.js).

#### Docker Alternative
Using the firebase emulator in docker will preload some data into a local realtime database and emulate cloud functions and the realtime database

docker-compose up -d --build
Redirect function calls to this emulator by uncommenting the call to `useFunctionsEmulator` in [firebase.js](firebase.js).

## Deploy to testing site at GitHub pages

Pushes to master automatically deploy to <https://cioos-siooc.github.io/metadata-entry-form/>
Expand Down
1 change: 0 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ services:
- ./firebase-functions/firestore.rules:/app/firestore.rules
- ./firebase-functions/firestore.indexes.json:/app/firestore.indexes.json
- ./firebase-functions/functions:/app/functions
- ./firebase-functions/emulator_backup:/app/backup
env_file:
- .env
environment:
Expand Down
8 changes: 1 addition & 7 deletions firebase-functions/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,4 @@ WORKDIR /app
ADD ./entrypoint.sh /app/entrypoint.sh
RUN chmod 755 entrypoint.sh

ENTRYPOINT ["./entrypoint.sh"]

# ENTRYPOINT [ "firebase", "--project=cioos-metadata-form", "emulators:start", "--only", "firestore,database,functions,auth", "--import", "./backup"]
# ENTRYPOINT [ "firebase", "--project=cioos-metadata-form", "--debug", "emulators:start", "--only", "firestore,database,functions,auth", "--import", "./backup"]
# ENTRYPOINT [ "firebase", "--project=cioos-metadata-form", "emulators:start", "--only", "firestore,database,functions,auth", "--import", "./backup", "--export-on-exit", "./backup"]

# firebase --project=cioos-metadata-form emulators:export ./backup
ENTRYPOINT ["./entrypoint.sh"]
2 changes: 1 addition & 1 deletion firebase-functions/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ echo "Launching emulator with following firebase.json config file"
cat firebase.json

npm --prefix ./functions install
firebase emulators:start --project=cioos-metadata-form --only=firestore,database,functions,auth --import=./backup
firebase emulators:start --project=cioos-metadata-form --only=firestore,database,functions,auth
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
"react-hot-loader": "^4.12.21"
},
"scripts": {
"start": "NODE_OPTIONS=--openssl-legacy-provider react-scripts start",
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject",
Expand Down
6 changes: 3 additions & 3 deletions src/firebase.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ if (window.location.hostname === "localhost" && deployedOnTestServer) {

firebase.initializeApp(config);
// uncomment below to use firebase emulator for local development
if (window.location.hostname === "localhost" && deployedOnTestServer) {
firebase.functions().useFunctionsEmulator("http://127.0.0.1:5002");
// if (window.location.hostname === "localhost" && deployedOnTestServer) {
// firebase.functions().useFunctionsEmulator("http://127.0.0.1:5002");
// firebase.auth().useEmulator("http://localhost:9099");
}
// }

export default firebase;

0 comments on commit 0398b45

Please sign in to comment.