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

Added some notes to README’s and .env.sample’s #466

Merged
merged 4 commits into from
May 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@ You can either build and run each application manually or you can use `docker-co

3. [Set up the API](apps/api/README.md#Get-started)

4. [Set up the web app](apps/web/README.md#Get-started)
4. [Set up Scribe](apps/scribe/README.md#Get-started)

5. [Set up the web app](apps/web/README.md#Get-started)

### Running

Expand Down
34 changes: 21 additions & 13 deletions apps/api/.env.example
Original file line number Diff line number Diff line change
@@ -1,27 +1,29 @@
# API configuration
HOST=
PORT=
API_KEY=
HOST=localhost
PORT=3001
API_KEY= ;any string, e.g. some_api_key

# Postgres configuration
DATABASE_URL=
DATABASE_URL= ;match the DB you’ve created, e.g. postgres://<USER>:<PASSWORD>@<HOST>:<PORT>/<DB_NAME>
DATABASE_SCHEMA=public

# Algod configuration
ALGOD_SERVER=
ALGOD_PORT=
ALGOD_TOKEN=
ALGOD_SERVER=http://localhost
ALGOD_PORT=4001
ALGOD_TOKEN=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
ALGOD_ENV=testnet

# CMS configuration (CMS_ACCESS_TOKEN should match the Admin User > Admin Options > Token field in the CMS UI)
CMS_ACCESS_TOKEN=
# CMS configuration

CMS_ACCESS_TOKEN= ;any string, should match the Admin User > Admin Options > Token field in the CMS UI
CMS_URL=http://localhost:8055

# Web app configuration
WEB_URL=http://localhost:3000

# Circle API configuration
CIRCLE_API_KEY=

CIRCLE_API_KEY= ;create a free circle account to generate a key
CIRCLE_URL=https://api-sandbox.circle.com

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we are already using dev defaults in some places. That's preferred IMO but that might just be a taste thing.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The CIRCLE_API_KEY has to be unique per project so we can't default one here, might suggest linking directly to the signup page where a sandbox key can be provisioned freely for development purposes (https://my-sandbox.circle.com/signup)


# Email configuration
Expand All @@ -48,16 +50,22 @@ SMTP_USER=
SMTP_PASSWORD=

# Mnemonic for master funding & signing account
FUNDING_MNEMONIC=

FUNDING_MNEMONIC= ;from the sandbox account you created (check the README.md)

# Used for passphrase encryption
SECRET=

# As this is used for encryption, aim to make this value strong / obfuscated
# `openssl rand -hex 32 | pbcopy` will generate and copy a secure key to your clipboard
# Note: Should match SECRET value in `scribe/.env`
SECRET=

# Used to generate blockchain assets
CREATOR_PASSPHRASE=

# Currency for application - needs to match the web env file and the CMS currency field.
CURRENCY=

CURRENCY= ;e.g. USD, EUR, GBP, etc

# Coinbase API details (for currency conversion)
COINBASE_URL=https://api.coinbase.com
Expand Down
22 changes: 20 additions & 2 deletions apps/api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ The API provides REST endpoints for the Web frontend. These endpoints include: u

## Get started

In the `api` service, you'll want to ensure that you've configured your `.env` file and set up a database. Make sure you've created a Postgres databases that matches what's set in the `DATABASE_URL` key in your `.env` file.
Duplicate `.env.sample` > `.env` in the `api` folder and enter the required environment variables. Make sure you've created a Postgres databases that matches what's set in the `DATABASE_URL` key in your `api/.env` file.

_NOTE_: The `api/.env` and the `scribe/.env` are almost identical, and will share most values.

Per the `.env`, you'll also need to be connected to an Algorand node, whether in development or production.

Expand Down Expand Up @@ -35,7 +37,23 @@ To create an account:
./sandbox goal account export -a <ADDRESS>
```

- Use the outputted mnemonic within the `.env` file within this project.
- Use the outputted mnemonic as the value for the `FUNDING_MNEMONIC` variable in the `api/.env` and `scribe/.env` files in this project.

Optionally, you can also fund your wallet from here to be able to perform transactions in the app:

- List the accounts that currently exist in your sandbox

