Skip to content

Commit

Permalink
feat: add docs how create firebase project and fix mirror server dock…
Browse files Browse the repository at this point in the history
…er error (#213)

* feat: add docs how create firebase project and fix mirror server docker error

* Update mirror-docs/docs/open-source-code/firebase.mdx

---------

Co-authored-by: Gordon MacPherson <[email protected]>
  • Loading branch information
Rybasher and RevoluPowered authored Jun 13, 2024
1 parent 2a6553b commit ca74100
Show file tree
Hide file tree
Showing 15 changed files with 76 additions and 4 deletions.
2 changes: 1 addition & 1 deletion mirror-docs/docs/open-source-code/architecture.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
sidebar_position: 2
sidebar_position: 3
---

# Architecture
Expand Down
Binary file added mirror-docs/docs/open-source-code/choose-app.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added mirror-docs/docs/open-source-code/enter-name.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
70 changes: 70 additions & 0 deletions mirror-docs/docs/open-source-code/firebase.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
---
sidebar_position: 2
---

# Creating a Firebase Project

## Prerequisites

Before you start, make sure you have:

- A Google account

## Step 1: Go to Firebase Console

1. Open your web browser and go to the [Firebase Console](https://console.firebase.google.com/).
2. Sign in with your Google account if you are not already signed in.

## Step 2: Create a New Project

1. In the Firebase Console, click on the **Create a project** or **Add project** button.

![Create a Project](create-project.png)

2. Enter a project name. The project name should be descriptive and unique.
![Enter a project name](enter-name.png)

3. (Optional) You can also set up Google Analytics for your project. If you want to enable Google Analytics, select the **Enable Google Analytics for this project** checkbox. If not, uncheck the box.

4. Click **Continue**.

5. If you chose to enable Google Analytics, you will be prompted to select or create an Analytics account. Follow the on-screen instructions to set up your Analytics settings. Click **Create project**.

6. Firebase will set up your new project. This might take a few moments. Once the setup is complete, click **Continue** to proceed to your project dashboard.
![Firebase project is ready](project-ready.png)

## Step 3: Create Firebase App

1. In the project overview page, click the **Web** icon to create a new web app.

![Choose app](choose-app.png)

2. Register your app by entering a nickname for your web app and optionally set up Firebase Hosting.
![Enter app name](enter-app-name.png)

3. Click **Register app**.

4. Firebase will generate a Firebase SDK snippet for you. To continue, click "Continue to console"
![Continue to console](continue-to-console.png)

## Step 3: Generate service account JSON

To interact with Firebase services programmatically, you need to generate a service account key file. Follow these steps to create the JSON file:

1. In the Firebase Console, click on the **gear icon** next to **Project Overview** and select **Project settings**.

![Project Settings](open-settings.png)

2. Go to the **Service accounts** tab.

3. Click the **Generate new private key** button.

![Generate Key](service-accounts.png)

4. A dialog will appear. Click **Generate key** to confirm.

![Generate Key](generate-key.png)

5. Your browser will download a JSON file containing your service account key. Save this file securely as it contains sensitive information.

![Download Key](downloaded-keys-file.png)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion mirror-docs/docs/open-source-code/get-started.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Setup was tested with WSL2 (defualt for not Professional versions of Windows)

3. Configure your `./mirror-web-server/.env` by duplicating your `.env.example` file and renaming it to `.env`. Use the defaults where needed and plug in your own env variables where necessary.

4. [Create a new Firebase project](https://firebase.google.com/) and [download your service account JSON](https://firebase.google.com/docs/admin/setup) file to `/mirror-web-server/the-mirror-backend-dev-firebase-admin.json`, which will plug the `mirror-web-server` into your own Firebase instance. This is required if you're running `mirror-web-server` locally since `mirror-web-server` requires admin permissions.
4. [Create a new Firebase project](/docs/open-source-code/firebase) and download your service account JSON file and replace the contents of file `/mirror-web-server/firebase-creds-example.json` with the contents of the downloaded file , which will plug the `mirror-web-server` into your own Firebase instance. This is required if you're running `mirror-web-server` locally since `mirror-web-server` requires admin permissions.

5. From git bash or WSL, from `YOUR_PROJECT_DIR/mirror-web-server/`, run `docker compose up`

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion mirror-web-server/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,5 @@ DISABLE_EMAIL=true
ASSET_STORAGE_DRIVER=LOCAL

# if ASSET_STORAGE_DRIVER is not GCP, then this is required
ASSET_STORAGE_URL=http://localhost:9000/
ASSET_STORAGE_URL=http://localhost:9000/assets-storage/

3 changes: 2 additions & 1 deletion mirror-web-server/src/space/space.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2165,7 +2165,8 @@ export class SpaceService implements IRoleConsumer {
private _subscribeToSpaceSchemaChanges(): void {
// check if localhost. Mongo requires a replica set for this to work
if (
process.env.MONGODB_URL?.includes('127.0.0.1') &&
(process.env.MONGODB_URL?.includes('127.0.0.1') ||
process.env.MONGODB_URL?.includes('mongo:27017')) &&
process.env.NODE_ENV !== 'production'
) {
console.warn('Not running changestream since on localhost')
Expand Down

0 comments on commit ca74100

Please sign in to comment.