diff --git a/mirror-docs/docs/open-source-code/architecture.mdx b/mirror-docs/docs/open-source-code/architecture.mdx index 18a70cf5..97965634 100644 --- a/mirror-docs/docs/open-source-code/architecture.mdx +++ b/mirror-docs/docs/open-source-code/architecture.mdx @@ -1,5 +1,5 @@ --- -sidebar_position: 2 +sidebar_position: 3 --- # Architecture diff --git a/mirror-docs/docs/open-source-code/choose-app.png b/mirror-docs/docs/open-source-code/choose-app.png new file mode 100644 index 00000000..1338cdcd Binary files /dev/null and b/mirror-docs/docs/open-source-code/choose-app.png differ diff --git a/mirror-docs/docs/open-source-code/continue-to-console.png b/mirror-docs/docs/open-source-code/continue-to-console.png new file mode 100644 index 00000000..1f92e0f8 Binary files /dev/null and b/mirror-docs/docs/open-source-code/continue-to-console.png differ diff --git a/mirror-docs/docs/open-source-code/create-project.png b/mirror-docs/docs/open-source-code/create-project.png new file mode 100644 index 00000000..b6d8a27c Binary files /dev/null and b/mirror-docs/docs/open-source-code/create-project.png differ diff --git a/mirror-docs/docs/open-source-code/downloaded-keys-file.png b/mirror-docs/docs/open-source-code/downloaded-keys-file.png new file mode 100644 index 00000000..d3f2ed5e Binary files /dev/null and b/mirror-docs/docs/open-source-code/downloaded-keys-file.png differ diff --git a/mirror-docs/docs/open-source-code/enter-app-name.png b/mirror-docs/docs/open-source-code/enter-app-name.png new file mode 100644 index 00000000..a73dbabc Binary files /dev/null and b/mirror-docs/docs/open-source-code/enter-app-name.png differ diff --git a/mirror-docs/docs/open-source-code/enter-name.png b/mirror-docs/docs/open-source-code/enter-name.png new file mode 100644 index 00000000..344f110a Binary files /dev/null and b/mirror-docs/docs/open-source-code/enter-name.png differ diff --git a/mirror-docs/docs/open-source-code/firebase.mdx b/mirror-docs/docs/open-source-code/firebase.mdx new file mode 100644 index 00000000..a2a96a97 --- /dev/null +++ b/mirror-docs/docs/open-source-code/firebase.mdx @@ -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) diff --git a/mirror-docs/docs/open-source-code/generate-key.png b/mirror-docs/docs/open-source-code/generate-key.png new file mode 100644 index 00000000..ae6e5ca9 Binary files /dev/null and b/mirror-docs/docs/open-source-code/generate-key.png differ diff --git a/mirror-docs/docs/open-source-code/get-started.mdx b/mirror-docs/docs/open-source-code/get-started.mdx index c741e14c..5aaaacdb 100644 --- a/mirror-docs/docs/open-source-code/get-started.mdx +++ b/mirror-docs/docs/open-source-code/get-started.mdx @@ -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` diff --git a/mirror-docs/docs/open-source-code/open-settings.png b/mirror-docs/docs/open-source-code/open-settings.png new file mode 100644 index 00000000..e3168706 Binary files /dev/null and b/mirror-docs/docs/open-source-code/open-settings.png differ diff --git a/mirror-docs/docs/open-source-code/project-ready.png b/mirror-docs/docs/open-source-code/project-ready.png new file mode 100644 index 00000000..90691098 Binary files /dev/null and b/mirror-docs/docs/open-source-code/project-ready.png differ diff --git a/mirror-docs/docs/open-source-code/service-accounts.png b/mirror-docs/docs/open-source-code/service-accounts.png new file mode 100644 index 00000000..2d824a4b Binary files /dev/null and b/mirror-docs/docs/open-source-code/service-accounts.png differ diff --git a/mirror-web-server/.env.example b/mirror-web-server/.env.example index f326419e..35af8bc5 100644 --- a/mirror-web-server/.env.example +++ b/mirror-web-server/.env.example @@ -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/ + diff --git a/mirror-web-server/src/space/space.service.ts b/mirror-web-server/src/space/space.service.ts index 4e3a7897..795bf801 100644 --- a/mirror-web-server/src/space/space.service.ts +++ b/mirror-web-server/src/space/space.service.ts @@ -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')