diff --git a/SETUP.md b/SETUP.md index 5740b95..1ab3a5a 100644 --- a/SETUP.md +++ b/SETUP.md @@ -8,7 +8,6 @@ - [Email (optional)](#email-optional) - [Amazon s3 server (optional)](#amazon-s3-server-optional) - [hCaptcha (optional)](#hcaptcha-optional) - - [CDN](#cdn) - [Configuration](#configuration) @@ -19,13 +18,24 @@ ### NodeJS -Download and install the latest LTS version of [NodeJS](https://nodejs.org/). If using a Linux based operating system, using [nvm](https://github.com/nvm-sh/nvm) is the recommended method. _Tested on NodeJS version v18.12.1_ +Download and install the latest LTS version of [NodeJS](https://nodejs.org/). If using a Linux based operating system, using [nvm](https://github.com/nvm-sh/nvm) is the recommended method. _Tested on NodeJS version v18.20.5_ ### MongoDB Download and install the latest version of [MongoDB](https://www.mongodb.com) -The server assumes that MongoDB is running as replica set, ensure you have configured this properly +The server assumes that MongoDB is running as a replica set, here's how to configure a basic replica set: +1. Open /etc/mongod.conf with your preferred editor. + +2. Add/modify the `replication` section with the following: +```conf +replication: + replSetName: "rs0" +``` + +3. Restart MongoDB and open a shell with `mongosh`. + +4. Initiate the replica set with `rs.initiate()` and check its status with `rs.status()`. ## Optional features @@ -36,19 +46,19 @@ The server assumes that MongoDB is running as replica set, ensure you have confi ### Redis (optional) -Redis can be used to cache files read from disk. If Redis is not configured, then an in-memory object store is used instead +Redis can be used to cache files read from disk. If Redis is not configured, then an in-memory object store is used instead. ### Email (optional) -Events such as account creation, email verification, etc, support sending emails to users. To enable email sending, create an email address which is compatible with [Nodemailer](https://nodemailer.com/). Which email service you use does not matter, see the Nodemailer documentation for more details +Events such as account creation, email verification, etc, support sending emails to users. To enable email sending, you will need to use Amazon SES. Consult the Amazon SES documentation for more details. ### Amazon s3 server (optional) -Certain endpoints expect URLs for static CDN assets, such as pre-rendered Mii images. An [Amazon s3](https://aws.amazon.com/s3/) or compatible server, such as [Spaces by DigitalOcean](https://www.digitalocean.com/products/spaces), [Cloudflare R2](https://www.cloudflare.com/products/r2/), or [Backblaze B2](https://www.backblaze.com/b2/docs/), can optionally be used to store and upload these assets. If an s3 server is not configured, CDN contents will be stored on disk and served from this server. See [Configuration](#configuration) for more details +Certain endpoints expect URLs for static CDN assets, such as pre-rendered Mii images. An [Amazon s3](https://aws.amazon.com/s3/) or compatible server, such as [Spaces by DigitalOcean](https://www.digitalocean.com/products/spaces), [Cloudflare R2](https://www.cloudflare.com/products/r2/), or [Backblaze B2](https://www.backblaze.com/b2/docs/), can optionally be used to store and upload these assets. If an s3 server is not configured, CDN contents will be stored on disk and served from this server. See [Configuration](#configuration) for more details. ### hCaptcha (optional) -The Pretendo Network website uses this server as an API for querying user information. Certain endpoints are considered more secure than others, such as registration, and can optionally be protected using [hCaptcha](https://hcaptcha.com/). If hCaptcha is not configured, no endpoints on the public facing API will be protected +The Pretendo Network website uses this server as an API for querying user information. Certain endpoints are considered more secure than others, such as registration, and can optionally be protected using [hCaptcha](https://hcaptcha.com/). If hCaptcha is not configured, no endpoints on the public facing API will be protected. ## Configuration @@ -60,11 +70,9 @@ Configurations are loaded through environment variables. `.env` files are suppor | `PN_ACT_CONFIG_MONGO_CONNECTION_STRING` | MongoDB connection string | No | | `PN_ACT_CONFIG_MONGOOSE_CONNECT_OPTIONS_PATH` | Path to a `.json` file containing Mongoose connection options | Yes | | `PN_ACT_CONFIG_REDIS_URL` | Redis URL | Yes | -| `PN_ACT_CONFIG_EMAIL_HOST` | SMTP host | Yes | -| `PN_ACT_CONFIG_EMAIL_PORT` | SMTP port | Yes | -| `PN_ACT_CONFIG_EMAIL_SECURE` | Is the email server secure | Yes | -| `PN_ACT_CONFIG_EMAIL_USERNAME` | Email account username | Yes | -| `PN_ACT_CONFIG_EMAIL_PASSWORD` | Email account password | Yes | +| `PN_ACT_CONFIG_EMAIL_SES_REGION` | Amazon SES Region | Yes | +| `PN_ACT_CONFIG_EMAIL_SES_ACCESS_KEY` | Amazon SES Access Key | Yes | +| `PN_ACT_CONFIG_EMAIL_SES_ACCESS_SECRET` | Amazon SES Access Secret | Yes | | `PN_ACT_CONFIG_EMAIL_FROM` | Email "from" address | Yes | | `PN_ACT_CONFIG_S3_ENDPOINT` | s3 server endpoint | Yes | | `PN_ACT_CONFIG_S3_ACCESS_KEY` | s3 secret key | Yes | diff --git a/example.env b/example.env index e572b64..6242f3a 100644 --- a/example.env +++ b/example.env @@ -6,9 +6,9 @@ PN_ACT_CONFIG_MONGOOSE_OPTION_useUnifiedTopology=true PN_ACT_CONFIG_REDIS_URL=redis://localhost:6379 PN_ACT_CONFIG_EMAIL_HOST=smtp.gmail.com PN_ACT_CONFIG_EMAIL_PORT=587 -PN_ACT_CONFIG_EMAIL_SECURE=false -PN_ACT_CONFIG_EMAIL_USERNAME=username -PN_ACT_CONFIG_EMAIL_PASSWORD=password +PN_ACT_CONFIG_EMAIL_SES_REGION=region +PN_ACT_CONFIG_EMAIL_SES_ACCESS_KEY=ACCESS_KEY +PN_ACT_CONFIG_EMAIL_SES_ACCESS_SECRET=ACCESS_SECRET PN_ACT_CONFIG_EMAIL_FROM=Company Name PN_ACT_CONFIG_S3_ENDPOINT=nyc3.digitaloceanspaces.com PN_ACT_CONFIG_S3_ACCESS_KEY=ACCESS_KEY