diff --git a/LICENSE b/LICENSE new file mode 100644 index 000000000..ab232d024 --- /dev/null +++ b/LICENSE @@ -0,0 +1,15 @@ +Copyright 2019 Mozilla Foundation + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +either express or implied. + +See the License for the specific language governing permissions +and limitations under the License. diff --git a/README.md b/README.md new file mode 100644 index 000000000..c4ff5f843 --- /dev/null +++ b/README.md @@ -0,0 +1,141 @@ +# talk + +## Requirements + +- MongoDB >=3.6 +- Redis >=3.2 +- NodeJS >=10 +- NPM >=6.7 + +## Running + +You can install Talk using Docker or via Source. We recommend Docker, as it +provides the easiest deployment solution going forward, as all the dependencies +are baked and shipped with the provided +[coralproject/talk:next](https://hub.docker.com/r/coralproject/talk) image. +When v5 releases to master, you'll be able to select it using +`coralproject/talk:5`. + +### Docker + +The easiest way to get started with Talk is through our published Docker image +and provided example `docker-compose.yml` file. The following assumes that you +have Docker and Docker Compose installed on your local machine: + +- Install Docker: https://docs.docker.com/install/ +- Install Docker Compose: https://docs.docker.com/compose/install/ (this is typically included in the Docker Desktop editions already) + +```bash +# Create directories to persist the data in MongoDB and Redis. +mkdir -p data/{mongo,redis} + +# Create the `docker-compose.yml` file to get started. +cat > docker-compose.yml < + mongo: + image: mongo:3.6 + volumes: + - ./data/mongo:/data/db + redis: + image: redis:3.2 + volumes: + - ./data/redis:/data +EOF + +# Start up Talk using Docker. +docker-compose up -d +``` + +Then head on over to http://127.0.0.1:3000 to install Talk! + +### Source + +Talk requires NodeJS >=10, we recommend using `nvm` to help manage node +versions: https://github.com/creationix/nvm. + +```bash +# Install dependencies. +npm install + +# Build the application dependencies. +npm run build +``` + +This should output all the compiled application code to `./dist`. + +Running Talk with default settings assumes that you have: + +- MongoDB >=3.6 running on `127.0.0.1:27017` +- Redis >=3.2 running on `127.0.0.1:6379` + +If you don't already have these databases running, you can run the following +assuming you have Docker installed on your local machine: + +```bash +docker run -d -p 27017:27017 --restart always --name mongo mongo:3.6 +docker run -d -p 6379:6379 --restart always --name redis redis:3.2 +``` + +Then start Talk with: + +```bash +# Start the server in production mode. +npm run start +``` + +Then head on over to http://127.0.0.1:3000 to install Talk! + +## Configuration + +The following environment variables can be set to configure the Talk Server: + +- `NODE_ENV` - Can be one of `production` or `development`. All production + deployments should use `production`. Defaults to `production` when ran with + `npm run start` and `development` when run with `npm run start:development`. +- `PORT` - The port to listen for HTTP and Websocket requests. (Default `3000`) +- `MONGODB_URI` - The MongoDB database URI to connect to. + (Default `mongodb://127.0.0.1:27017/talk`) +- `REDIS_URI` - The Redis database URI to connect to. + (Default `redis://127.0.0.1:6379`) +- `SIGNING_SECRET` - The shared secret to use to sign JSON Web Tokens (JWT) with + the selected signing algorithm. (Default: `keyboard cat`) +- `SIGNING_ALGORITHM` - The signing algorithm to use for signing JWT's. + (Default `HS256`). +- `LOGGING_LEVEL` - The logging level that can be set to one of `fatal`, + `error`, `warn`, `info`, `debug`, or `trace`. (Default `info`) +- `STATIC_URI` - The URI that static assets can be accessed from. This URI can + be to a proxy that uses this Talk server on `PORT` as the upstream. Disabled + by default. +- `DISABLE_TENANT_CACHING` - When `true`, all tenants will be loaded from the + database when needed rather than keeping a in-memory copy in sync via + published events on Redis. (Default `false`) +- `DISABLE_MONGODB_AUTOINDEXING` - When `true`, Talk will not perform indexing + operations when it starts up. This can be desired when you've already + installed Talk on the target MongoDB, but want to improve start performance. + (Default `false`) +- `LOCALE` - Specify the default locale to use for all requests without a locale + specified. (Default `en-US`) +- `ENABLE_GRAPHIQL` - When `true`, it will enable the `/tenant/graphiql` even in + production, use with care. (Default `false`) +- `CONCURRENCY` - The number of worker nodes to spawn to handle web traffic, + this should be tied to the number of CPU's available. (Default + `os.cpus().length`) +- `DEV_PORT` - The port where the Webpack Development server is running on. + (Default `8080`) + +## License + +Talk is released under the [Apache License, v2.0](/LICENSE). diff --git a/package.json b/package.json index 0b8928c26..4f5382bf8 100644 --- a/package.json +++ b/package.json @@ -64,6 +64,7 @@ "express": "^4.16.3", "express-static-gzip": "^0.3.2", "farce": "^0.2.6", + "fluent": "^0.10.0", "found": "^0.3.14", "found-relay": "^0.3.1", "fs-extra": "^6.0.1", @@ -78,6 +79,7 @@ "ioredis": "^3.2.2", "joi": "^13.4.0", "jsonwebtoken": "^8.3.0", + "jsdom": "^11.12.0", "jwks-rsa": "^1.3.0", "linkify-it": "^2.1.0", "linkifyjs": "^2.1.7", @@ -101,6 +103,7 @@ "passport-strategy": "^1.0.0", "performance-now": "^2.1.0", "permit": "^0.2.4", + "querystringify": "^2.1.0", "react-relay-network-modern": "^2.4.0", "source-map-support": "^0.5.10", "stack-utils": "^1.0.2", @@ -218,7 +221,6 @@ "eventemitter2": "^5.0.1", "final-form": "^4.8.1", "flat": "^4.1.0", - "fluent": "^0.10.0", "fluent-intl-polyfill": "^0.1.0", "fluent-langneg": "^0.1.0", "fluent-react": "^0.8.3", @@ -235,7 +237,6 @@ "jest-junit": "^5.1.0", "jest-localstorage-mock": "^2.2.0", "jest-mock-console": "^0.4.0", - "jsdom": "^11.12.0", "lint-staged": "^7.3.0", "loader-utils": "^1.1.0", "lodash-es": "^4.17.11", @@ -255,7 +256,6 @@ "prop-types": "^15.6.2", "pstree.remy": "^1.1.0", "pym.js": "^1.3.2", - "querystringify": "^2.1.0", "raw-loader": "^0.5.1", "react": "^16.7.0", "react-copy-to-clipboard": "^5.0.1",