Skip to content
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

Feature/firebase emulator config switch #707

Merged
Changes from 1 commit
Commits
Show all changes
113 commits
Select commit Hold shift + click to select a range
f548b1f
Implementation of the Firebase Emulator DevService
jfbenckhuijsen Oct 28, 2024
c8e670a
Added firebase integration testing
jfbenckhuijsen Nov 1, 2024
0a9e223
Switch on or off the Firestore and Pubsub dev services based on a con…
jfbenckhuijsen Nov 1, 2024
2e6e862
Merge branch 'feature/emulator-credentials' into feature/firebase-emu…
jfbenckhuijsen Nov 1, 2024
e39fded
Merge branch 'feature/firebase-emulator' into feature/firebase-emulat…
jfbenckhuijsen Nov 1, 2024
3e34037
Create test to use both Firestore and pubsub
jfbenckhuijsen Nov 1, 2024
fe2266e
Merge branch 'feature/firebase-emulator' into feature/firebase-emulat…
jfbenckhuijsen Nov 1, 2024
c25de1c
Merge remote-tracking branch 'main/main' into feature/firebase-emulat…
jfbenckhuijsen Nov 2, 2024
7da9e29
Merge remote-tracking branch 'main/main' into feature/firebase-emulator
jfbenckhuijsen Nov 2, 2024
70f9eb8
Formatting fixes
jfbenckhuijsen Nov 2, 2024
81841f8
Formatting fixes
jfbenckhuijsen Nov 2, 2024
62122cc
Version bump for new modules
jfbenckhuijsen Nov 2, 2024
e2222dd
Docs regenerated
jfbenckhuijsen Nov 2, 2024
f17e6d3
Merge branch 'feature/firebase-emulator' into feature/firebase-emulat…
jfbenckhuijsen Nov 2, 2024
06726ad
Docs regenerated
jfbenckhuijsen Nov 2, 2024
81f4d99
Formatting fixes
jfbenckhuijsen Nov 2, 2024
ba22251
Use emulator credentials by default in case the config property is set.
jfbenckhuijsen Nov 2, 2024
9d2ab29
Merge branch 'feature/firebase-emulator' into feature/firebase-emulat…
jfbenckhuijsen Nov 2, 2024
530dce0
Generated docs and formatted sources
jfbenckhuijsen Nov 2, 2024
e1db024
Dont start pubsub and firestore container if disabled
jfbenckhuijsen Nov 2, 2024
5c1dc54
Moved firebase library versions to bom (as it is shared with the new …
jfbenckhuijsen Nov 13, 2024
58d8693
Moved firebase emulator container to separate class, which is totally…
jfbenckhuijsen Nov 13, 2024
771e9a7
Documentation fixes, using the generated configuration table.
jfbenckhuijsen Nov 13, 2024
d039a2d
Fix writing the emulator data on exit
jfbenckhuijsen Nov 13, 2024
36a6ccc
Split the logic to build the FirebaseEmulatorContainer configuration …
jfbenckhuijsen Nov 13, 2024
a0f1b48
Removed obsolete check
jfbenckhuijsen Nov 13, 2024
9a48b15
Formatting changes
jfbenckhuijsen Nov 13, 2024
5084b9f
Fix property for firestore
jfbenckhuijsen Nov 13, 2024
535d1fa
Renamed enum name
jfbenckhuijsen Nov 14, 2024
cf1c783
Fix writing container logs
jfbenckhuijsen Nov 14, 2024
78d8308
Formatting fix
jfbenckhuijsen Nov 14, 2024
9bc7679
Output debug data for output files
jfbenckhuijsen Nov 14, 2024
90bfcec
Documentation regenerated
jfbenckhuijsen Nov 14, 2024
16ca50a
Debug export on build server
jfbenckhuijsen Nov 14, 2024
42971d5
Debug export on build server
jfbenckhuijsen Nov 14, 2024
020f398
Debug export on build server
jfbenckhuijsen Nov 14, 2024
235c691
Debug export on build server
jfbenckhuijsen Nov 14, 2024
ab2ff11
Debug export on build server
jfbenckhuijsen Nov 14, 2024
e18d12f
Add specifying the user and groupid
jfbenckhuijsen Nov 14, 2024
c430c57
Combine docker run commands and fix order of commands to speed up doc…
jfbenckhuijsen Nov 14, 2024
beef407
Combine docker run commands and fix order of commands to speed up doc…
jfbenckhuijsen Nov 14, 2024
382ee26
Fix file permissions
jfbenckhuijsen Nov 14, 2024
a77608d
Try run as gitlab user
jfbenckhuijsen Nov 14, 2024
994b330
Cleanup debug code
jfbenckhuijsen Nov 14, 2024
e25d7b0
Fix documentation
jfbenckhuijsen Nov 14, 2024
f3c3518
Formatting fix
jfbenckhuijsen Nov 14, 2024
db28e35
Regenerated documentation
jfbenckhuijsen Nov 14, 2024
6d49dde
Update firebase-admin/runtime/src/main/java/io/quarkiverse/googleclou…
jfbenckhuijsen Nov 21, 2024
a9af679
Update firebase/README.md
jfbenckhuijsen Nov 21, 2024
874bab4
Added missing test scope
jfbenckhuijsen Nov 21, 2024
96c2a30
Removed obsolete properties
jfbenckhuijsen Nov 21, 2024
f7c6cf3
Update firebase/deployment/src/main/java/io/quarkiverse/googlecloudse…
jfbenckhuijsen Nov 21, 2024
0c80a67
Fix comment to match default
jfbenckhuijsen Nov 21, 2024
9cbeb5a
Renamed module to firebase-devservices
jfbenckhuijsen Nov 21, 2024
30281e1
Renamed module to firebase-devservices
jfbenckhuijsen Nov 21, 2024
c7f02ca
Merge remote-tracking branch 'origin/feature/firebase-emulator-config…
jfbenckhuijsen Nov 21, 2024
b1d5362
Merge remote-tracking branch 'refs/remotes/main/main' into feature/fi…
jfbenckhuijsen Nov 21, 2024
461172d
Moved files to new directory
jfbenckhuijsen Nov 21, 2024
c8d8b2d
New name for firebase devservices, new doc files generated
jfbenckhuijsen Nov 21, 2024
021d9cc
New name for firebase devservices, new doc files generated
jfbenckhuijsen Nov 21, 2024
83dea99
Formatting fix
jfbenckhuijsen Nov 21, 2024
a3e8a06
Docs regenerated
jfbenckhuijsen Nov 21, 2024
79dd652
Added firebase schema
jfbenckhuijsen Nov 15, 2024
b45041e
Changed schema ports number -> integer
jfbenckhuijsen Nov 15, 2024
cb826d6
Merge fixes
jfbenckhuijsen Nov 15, 2024
f935201
Added config options for the rules and indexes files
jfbenckhuijsen Nov 21, 2024
9c8fa6e
Firebase container moved to separate package
jfbenckhuijsen Nov 21, 2024
a712b1b
Firebase container moved to separate package
jfbenckhuijsen Nov 21, 2024
eb031f7
Added tests and completed setup to include custom firebase.json, Fire…
jfbenckhuijsen Nov 30, 2024
e9f2219
Update docs/modules/ROOT/pages/firebase.adoc
jfbenckhuijsen Dec 12, 2024
6ff127c
Update firebase-devservices/runtime/src/main/resources/META-INF/quark…
jfbenckhuijsen Dec 12, 2024
2b82260
Update docs/modules/ROOT/pages/firebase.adoc
jfbenckhuijsen Dec 12, 2024
0b90afc
Update docs/modules/ROOT/pages/firebase.adoc
jfbenckhuijsen Dec 12, 2024
baab7ed
Fix documentation page name and include in navigation
jfbenckhuijsen Dec 12, 2024
a16bb55
Update firebase.adoc
jfbenckhuijsen Dec 15, 2024
ad647a6
Refactored config setup
jfbenckhuijsen Dec 15, 2024
1b6264f
Merge branch 'feature/firebase-emulator-config-switch-rules' into fea…
jfbenckhuijsen Dec 15, 2024
0be5dad
Refactored to separate package
jfbenckhuijsen Dec 15, 2024
59b926c
Import changes from testcontainers-firebase module
jfbenckhuijsen Dec 15, 2024
01fb947
Update docs/modules/ROOT/pages/firebase.adoc
jfbenckhuijsen Dec 15, 2024
b5f81b0
Update docs/modules/ROOT/pages/firebase.adoc
jfbenckhuijsen Dec 15, 2024
9f08a6a
Merge remote-tracking branch 'origin/feature/firebase-emulator-config…
jfbenckhuijsen Dec 15, 2024
ee2dc6a
Update configuration
jfbenckhuijsen Dec 15, 2024
365401c
Fixes from copying from main module
jfbenckhuijsen Dec 15, 2024
3743dec
Refactored config setup and connected to new builder for FirebaseEmul…
jfbenckhuijsen Dec 15, 2024
4277e40
Fix properties based on changed config setup
jfbenckhuijsen Dec 15, 2024
9e529e3
Formatting fixes
jfbenckhuijsen Dec 15, 2024
dda79bf
Removed obsolete test
jfbenckhuijsen Dec 15, 2024
be35c0e
Fix storage unit test
jfbenckhuijsen Dec 16, 2024
f7da5f3
Merge remote-tracking branch 'main/main' into feature/firebase-emulat…
jfbenckhuijsen Dec 16, 2024
e9de6dc
Merge in main
jfbenckhuijsen Dec 16, 2024
4592f11
Fix config mapping to match mapping in quarkus.extension.yaml
jfbenckhuijsen Dec 17, 2024
06957c1
Formatting fixed
jfbenckhuijsen Dec 17, 2024
a2547bd
Documentation regenerated
jfbenckhuijsen Dec 17, 2024
5111190
Removed dependency on firebase-devservices from firebase-admin. No ne…
jfbenckhuijsen Dec 17, 2024
798a0db
Fixed extension definition
jfbenckhuijsen Dec 17, 2024
874996e
Update docs with getting started info
jfbenckhuijsen Dec 17, 2024
9228063
If no emulators are defined via configuration, make sure to fallback …
jfbenckhuijsen Dec 17, 2024
5e10315
Fix maven name of the devservices projects
jfbenckhuijsen Dec 17, 2024
2a7415a
Add firebase devservices as dependency
jfbenckhuijsen Dec 17, 2024
f9f6adf
Remove unneeded config option
jfbenckhuijsen Dec 17, 2024
249afe4
Enable firebase auth
jfbenckhuijsen Dec 17, 2024
64d081c
Fix doc (typo)
jfbenckhuijsen Dec 17, 2024
868e41e
Fix missing pubsub emulator parsing
jfbenckhuijsen Dec 17, 2024
eeb5b9b
Improve reading of firebase.json file and added documentation
jfbenckhuijsen Dec 18, 2024
f353ec0
Run npm install for test dependencies for functions
jfbenckhuijsen Dec 20, 2024
bf90792
Use specific project id
jfbenckhuijsen Dec 20, 2024
39608c8
Fix path to NPM package.json
jfbenckhuijsen Dec 20, 2024
8be975c
Move config files into the test directory
jfbenckhuijsen Dec 20, 2024
338451a
Create temporary files in target (build) directory
jfbenckhuijsen Dec 20, 2024
9c855f6
Move schema to META-INF
jfbenckhuijsen Dec 20, 2024
921ff66
Fix formatting
jfbenckhuijsen Dec 20, 2024
bc2c5a0
Fix formatting
jfbenckhuijsen Dec 20, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Combine docker run commands and fix order of commands to speed up doc…
…ker image creation.
jfbenckhuijsen committed Nov 14, 2024
commit c430c57455d01375f18dfd9eafc07209fb17b284
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
package io.quarkiverse.googlecloudservices.firebase.deployment;

import java.nio.file.Path;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.*;
import java.util.stream.Collectors;

import org.jboss.logging.Logger;
@@ -201,6 +198,13 @@ public FirebaseEmulatorContainer(EmulatorConfig firebaseConfig) {

private static class FirebaseDockerBuilder {

private static final Map<Emulator, String> DOWNLOADABLE_EMULATORS = Map.of(
Emulator.REALTIME_DATABASE, "database",
Emulator.CLOUD_FIRESTORE, "firestore",
Emulator.PUB_SUB, "pubsub",
Emulator.CLOUD_STORAGE, "storage",
Emulator.EMULATOR_SUITE_UI, "ui");

private final ImageFromDockerfile result;

private final EmulatorConfig firebaseConfig;
@@ -223,10 +227,10 @@ public ImageFromDockerfile build() {
this.clearUnneededUsersAndGroups();
this.authenticateToFirebase();
this.setupJavaToolOptions();
this.addFirebaseJson();
this.fixFilePermissions();
this.setupUserAndGroup();
this.downloadEmulators();
this.addFirebaseJson();
this.setupDataImportExport();
this.setupHosting();
this.runExecutable();
@@ -269,24 +273,30 @@ private void installNeededSoftware() {
dockerBuilder
.run("apk --no-cache add openjdk11-jre bash curl openssl gettext nano nginx sudo && " +
"npm cache clean --force && " +
"npm i -g firebase-tools@" + firebaseConfig.firebaseVersion());
"npm i -g firebase-tools@" + firebaseConfig.firebaseVersion() + " &&" +
"mkdir -p " + FIREBASE_ROOT);
}

private void clearUnneededUsersAndGroups() {
dockerBuilder.run("deluser nginx && delgroup abuild && delgroup ping");
}

private void downloadEmulators() {
downloadEmulator(Emulator.REALTIME_DATABASE, "database");
downloadEmulator(Emulator.CLOUD_FIRESTORE, "firestore");
downloadEmulator(Emulator.PUB_SUB, "pubsub");
downloadEmulator(Emulator.CLOUD_STORAGE, "storage");
downloadEmulator(Emulator.EMULATOR_SUITE_UI, "ui");
var cmd = DOWNLOADABLE_EMULATORS
.entrySet()
.stream()
.map(e -> downloadEmulatorCommand(e.getKey(), e.getValue()))
.filter(Objects::nonNull)
.collect(Collectors.joining(" && "));

dockerBuilder.run(cmd);
}

private void downloadEmulator(Emulator emulator, String downloadId) {
private String downloadEmulatorCommand(Emulator emulator, String downloadId) {
if (isEmulatorEnabled(emulator)) {
dockerBuilder.run("firebase setup:emulators:" + downloadId);
return "firebase setup:emulators:" + downloadId;
} else {
return null;
}
}