A prototype into the metaverse.
Install Command Line Tools:
$ xcode-select --install
Next, setup Homebrew package manager: brew.sh.
python3
binary that ships by default with M1 Mac doesn't currently work with some of our dependencies (source).
To fix this, install python3
through homebrew:
$ brew install python3
Confirm that python3 is installed correctly:
$ file $(which python3)
/opt/homebrew/bin/python3: Mach-O 64-bit executable arm64
node-canvas
does not have a prebuilt binary for the M1 architecture and will attempt to build from source. Additional dependencies will be required to compile, install through homebrew.
$ brew install pkg-config cairo pango libpng jpeg giflib librsvg pixman
Make sure you're at node
version 16.20.0
exactly.
NVM can be installed by following the steps at https://github.com/nvm-sh/nvm#installing-and-updating
And then use the following command to install 16.20.0
:
nvm install 16.20.0
If you use NVM and you want to set Gather's node as the default, run:
$ nvm alias default 16.20.0
There are scripts that can auto-switch your node version based off the .nvmrc
file in the repo, instructions here. Or you can run nvm use
each time, and it'll use the version based off the file.
Package Manager | Version | Installation |
---|---|---|
yarn |
3.2.4 |
corepack enable && corepack prepare yarn@3.2.4 --activate |
There are onboarding instructions for WebStorm if you haven't worked with WebStorm before. It also includes a shared keymap, snippets (live templates), and code style settings.
We manage secrets in Doppler so make sure you follow the instructions to install the CLI tool and have yourself added to the right group.
Then, run doppler login
to have your client connected with your account.
Run npm run local-setup
in the root dir (you should only have to run this once to set up your local environment)
The script sets up a few things:
You can run or script more complex workflows with the Gather CLI. Read more about the commands available:
$ gather -h
The CLI is written in TypeScript, making it easy to add new functionality and business logic for scripts that will run in a shell. No more bash scripting needed!
Check out the modules/gather-cli
README for more info.
There's a one-off doppler setup you need to do to configure it with our project, which the script runs for you.
Finally, it runs npm run setup:all
, which installs all dependencies across all modules, and builds everything.
Gather CLI helps with adding dependencies according to specific conventions for us. Run
$ gather add -h
for more info.
Please set up Prettier in your favorite editor, and use it. Many editors will have fancy integrations like "reformat on save" that are quite handy. It's quite easy and will take maybe 1 minute to set up, and save you a world of frustration with CI checks about lint.
Use the local dependency and not a global install, because your version may be out of sync with this project's.
# do this
$ npx prettier ...
# not this
$ prettier ...
Instructions for IntelliJ / WebStorm: https://www.jetbrains.com/help/webstorm/prettier.html
Your settings should look something like this:
Instructions for VS Code: https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode
Your User settings should have no mention of prettier because it'll be controlled at the Workspace level:
You can verify your Workspace settings has reference to the .prettierrc
config file:
You can make sure the .prettierrc
is being read by changing something in the config like semi: false
and verifying the document is formatted differently.
Sometimes your IDE and the CI system will dispute over the "correct" formatting. Your source of truth will always be the command line:
$ npx prettier --check path/to/file.ts
# or, to see what the output would be:
$ npx prettier --write path/to/file.ts
Make sure you have the correct version installed in node_modules/prettier
(2.5.1) at the time of this writing, just check it against the yarn.lock
version:
$ npm pkg get version --prefix node_modules/prettier
"2.5.1"
Here's some steps to help resolve disputes between CLI/CI and your IDE:
node_modules
everywhere).prettierrc
config.prettierrc
.In githooks/ there are some git hooks that automatically merge changes from
main down to the more unstable branches. Run npm run install-githooks
to install
them.
To automatically eslint and prettify your code as you commit it, run npx husky install
once to enable a pre-commit git hook. Any time you run git commit
after enabling
Husky, eslint and prettier will fix up and format
staged files. Any changes made during this step will be staged and committed automatically
while any errors that occur will cancel the git commit altogether.
Note: you'll need to install Java to run the Firebase emulator. The easiest way to do so with is brew:
$ brew install --cask temurin
We use Docker for running certain services.
Docker can be downloaded and installed via the following methods:
$ brew install docker --cask
, OR/usr/local/bin
Docker can be very resource heavy and the defaults can be unforgiving.
You can edit Docker's resource limits in Preferences/Settings:
We connect to a shared dev instance of Firestore (gather-town-dev
) for local development. Try visiting this page. If you don't have access, reach out to Michael or Kumail to request access.
The local Firestore emulator is mostly used for tests, and should be installed via npm along with other project dependencies.
We run CockroachDB locally for our database. You can run this command to install (or reinstall) the CRDB binary:
$ gather db:install
Start up the database with gather db:run
, or just use gather test:emulator
to run the DB and other services needed for tests.
Then run the migrations with gather db:migrate
. This will also seed your local DB with data needed for local development.
You can reset your DB and start fresh by running gather db:reset
.
If you need access to staging and prod DBs, you'll need access to the stg
and prod
config in Doppler. File a ticket in Linear assigning the Infra team to request access.
You will also need login credentials to access the DBs. Talk to @andrew
(Andrew Smith) to have credentials created. Then set up a .env
file under modules/gather-prisma-backend/.env
, to look like this:
DATABASE_URL="postgresql://root@localhost:26257/gather"
DATABASE_USER="..."
DATABASE_PASSWORD="..."
Andrew will provide you with a user and password.
You can easily access any DB env (test
, local
, staging
, or prod
) programmatically. Go to gather-prisma-backend to get started.
You can load a UI editor for the DB in WebStorm. Download the Database Tools and SQL for WebStorm plugin. Then grab a license from our license pool.
Lastly, set up a DB config to connect to your local instance. Go to [Database] > [New]...
And add this config for local
DB environment:
Name: gather@local (or whatever you want)
Host: localhost
Port: 26257
User: root
Password: <empty>
Database: gather
And this one for test
DB environment:
Name: gather@test (or whatever you want)
Host: localhost
Port: 26258
User: root
Password: <empty>
Database: gather
There's actually multiple "test DBs" that we maintain for running tests in parallel, but when you run a single test file (e.g. through the IDE) it'll connect to gather
, and then you can look at the state of the DB data after running the test.
You can do similar for staging
and prod
, pull the name and password from Doppler's DATABASE_URL
variable (staging config, prod config). You will then need to substitute in your own credentials. You can get the full URL like this:
$ gather db:url staging
$ gather db:url prod
From this, you can find the values to input into the WebStorm configuration:
postgres://[user]:[password]@[host]:[port]/[database]
Once you run gather db:migrate
, you should see tables show up.
You can double-click on one to view or edit the data in a table format. When you make edits, you can either revert them, or submit them as changes to the DB.
And you can do your usual work like searching or using ORDER BY:
You can also run SQL queries from a console that connects to the DB:
With it, you can run any SQL command. Fastest way to run a command is Search For Action (⌘ ⇧ A) "Execute". Or you can slowly move your mouse and click the green arrow, but that gets annoying over time.
You are expected to review the onboarding guides and information on both Prisma (our ORM) and CRDB (our DB).
We run Livekit Server locally for our Audio/Video SFU. Download the livekit-server binary to run locally:
$ brew install livekit
yarn start
from directory modules/gather-dev-server
to start the game/http dev serveryarn start
from directory modules/gather-browser
to start the hot loadermodules/gather-video-sfu/README.md
and modules/gather-video-router/README.md
for how to run the video system locallyThen visit http://localhost:8080
.
Look at the deploy
dir.
Tests require some services to be running locally. Run them all in a shared window with gather test:emulator
.
Or, you can run them individually:
gather db:run
to start CockroachDB locallygather test:firebase
to start the Firebase emulatorgather test:redis
to start a Redis server locallygather test:livekitServer
to start a Livekit server locallyRun gather test:run
from the root to run all module tests (or gather test:run -a
from anywhere)
Run gather test:run [module]
for all tests matching a module name / file pattern.
For the most part, you should be running tests from your IDE, because it's the easiest way to run a single test or group of tests or run in a debugger.
Please avoid the jest CLI, even if you're familiar with it, because it fits less well with the engineering workflow at Gather. (Also there's some hacky setup required.)
Read through the Testing Style Guide for guidance on the patterns and principles of testing at Gather. If you're just joining, you will have specific sections suggested to you during the testing onboarding process, so you can follow the prompts in the exercises.
Generated using TypeDoc