```bash
./sandbox goal account list
```

- You should see several accounts, some with _microAlgos_, and the account with the address you created above likely having 0. You can run the following command to fund the account you just created with microAlgos

```bash
./sandbox goal clerk send -a <AMOUNT> -f <FROM_ADDRESS> -t <TO_ADDRESS>

# Note: Something like 1000000 microAlgos as the amount should be more than plenty to cover transactions
```
Comment on lines +42 to +56

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a very helpful addition, thank you.


### Connect to the CMS

Expand Down
5 changes: 3 additions & 2 deletions apps/cms/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ PORT=8055
PUBLIC_URL="http://localhost:8055"
# Quieter logs (see: https://docs.directus.io/reference/environment-variables/#general )
# LOG_LEVEL="warn"
ADMIN_EMAIL=""
ADMIN_PASSWORD=""

ADMIN_EMAIL="" ;any email. used for directus login
ADMIN_PASSWORD="" ;any email. used for directus login

####################################################################################################
## Database
Expand Down
26 changes: 14 additions & 12 deletions apps/cms/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ The purpose of the CMS is to provide content authors the ability to create and m

## Get started

Once the environment variables have been added to the `.env` file, you'll want to create a new Postgres database with the name specified in the `DB_CONNECTION_STRING` in the `.env` file and create an appropriate schema for `DB_SEARCH_PATH`. You'll also want to set the `ADMIN_EMAIL` and `ADMIN_PASSWORD` values for the initial CMS admin user.
Duplicate `.env.sample` > `.env` in the `cms` folder and enter the required environment variables. Next, you'll want to create a new Postgres database with the name specified in the `DB_CONNECTION_STRING` in the `.env` file and create an appropriate schema for `DB_SEARCH_PATH`. You'll also want to set the `ADMIN_EMAIL` and `ADMIN_PASSWORD` values for the initial CMS admin user.

If using a single database, create the `cms` schema in your database before running the bootstrap scripts below.

Expand All @@ -27,9 +27,11 @@ Start the server locally:
nx serve cms
```

Optionally, you can seed the database (while the server is running) to generate dummy content:
Optionally, you can seed the database to generate dummy content.

```bash
# While the server is runnning:

Comment on lines +30 to +34

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a subtle change but a good one. Most people go straight to the code and that's a good reminder 👍

cd apps/cms
npm run seed
```
Expand Down Expand Up @@ -73,16 +75,16 @@ Running the seed should do this for you, but otherwise the steps are:
1. Click on Create Webhook (the round plus button)
1. Enter Scribe Webhook details and click save.

| Field | Value |
| --------------- | ------------------------------------------------------------------------------------------------------------------------------- |
| Name | `Scribe` (or any name you prefer) |
| Method | `POST` |
| URL | `SCRIBE_URL` + `/webhooks/directus` |
| Status | `Active` |
| Data | Check `Send Event Data` |
| Request Headers | Empty |
| Triggers | Check `Create`, `Update`, `Delete` |
| Collections | Check `Application`, `Collections`, `Countries`, `Homepage`, `Languages`, `NFT Templates`, `Pack Templates`, `Rarities`, `Sets` |
| Field | Value |
| --------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
| Name | `Scribe` (or any name you prefer) |
| Method | `POST` |
| URL | `http://localhost:3002/webhooks/directus` (by default, this is based on the `HOST` and `PORT` variables in the scribe `.env` file) |
| Status | `Active` |
| Data | Check `Send Event Data` |
| Request Headers | Empty |
| Triggers | Check `Create`, `Update`, `Delete` |
| Collections | Check `Application`, `Collections`, `Countries`, `Homepage`, `Languages`, `NFT Templates`, `Pack Templates`, `Rarities`, `Sets` |

## Data Model Overview

Expand Down
25 changes: 14 additions & 11 deletions apps/scribe/.env.example
Original file line number Diff line number Diff line change
@@ -1,27 +1,28 @@
# API configuration
HOST=localhost
PORT=3002
API_KEY=
API_KEY= ;any string, e.g. some_api_key

