-
-
Notifications
You must be signed in to change notification settings - Fork 407
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
Chore/fix up firebase emulator #3598
Chore/fix up firebase emulator #3598
Conversation
deeab7f
to
fc95a08
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #3598 +/- ##
==========================================
- Coverage 74.87% 67.83% -7.04%
==========================================
Files 39 411 +372
Lines 1214 12795 +11581
Branches 247 2249 +2002
==========================================
+ Hits 909 8680 +7771
- Misses 285 4093 +3808
- Partials 20 22 +2 ☔ View full report in Codecov by Sentry. |
083c45d
to
e658765
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great work!
is the storage_export
folder suposed to be included on git?
Something to note: for me, the e2e tests don't run. So actually, the functions e2e job may fail because I edited the firebase.json file. Currently, the only way to check that is if a maintainer pushes the code or presses the merge button. |
Thanks! Yep, on master you can also see a version of this is already committed similar in other seed data. Hidden in zips or compressed files. If you unzip Everything in the So I guess not including it would make there be no images in the seed data. |
c616993
to
1df026d
Compare
@mariojsnunes feedback addressed. I assume the CI e2e will fail again |
b42e343
to
941bb14
Compare
Looks like I deleted a file that is used in the Cloud Functions tests. |
508b591
to
eee9328
Compare
Passing run #5744 ↗︎
Details:
Review all test suite changes for PR #3598 ↗︎ |
55bb451
to
6490c22
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pizzaisdavid! Amazing! Thank you.
Ran it locally on my mac 14.4.1 and did the basics.
Followed the docs on packages/documentation/docs/Backend Development/firebase-emulator.md
the command yarn run backend:emulator:watch
isn't working for me but docker run -v ./functions:/app/functions -p 4001-4008:4001-4008 -it emulator
on functions/Dockerfile.emulator
worked fine. Log below.
benfurber@Benjamins-Laptop community-platform % yarn run backend:emulator:watch
[1] time="2024-06-05T15:30:13+01:00" level=warning msg="/Users/benfurber/projects/community-platform/docker-compose.yml: `version` is obsolete"
[1] #0 building with "desktop-linux" instance using docker driver
[1]
[1] #1 [emulator internal] load build definition from Dockerfile.emulator
[1] #1 transferring dockerfile: 3.19kB done
[1] #1 DONE 0.0s
[1]
[1] #2 [emulator internal] load metadata for docker.io/library/node:20.9.0-bullseye-slim
[1] #2 DONE 1.2s
[1]
[1] #3 [emulator internal] load .dockerignore
[1] #3 transferring context: 2B done
[1] #3 DONE 0.0s
[1]
[1] #4 [emulator 1/11] FROM docker.io/library/node:20.9.0-bullseye-slim@sha256:330fa0342b6ad2cbdab30ac44195660af5a1f298cc499d8cbdf7496b02ea17d8
[1] #4 DONE 0.0s
[1]
[1] #5 [emulator internal] load build context
[1] #5 transferring context: 155B done
[1] #5 DONE 0.0s
[1]
[1] #6 [emulator 10/11] RUN echo "#!/bin/bash\n" >> ./export.sh && echo "firebase emulators:export --project demo-community-platform-emulated --force ./dump\n" >> ./export.sh && chmod +x ./export.sh
[1] #6 CACHED
[1]
[1] #7 [emulator 7/11] COPY ./firebase.storage.rules ./firebase.storage.rules
[1] #7 CACHED
[1]
[1] #8 [emulator 6/11] COPY ./firebase.json ./firebase.json
[1] #8 CACHED
[1]
[1] #9 [emulator 9/11] COPY ./firestore.rules ./firestore.rules
[1] #9 CACHED
[1]
[1] #10 [emulator 3/11] RUN apt-get update && apt-get -y install openjdk-11-jre-headless && apt-get -y install nano && apt-get clean
[1] #10 CACHED
[1]
[1] #11 [emulator 4/11] RUN npm install -g firebase-tools
[1] #11 CACHED
[1]
[1] #12 [emulator 5/11] RUN firebase setup:emulators:ui && firebase setup:emulators:firestore && firebase setup:emulators:database && firebase setup:emulators:storage && firebase setup:emulators:pubsub
[1] #12 CACHED
[1]
[1] #13 [emulator 2/11] WORKDIR /app
[1] #13 CACHED
[1]
[1] #14 [emulator 8/11] COPY ./firestore.indexes.json ./firestore.indexes.json
[1] #14 CACHED
[1]
[1] #15 [emulator 11/11] RUN mkdir ./seed
[1] #15 CACHED
[1]
[1] #16 [emulator] exporting to image
[1] #16 exporting layers done
[1] #16 writing image sha256:7342849822d024d537b4826b68bf2ea7661de4c2eb048d80ac19cf7f9ee1f355 done
[1] #16 naming to docker.io/library/community-platform-emulator done
[1] #16 DONE 0.0s
[1] Container community-platform-emulator-1 Recreate
[1] Container community-platform-emulator-1 Recreated
[1] Attaching to emulator-1
[1] emulator-1 | ⚠ emulators: You are not currently authenticated so some features may not work correctly. Please run firebase login to authenticate the CLI.
[1] emulator-1 | i emulators: Starting emulators: auth, functions, firestore, database, hosting, pubsub, storage
[1] emulator-1 | i emulators: Detected demo project ID "demo-community-platform-emulated", emulated services will use a demo configuration and attempts to access non-emulated services for this project will fail.
[1] emulator-1 | ⚠ functions: You are not signed in to the Firebase CLI. If you have authorized this machine using gcloud application-default credentials those may be discovered and used to access production services.
[1] emulator-1 | i firestore: Importing data from /app/seed/firestore_export/firestore_export.overall_export_metadata
[1] emulator-1 | i firestore: Firestore Emulator logging to firestore-debug.log
[1] emulator-1 | ✔ firestore: Firestore Emulator UI websocket is running on 9150.
[1] emulator-1 | ⚠ database: Did not find a Realtime Database rules file specified in a firebase.json config file. The emulator will default to allowing all reads and writes. Learn more about this option: https://firebase.google.com/docs/emulator-suite/install_and_configure#security_rules_configuration.
[1] emulator-1 | i database: Database Emulator logging to database-debug.log
[1] emulator-1 | i emulators: Shutting down emulators.
[1] emulator-1 | i functions: Stopping Functions Emulator
[1] emulator-1 | i database: Stopping Database Emulator
[1] emulator-1 | i firestore: Stopping Firestore Emulator
[1] emulator-1 | i eventarc: Stopping Eventarc Emulator
[1] emulator-1 | i hub: Stopping emulator hub
[1] emulator-1 |
[1] emulator-1 | Error: An unexpected error has occurred.
emulator-1 exited with code 2
[1] docker-compose up --force-recreate --build emulator exited with code 0
--> Sending SIGTERM to other processes..
[0] yarn workspace functions watch exited with code 129```
b746b82
to
a920477
Compare
a920477
to
c9828c0
Compare
rebased (whoop) |
🎉 This PR is included in version 1.189.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
PR Checklist
PR Type
Description
Make the emulator stuff work for the backend. 😅
Demo video:
raw link - https://www.youtube.com/watch?v=qLfQgMpWguE
I recommend starting by pulling the branch locally and following the updated documentation https://github.com/pizzaisdavid/community-platform/blob/51ed0187aa155337a7d8130895739c08767d9f8e/packages/documentation/docs/Backend%20Development/firebase-emulator.md
Everything in
functions/data/emulator
can be ignored, as that is data that is loaded into the emulator so there is initial data.This removes
packages/emulators-docker
in favor of placing the emulator stuff in thefunctions
folder.