Skip to content

Commit

Permalink
chore!: update Readmes, remove legacy env compat (#329)
Browse files Browse the repository at this point in the history
  • Loading branch information
kon14 committed Sep 16, 2022
1 parent 637470c commit de0556d
Show file tree
Hide file tree
Showing 22 changed files with 27 additions and 32 deletions.
10 changes: 5 additions & 5 deletions README.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,13 @@ Check out GraphQL on `/graphql`
yarn
npx lerna run build
REDIS_HOST=localhost REDIS_PORT=6379 yarn --cwd ./packages/core start
CONDUIT_SERVER=0.0.0.0:55152 SERVICE_IP=0.0.0.0:55165 DB_CONN_URI=mongodb://localhost:27017 yarn --cwd ./modules/database start
CONDUIT_SERVER=0.0.0.0:55152 SERVICE_URL=0.0.0.0:55165 DB_CONN_URI=mongodb://localhost:27017 yarn --cwd ./modules/database start
```

Then repeat the following step for every additional module you wish to bring online, specifying any additional env vars.

```sh
CONDUIT_SERVER=0.0.0.0:55152 SERVICE_IP=0.0.0.0:PORT yarn --cwd ./modules/MODULE start
CONDUIT_SERVER=0.0.0.0:55152 SERVICE_URL=0.0.0.0:PORT yarn --cwd ./modules/MODULE start
```

## Environment Variables 📃 <a name="env-vars"></a>
Expand All @@ -89,7 +89,7 @@ CONDUIT_SERVER=0.0.0.0:55152 SERVICE_IP=0.0.0.0:PORT yarn --cwd ./modules/MODULE
| `REDIS_PORT` | Redis Port | True | `6379` |
| `ADMIN_HTTP_PORT` | Port to be used by admin REST and GrahpQL APIs | False | `3030` |
| `ADMIN_SOCKET_PORT` | Port to be used by admin WebSockets API | False | `3030` |
| `SERVICE_PORT` | Port to be used by the gRPC server | False | `55152` |
| `GRPC_PORT` | Port to be used by the gRPC server | False | `55152` |
| `MASTER_KEY` | Master Secret | False | `M4ST3RK3Y` |
| `GRPC_KEY` | Specifying a secret enables gRPC signed request protection | False | `someRandomSecret` |
| `DEBUG__DISABLE_INACTIVE_MODULE_REMOVAL` | Prevent removal of inactive modules from Config | False | `true` |
Expand Down Expand Up @@ -118,6 +118,6 @@ Generic module env variables are also supported, with required ones being obliga
| Variable | Description | Required | Example |
|:--------------------:|:-----------------------------------------------------| :------: |:------------------:|
| `CONDUIT_SERVER` | Conduit Core's address and port | True | `0.0.0.0:55152` |
| `SERVICE_IP` | Always 0.0.0.0 and a port numer | True | `0.0.0.0:55190` |
| `REGISTER_NAME` | Set to `true` if running in Kubernetes | False | `true` |
| `SERVICE_URL` | This should be where this service listens on. If behind a LB it should point to the LB's IP/DNS | False | `0.0.0.0:55190` |
| `GRPC_PORT` | Port to be used by the gRPC server | False | `55190` |
| `GRPC_KEY` | Specifying a secret enables gRPC signed request protection (**use across modules**) | False | `someRandomSecret` |
1 change: 1 addition & 0 deletions libraries/grpc-sdk/src/classes/ModuleManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export class ModuleManager<T> {
this.servicePort = process.env.GRPC_PORT ?? '5000';

this.serviceAddress =
// @compat (v0.15): SERVICE_IP -> SERVICE_IP
process.env.SERVICE_URL || process.env.SERVICE_IP || '0.0.0.0:' + this.servicePort;
try {
this.grpcSdk = new ConduitGrpcSdk(
Expand Down
2 changes: 1 addition & 1 deletion modules/authentication/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ WORKDIR /app/modules/authentication

ENV CONDUIT_SERVER conduit_server

ENV SERVICE_IP 0.0.0.0:5000
ENV SERVICE_URL 0.0.0.0:5000
ENV GRPC_PORT 5000

EXPOSE 5000
Expand Down
2 changes: 1 addition & 1 deletion modules/authentication/README.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@ TwoFactor authentication is also provided.
| Variable | Description | Required | Example |
|:--------------------:|:-----------------------------------------------------|:--------:|:------------------:|
| `CONDUIT_SERVER` | Conduit Core's address and port | True | `0.0.0.0:55152` |
| `SERVICE_IP` | This should be where this service listens on. If behind a LB it should point to the LB's IP/DNS | False | `0.0.0.0:55190` |
| `SERVICE_URL` | This should be where this service listens on. If behind a LB it should point to the LB's IP/DNS | False | `0.0.0.0:55190` |
| `GRPC_PORT` | The port number the gRPC server will listen to | False | `55190` |
| `GRPC_KEY` | Specifying a secret enables gRPC signed request protection (**use across modules**) | False | `someRandomSecret` |
2 changes: 1 addition & 1 deletion modules/chat/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ WORKDIR /app/modules/chat

ENV CONDUIT_SERVER conduit_server

ENV SERVICE_IP 0.0.0.0:5000
ENV SERVICE_URL 0.0.0.0:5000

ENV GRPC_PORT 5000

Expand Down
2 changes: 1 addition & 1 deletion modules/chat/README.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ This module provides support for creating chat rooms, adding participants and se
| Variable | Description | Required | Example |
|:--------------------:|:-----------------------------------------------------| :------: |:------------------:|
| `CONDUIT_SERVER` | Conduit Core's address and port | True | `0.0.0.0:55152` |
| `SERVICE_IP` | This should be where this service listens on. If behind a LB it should point to the LB's IP/DNS | False | `0.0.0.0:55190` |
| `SERVICE_URL` | This should be where this service listens on. If behind a LB it should point to the LB's IP/DNS | False | `0.0.0.0:55190` |
| `GRPC_PORT` | The port number the gRPC server will listen to | False | `55190` |
| `GRPC_KEY` | Specifying a secret enables gRPC signed request protection (**use across modules**) | False | `someRandomSecret` |

Expand Down
2 changes: 1 addition & 1 deletion modules/database/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ WORKDIR /app/modules/database

ENV CONDUIT_SERVER conduit_server

ENV SERVICE_IP 0.0.0.0:5000
ENV SERVICE_URL 0.0.0.0:5000

ENV GRPC_PORT 5000

Expand Down
2 changes: 1 addition & 1 deletion modules/database/README.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ since the latter need to go through parsers that are otherwise unnecessary for M
| Variable | Description | Required | Example | Default |
|:--------------------:|:-----------------------------------------------------| :------: | :----------------: | :------: |
| `CONDUIT_SERVER` | Conduit Core's address and port | True | `0.0.0.0:55152` | - |
| `SERVICE_IP` | This should be where this service listens on. If behind a LB it should point to the LB's IP/DNS | False | `0.0.0.0:55190` |
| `SERVICE_URL` | This should be where this service listens on. If behind a LB it should point to the LB's IP/DNS | False | `0.0.0.0:55190` |
| `GRPC_PORT` | The port number the gRPC server will listen to | False | `55190` |
| `GRPC_KEY` | Specifying a secret enables gRPC signed request protection (**use across modules**) | False | `someRandomSecret` | - |
| `DB_CONN_URI` | DB Connection URI | False | `postgres://conduit:pass@localhost:5432/conduit` | `mongodb://localhost:27017` |
Expand Down
10 changes: 2 additions & 8 deletions modules/database/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
import { ModuleManager } from '@conduitplatform/grpc-sdk';
import DatabaseModule from './Database';

const dbType =
process.env.DB_TYPE ??
process.env.databaseType ?? // Compat (<=0.12.2)
'mongodb';
const dbUri =
process.env.DB_CONN_URI ??
process.env.databaseURL ?? // Compat (<=0.12.2)
'mongodb://localhost:27017';
const dbType = process.env.DB_TYPE ?? 'mongodb';
const dbUri = process.env.DB_CONN_URI ?? 'mongodb://localhost:27017';

const database = new DatabaseModule(dbType, dbUri);
const moduleManager = new ModuleManager<void>(database);
Expand Down
2 changes: 1 addition & 1 deletion modules/email/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ WORKDIR /app/modules/email

ENV CONDUIT_SERVER conduit_server

ENV SERVICE_IP 0.0.0.0:5000
ENV SERVICE_URL 0.0.0.0:5000

ENV GRPC_PORT 5000

Expand Down
2 changes: 1 addition & 1 deletion modules/email/README.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ The Email module serves this very purpose.
| Variable | Description | Required | Example |
|:--------------------:|:-----------------------------------------------------| :------: |:------------------:|
| `CONDUIT_SERVER` | Conduit Core's address and port | True | `0.0.0.0:55152` |
| `SERVICE_IP` | This should be where this service listens on. If behind a LB it should point to the LB's IP/DNS | False | `0.0.0.0:55190` |
| `SERVICE_URL` | This should be where this service listens on. If behind a LB it should point to the LB's IP/DNS | False | `0.0.0.0:55190` |
| `GRPC_PORT` | The port number the gRPC server will listen to | False | `55190` |
| `GRPC_KEY` | Specifying a secret enables gRPC signed request protection (**use across modules**) | False | `someRandomSecret` |
2 changes: 1 addition & 1 deletion modules/forms/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ WORKDIR /app/modules/forms

ENV CONDUIT_SERVER conduit_server

ENV SERVICE_IP 0.0.0.0:5000
ENV SERVICE_URL 0.0.0.0:5000

ENV GRPC_PORT 5000

Expand Down
2 changes: 1 addition & 1 deletion modules/forms/README.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ This module supports creating and submitting forms.
| Variable | Description | Required | Example |
|:--------------------:|:-----------------------------------------------------| :------: |:------------------:|
| `CONDUIT_SERVER` | Conduit Core's address and port | True | `0.0.0.0:55152` |
| `SERVICE_IP` | This should be where this service listens on. If behind a LB it should point to the LB's IP/DNS | False | `0.0.0.0:55190` |
| `SERVICE_URL` | This should be where this service listens on. If behind a LB it should point to the LB's IP/DNS | False | `0.0.0.0:55190` |
| `GRPC_PORT` | The port number the gRPC server will listen to | False | `55190` |
| `GRPC_KEY` | Specifying a secret enables gRPC signed request protection (**use across modules**) | False | `someRandomSecret` |
2 changes: 1 addition & 1 deletion modules/push-notifications/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ WORKDIR /app/modules/push-notifications

ENV CONDUIT_SERVER conduit_server

ENV SERVICE_IP 0.0.0.0:5000
ENV SERVICE_URL 0.0.0.0:5000

ENV GRPC_PORT 5000

Expand Down
2 changes: 1 addition & 1 deletion modules/push-notifications/README.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ Handles sending push notifications to users.
| Variable | Description | Required | Example |
|:--------------------:|:-----------------------------------------------------| :------: |:------------------:|
| `CONDUIT_SERVER` | Conduit Core's address and port | True | `0.0.0.0:55152` |
| `SERVICE_IP` | This should be where this service listens on. If behind a LB it should point to the LB's IP/DNS | False | `0.0.0.0:55190` |
| `SERVICE_URL` | This should be where this service listens on. If behind a LB it should point to the LB's IP/DNS | False | `0.0.0.0:55190` |
| `GRPC_PORT` | The port number the gRPC server will listen to | False | `55190` |
| `GRPC_KEY` | Specifying a secret enables gRPC signed request protection (**use across modules**) | False | `someRandomSecret` |
2 changes: 1 addition & 1 deletion modules/router/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ WORKDIR /app/modules/router

ENV CONDUIT_SERVER conduit_server

ENV SERVICE_IP 0.0.0.0:5000
ENV SERVICE_URL 0.0.0.0:5000

ENV GRPC_PORT 5000

Expand Down
2 changes: 1 addition & 1 deletion modules/router/README.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ provide a way for Conduit modules to register application routes.
| Variable | Description | Required | Example |
|:--------------------:|:-----------------------------------------------------| :------: |:------------------:|
| `CONDUIT_SERVER` | Conduit Core's address and port | True | `0.0.0.0:55152` |
| `SERVICE_IP` | This should be where this service listens on. If behind a LB it should point to the LB's IP/DNS | False | `0.0.0.0:55190` |
| `SERVICE_URL` | This should be where this service listens on. If behind a LB it should point to the LB's IP/DNS | False | `0.0.0.0:55190` |
| `GRPC_PORT` | The port number the gRPC server will listen to | False | `55190` |
| `GRPC_KEY` | Specifying a secret enables gRPC signed request protection (**use across modules**) | False | `someRandomSecret` |
| `CLIENT_HTTP_PORT` | Port to be used by application REST and GrahpQL APIs | False | `3000` |
Expand Down
2 changes: 1 addition & 1 deletion modules/sms/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ WORKDIR /app/modules/sms

ENV CONDUIT_SERVER conduit_server

ENV SERVICE_IP 0.0.0.0:5000
ENV SERVICE_URL 0.0.0.0:5000

ENV GRPC_PORT 5000

Expand Down
2 changes: 1 addition & 1 deletion modules/sms/README.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ Messages are delivered using third party providers.
| Variable | Description | Required | Example |
|:--------------------:|:-----------------------------------------------------| :------: |:------------------:|
| `CONDUIT_SERVER` | Conduit Core's address and port | True | `0.0.0.0:55152` |
| `SERVICE_IP` | This should be where this service listens on. If behind a LB it should point to the LB's IP/DNS | False | `0.0.0.0:55190` |
| `SERVICE_URL` | This should be where this service listens on. If behind a LB it should point to the LB's IP/DNS | False | `0.0.0.0:55190` |
| `GRPC_PORT` | The port number the gRPC server will listen to | False | `55190` |
| `GRPC_KEY` | Specifying a secret enables gRPC signed request protection (**use across modules**) | False | `someRandomSecret` |
2 changes: 1 addition & 1 deletion modules/storage/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ WORKDIR /app/modules/storage

ENV CONDUIT_SERVER conduit_server

ENV SERVICE_IP 0.0.0.0:5000
ENV SERVICE_URL 0.0.0.0:5000

ENV GRPC_PORT 5000

Expand Down
2 changes: 1 addition & 1 deletion modules/storage/README.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ Documents may have complex structures and subcollections and can be stored local
| Variable | Description | Required | Example |
|:--------------------:|:-----------------------------------------------------| :------: |:------------------:|
| `CONDUIT_SERVER` | Conduit Core's address and port | True | `0.0.0.0:55152` |
| `SERVICE_IP` | This should be where this service listens on. If behind a LB it should point to the LB's IP/DNS | False | `0.0.0.0:55190` |
| `SERVICE_URL` | This should be where this service listens on. If behind a LB it should point to the LB's IP/DNS | False | `0.0.0.0:55190` |
| `GRPC_PORT` | The port number the gRPC server will listen to | False | `55190` |
| `GRPC_KEY` | Specifying a secret enables gRPC signed request protection (**use across modules**) | False | `someRandomSecret` |
2 changes: 1 addition & 1 deletion packages/admin/src/middleware/Admin.middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export function getAdminMiddleware(conduit: ConduitCommons) {
'!Security issue!: Master key not set, defaulting to insecure string',
);
}
const master = process.env.MASTER_KEY ?? process.env.masterkey ?? 'M4ST3RK3Y'; // Compat (<=0.12.2): masterkey
const master = process.env.MASTER_KEY ?? 'M4ST3RK3Y';
if (isNil(masterKey) || masterKey !== master)
return res.status(401).json({ error: 'Unauthorized' });
next();
Expand Down

0 comments on commit de0556d

Please sign in to comment.