# Postgres configuration
DATABASE_URL=
DATABASE_URL= ;match the DB you’ve created, e.g. postgres://<USER>:<PASSWORD>@<HOST>:<PORT>/<DB_NAME>
DATABASE_SCHEMA=public


# Algod configuration
ALGOD_SERVER=
ALGOD_PORT=
ALGOD_TOKEN=
ALGOD_SERVER=http://localhost
ALGOD_PORT=4001
ALGOD_TOKEN=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
ALGOD_ENV=testnet

# CMS configuration (CMS_ACCESS_TOKEN should match the Admin User > Admin Options > Token field in the CMS UI)
CMS_ACCESS_TOKEN=
CMS_ACCESS_TOKEN= ;any string, should match the Admin User > Admin Options > Token field in the CMS UI
CMS_URL=http://localhost:8055

# Web app configuration
WEB_URL=http://localhost:3000

# Circle API configuration
CIRCLE_API_KEY=
CIRCLE_API_KEY= ;create a free circle account to generate a key
CIRCLE_URL=https://api-sandbox.circle.com

# Email configuration
Expand All @@ -48,16 +49,18 @@ SMTP_USER=
SMTP_PASSWORD=

# Mnemonic for master funding & signing account
FUNDING_MNEMONIC=
FUNDING_MNEMONIC= ;from the sandbox account you created (check the README.md)

# Used for passphrase encryption
SECRET=
# As this is used for encryption, aim to make this value strong / obfuscated
# `openssl rand -hex 32 | pbcopy` will generate and copy a secure key to your clipboard
# Note: Should match SECRET value in `api/.env`
SECRET=

# Used to generate blockchain assets
CREATOR_PASSPHRASE=

# Currency for application - needs to match the web env file and the CMS currency field.
CURRENCY=
CURRENCY= ;e.g. USD, EUR, GBP, etc

# Coinbase API details (for currency conversion)
COINBASE_URL=https://api.coinbase.com
Expand Down
4 changes: 3 additions & 1 deletion apps/scribe/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ Scribe runs various background tasks and syncs data from the CMS into read-only

Make sure you configure the webhook according to the steps in the [CMS readme](../cms/README.md).

Ensure the `.env` file is configured. Use the `.env.example` as a base (this is very similar to the API's `.env` file).
Duplicate `.env.sample` > `.env` in the `scribe` folder and enter the required environment variables. Make sure you've created a Postgres databases that matches what's set in the `DATABASE_URL` key in your `api/.env` file.

_NOTE_: The `scribe/.env` and the `api/.env` are almost identical, and will share most values.

If you're not using the default `DATABASE_SCHEMA=public` in your `.env` file, then you'll need to make sure to create the schema you choose:

Expand Down
17 changes: 11 additions & 6 deletions apps/web/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,21 @@ IMAGE_DOMAINS=lh3.googleusercontent.com,firebasestorage.googleapis.com,localhost
NEXT_PUBLIC_3JS_DEBUG=

# API details (should match the settings in the HOST, PORT, and API_KEY setting in the API's .env file)
API_URL=
API_KEY=
API_URL=http://localhost:3001 ;Must match `http://<HOST>:<PORT>` from api/.env
API_KEY= ;Must match API_KEY in api/.env

# Currency for application - needs to match the api env file and the CMS currency field. e.g. CURRENCY=USD
CURRENCY=
# Currency for application - needs to match the api env file and the CMS currency field.
CURRENCY= ;e.g. USD, EUR, GBP, etc

# Firebase
# Firebase - Get these values from an active Firebase project, or create one

# Get this config from adding a web app from Project Overview in the firebase console
NEXT_PUBLIC_FIREBASE_CONFIG={"apiKey":"","authDomain":"","projectId":"","storageBucket":"","messagingSenderId":"","appId":"","measurementId":""}

# Get this data from: Settings (Cog Wheel) > Project Settings > Service Accounts
FIREBASE_SERVICE_ACCOUNT={"projectId":"","clientEmail":"","privateKey":""}
FIREBASE_ADMIN_EMAIL=""

FIREBASE_ADMIN_EMAIL="" ;Your / another admin's email

# Enables or disables the wire payment functionality
NEXT_PUBLIC_WIRE_PAYMENT_ENABLED=false
Expand Down