Skip to content

Commit

Permalink
Docs: update env vars + dev container instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
kyleecodes authored Jun 3, 2024
1 parent 15f6412 commit 1242788
Showing 1 changed file with 17 additions and 19 deletions.
36 changes: 17 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ For a more detailed explanation of this project's key concepts and architecture,
- [Docker](https://www.docker.com/) - Containers for api and db
- [Heroku](https://heroku.com) - Build, deploy and operate staging and production apps
- [GitHub Actions](https://github.com/features/actions) - CI pipeline
- Swagger - API documentation

## Local development

Expand All @@ -59,16 +58,22 @@ For a more detailed explanation of this project's key concepts and architecture,

**Recommended for Visual Studio & Visual Studio Code users.**

This method will automatically install all dependencies and IDE settings in a Dev Container (Docker container) within Visual Studio Code. Simply clone this repo to your computer, open in Visual Studio Code, and select "Re-open in Container" when notified.
This method will automatically install all dependencies and IDE settings in a Dev Container (Docker container) within Visual Studio Code.

After re-opening VS Code in a dev container, develop as you normally would and use the container terminal within VS Code. Next, [configure your environment variables](#configure-environment-variables).
Directions for running a dev container:
1. Meet the [system requirements](https://code.visualstudio.com/docs/devcontainers/containers#_system-requirements)
2. Follow the [installation instructions](https://code.visualstudio.com/docs/devcontainers/containers#_installation)
3. [Check the installation](https://code.visualstudio.com/docs/devcontainers/tutorial#_check-installation)
4. After you've verified that the extension is installed and working, click on the "Remote Status" bar icon and select
"Reopen in Container". From here, the option to "Re-open in Container" should pop up in notifications whenever opening this project in VS.
5. [Configure your environment variables](#configure-environment-variables) and develop as you normally would.

The dev Container is configured in the `.devcontainer` directory:

- `docker-compose.yml` file in this directory extends the `docker-compose.yml` in the root directory.
- `devcontainer.json` configures the integrations with Visual Studio Code, such as the IDE extensions and settings in the `vscode` directory.

Read for more detailed instructions: [Visual Studio Code Docs: Developing Inside a Dev Container](https://code.visualstudio.com/docs/devcontainers/containers).
See [Visual Studio Code Docs: Developing Inside a Dev Container](https://code.visualstudio.com/docs/devcontainers/containers) for more info.

### Install dependencies

Expand All @@ -78,18 +83,10 @@ yarn

### Configure Environment Variables

- If you are an official Chayn volunteer: please get in touch with the team for access to our environment variables.

- If you are an open-source contributor: create a new `.env` file and populate it with the following variables.

**The Firebase tokens are required for running locally, the Simplybook tokens are required for testing, and all other variables are optional.**

You will need to gather your own Firebase tokens. Here are resources to get started:

- [Firebase Docs: Auth](https://firebase.google.com/docs/auth)
- [Firebase Docs: API Keys](https://firebase.google.com/docs/projects/api-keys)
- [Firebase Docs: Projects](https://firebase.google.com/docs/projects/learn-more#project-identifiers)
- [Firebase Docs: Get Started with Fundamentals](https://firebase.google.com/docs/guides)
Create a new `.env` file and populate it with the variables below. Note that only the Firebase and Simplybook tokens are required.
To configure the Firebase variables, first [create a Firebase project in the Firebase console](https://firebase.google.com/) (Google account required).
Next, follow [these directions](https://firebase.google.com/docs/cloud-messaging/auth-server#provide-credentials-manually) to generate a private key file in JSON format.
These will generate all the required Firebase variables.

The Simplybook variables can be mocked data, meaning **you do not need to use real Simplybook variables, simply copy paste the values given below.**
If you acquire real Simplybook environment variables, use the same format given below.
Expand All @@ -103,6 +100,7 @@ DATABASE_URL=postgres://<username>:<password>@<host>:<port>/<db>
NODE_ENV=development
FIREBASE_TYPE=service_account
FIREBASE_PROJECT_ID=
FIREBASE_PRIVATE_KEY_ID=
FIREBASE_PRIVATE_KEY=
Expand All @@ -119,7 +117,7 @@ FIREBASE_PROJECT_ID=
FIREBASE_STORAGE_BUCKET=
FIREBASE_MESSAGING_SENDER_ID=
FIREBASE_API_ID=
FIREBASE_MEASUREMENT_ID=
FIREBASE_MEASUREMENT_ID= # must enable Google Anayltics in Firebase project
# VARIABLES REQUIRED FOR TESTING, REPLACE WITH REAL VALUES IF NEEDED
SIMPLYBOOK_CREDENTIALS='{"login":"testlogin","password":"testpassword","company":"testcompany"}'
Expand All @@ -142,7 +140,7 @@ RESPOND_IO_DELETE_CONTACT_WEBHOOK=

#### Using Docker - RECOMMENDED

The project is containerized and can be run solely in docker - both the PostgreSQL database and NestJS app. To run the backend locally, make sure your system has Docker installed - you may need Docker Desktop if using a Mac.
The project is containerized and can be run solely in docker - both the PostgreSQL database and NestJS app. To run the backend locally, make sure your system has Docker installed - you may need Docker Desktop if using a Mac or Windows.

First make sure the docker app is running (just open the app). Then run

Expand Down Expand Up @@ -236,7 +234,7 @@ Workspace settings for VSCode are included for consistent linting and formatting

### Seed Local Database

If you're a volunteer, add data to your local database by seeding it with a backup file. Please [read our Tech Volunteer Guide](https://www.notion.so/chayn/Tech-volunteer-wiki-5356c7118c134863a2e092e9df6cbc34?pvs=4#0fb25ffde84f4854b2d9730200eee283) for directions on seeding the local database.
If you're an open-source contributor, add data to your local database by seeding it with a backup file. Please read the [Chayn Tech Wiki Guide](https://www.notion.so/chayn/Tech-volunteer-wiki-5356c7118c134863a2e092e9df6cbc34?pvs=4#0fb25ffde84f4854b2d9730200eee283) to obtain a backup file and follow directions to seed the local database.

If you're staff and have access to Heroku, you also have the option to seed the database via the following script. Before you start, make sure:

Expand Down

0 comments on commit 1242788

Please sign in to comment.