From 6c0e00155f8bccdd63c86c455fa13355a76dcb2b Mon Sep 17 00:00:00 2001 From: Wyatt Johnson Date: Wed, 12 Apr 2017 13:29:01 -0600 Subject: [PATCH 01/14] Initial update --- Dockerfile | 2 +- INSTALL.md | 88 ++++++++++++++++++++++++++++++++-------------- circle.yml | 2 +- docker-compose.yml | 25 ------------- package.json | 2 +- 5 files changed, 65 insertions(+), 54 deletions(-) delete mode 100644 docker-compose.yml diff --git a/Dockerfile b/Dockerfile index 5bc38013a..90c08057f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM node:7 +FROM node:7.9 # Create app directory RUN mkdir -p /usr/src/app diff --git a/INSTALL.md b/INSTALL.md index 33b634de8..e28a559f1 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -2,11 +2,11 @@ ## Requirements -### System - - Any flavour of Linux, OSX or Windows - 1GB memory (minimum) - 5GB storage (minimum) +- [MongoDB](https://www.mongodb.com/) v3.4 or later +- [Redis](https://redis.io/) v3.2 or later ## Installation From Source @@ -14,24 +14,31 @@ There are some runtime requirements for running Talk from source: -- [Node](https://nodejs.org/) v7 or later -- [MongoDB](https://www.mongodb.com/) v3.4 or later -- [Redis](https://redis.io/) v3.2 or later -- [Yarn](https://yarnpkg.com/) v0.19.1 or later +- [Node](https://nodejs.org/) v7.9 or later +- [Yarn](https://yarnpkg.com/) v0.22.0 or later -_Please be sure to check the versions of these requirements. Insufficient versions of these may lead to unexpected errors!_ +_Please be sure to check the versions of these requirements. Incorrect versions +of these may lead to unexpected errors!_ ### Installing +#### Download + +It is highly recommended that you download a released version as the code +available in `master` may not be stable. You can download the latest release +from the [releases page](https://github.com/coralproject/talk/releases). + +You can also clone the git repository via: + ```bash -# Download the tarball containing the repository -curl -L https://github.com/coralproject/talk/tarball/master -o coralproject-talk.tar.gz +git clone https://github.com/coralproject/talk.git +``` -# Untar that file and change to that directory -tar xpf coralproject-talk.tar.gz -mv coralproject-talk-* coralproject-talk -cd coralproject-talk +#### Setup +We now have to install the dependancies and build the static assets. + +```bash # Install package dependancies yarn @@ -50,6 +57,8 @@ You can start the server after configuring the server using the command: yarn start ``` +This will setup the server to serve everything on a single node.js process. + You can see other scripts we've made available by consulting the `package.json` file under the `scripts` key including: @@ -58,33 +67,60 @@ file under the `scripts` key including: - `yarn build-watch` watch for changes to client files and build static assets - `yarn dev-start` watch for changes to server files and reload the server -## Installation From Docker Hub +## Installation From Docker + +We currently support packaging the Talk application via Docker, which automates +the dependancy install and asset build process. ### Requirements There are some runtime requirements for running Talk for Docker: -- [MongoDB](https://www.mongodb.com/) v3.2 or later -- [Redis](https://redis.io/) v3.2 or later - [Docker](https://www.docker.com/) v1.13.0 or later - [Docker Compose](https://docs.docker.com/compose/) v1.10.0 or later -_Please be sure to check the versions of these requirements. Insufficient versions of these may lead to unexpected errors!_ +_Please be sure to check the versions of these requirements. Incorrect versions +of these may lead to unexpected errors!_ ### Installing -```bash -# Create a directory for talk -mkdir coralproject-talk -cd coralproject-talk +An example docker-compose.yml: -# Download the docker-compose.yml file from the repository -curl -LO https://raw.githubusercontent.com/coralproject/talk/master/docker-compose.yml +```yaml +version: '2' +services: + talk: + image: coralproject/talk:1.5 + restart: always + ports: + - "5000:5000" + depends_on: + - mongo + - redis + environment: + - TALK_MONGO_URL=mongodb://mongo/talk + - TALK_REDIS_URL=redis://redis + mongo: + image: mongo:3.2 + restart: always + volumes: + - mongo:/data/db + redis: + image: redis:3.2 + restart: always + volumes: + - redis:/data +volumes: + mongo: + external: false + redis: + external: false ``` -At this stage, you should refer to the `README.md` file for required -configuration variables to add to the environment key for the `talk` service -listed in the `docker-compose.yml` file. +At this stage, you should refer to the `README.md` for configuration variables +that are specific to your installation. Some pre-defined fields have been filled +in the above example which are consistent with Docker Compose naming conventions +for [Docker Links](https://docs.docker.com/compose/networking/#links). ### Running diff --git a/circle.yml b/circle.yml index 013ef28b8..e7427094b 100644 --- a/circle.yml +++ b/circle.yml @@ -1,6 +1,6 @@ machine: node: - version: 7 + version: 7.9 services: - docker - redis diff --git a/docker-compose.yml b/docker-compose.yml deleted file mode 100644 index 76c28d20f..000000000 --- a/docker-compose.yml +++ /dev/null @@ -1,25 +0,0 @@ -version: '2' -services: - talk: - image: coralproject/talk:latest - restart: always - ports: - - "5000:5000" - depends_on: - - mongo - - redis - mongo: - image: mongo:3.2 - restart: always - volumes: - - mongo:/data/db - redis: - image: redis:3.2 - restart: always - volumes: - - redis:/data -volumes: - mongo: - external: false - redis: - external: false diff --git a/package.json b/package.json index 41d8732de..1b09c78c8 100644 --- a/package.json +++ b/package.json @@ -182,6 +182,6 @@ "webpack": "^2.3.1" }, "engines": { - "node": "^7.7.0" + "node": "^7.9.0" } } From 31960d67f37d5a686f5d2c3e827a7b343ab19a02 Mon Sep 17 00:00:00 2001 From: Wyatt Johnson Date: Wed, 12 Apr 2017 14:25:43 -0600 Subject: [PATCH 02/14] Added more to docs --- INSTALL.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/INSTALL.md b/INSTALL.md index e28a559f1..942b99377 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -72,6 +72,8 @@ file under the `scripts` key including: We currently support packaging the Talk application via Docker, which automates the dependancy install and asset build process. +https://hub.docker.com/r/coralproject/talk/ + ### Requirements There are some runtime requirements for running Talk for Docker: From 2fcfaa8a99c77f239ac7750ee744b6f6df07f20e Mon Sep 17 00:00:00 2001 From: Wyatt Johnson Date: Wed, 12 Apr 2017 15:08:07 -0600 Subject: [PATCH 03/14] More updates --- INSTALL.md | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/INSTALL.md b/INSTALL.md index 942b99377..fd2c5175f 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -46,6 +46,17 @@ yarn yarn build ``` +After you create/modify the `plugins.json` (refer to `PLUGINS.md` for plugin +docs) file, you can re-run the following to install their dependancies: + +```bash +# Reconcile plugins +./bin/cli plugins reconcile + +# Build static files +yarn build +``` + ### Running Refer to the `README.md` file for required configuration variables to add to the @@ -57,7 +68,8 @@ You can start the server after configuring the server using the command: yarn start ``` -This will setup the server to serve everything on a single node.js process. +This will setup the server to serve everything on a single node.js process and +is designed to be used in production. You can see other scripts we've made available by consulting the `package.json` file under the `scripts` key including: @@ -65,7 +77,8 @@ file under the `scripts` key including: - `yarn test` run unit tests - `yarn e2e` run end to end tests - `yarn build-watch` watch for changes to client files and build static assets -- `yarn dev-start` watch for changes to server files and reload the server +- `yarn dev-start` watch for changes to server files and reload the server while + also sourcing a `.env` file in your local directory for configuration ## Installation From Docker @@ -74,6 +87,17 @@ the dependancy install and asset build process. https://hub.docker.com/r/coralproject/talk/ +Images are tagged using the following notation: + +- `x` (where `x` is the major version number): any minor or patch updates will be included in this. If you're ok getting + new features occationally and all the bug fixes, this is the tag for you. +- `x.y` (where `y` is the minor version number): +- `x.y.z` (where `z` is the patch version): + +We provide tags with `*-onbuild` that can be used for easy plugin integration and +acts as a customization endpoint. Instructions are provided in the `PLUGINS.md` +document as to how to use it. + ### Requirements There are some runtime requirements for running Talk for Docker: @@ -126,7 +150,15 @@ for [Docker Links](https://docs.docker.com/compose/networking/#links). ### Running +If you're using docker compose: + ```bash # Start the services using compose docker-compose up -d ``` + +If you're using plain docker: + +```bash +docker run -d -P coralproject/talk:latest +``` \ No newline at end of file From dbc95db8059d4345714a9794f3e68d918cb74a5f Mon Sep 17 00:00:00 2001 From: Wyatt Johnson Date: Wed, 12 Apr 2017 15:15:51 -0600 Subject: [PATCH 04/14] Updates for docker images --- INSTALL.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/INSTALL.md b/INSTALL.md index fd2c5175f..8d332b77a 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -91,8 +91,12 @@ Images are tagged using the following notation: - `x` (where `x` is the major version number): any minor or patch updates will be included in this. If you're ok getting new features occationally and all the bug fixes, this is the tag for you. -- `x.y` (where `y` is the minor version number): -- `x.y.z` (where `z` is the patch version): +- `x.y` (where `y` is the minor version number): any patch updates will be + included with this tag. If you like getting fixes and having features change + only when you want, this is the tag for you. **(recommended)** +- `x.y.z` (where `z` is the patch version): this tag never gets updated, and + essentially freezes your version, this should only be used when you are either + extending Talk or are sure of a specific version you want to freeze. We provide tags with `*-onbuild` that can be used for easy plugin integration and acts as a customization endpoint. Instructions are provided in the `PLUGINS.md` From d5016dff58524d5e74b89b320152c7d19a9897d5 Mon Sep 17 00:00:00 2001 From: Wyatt Johnson Date: Wed, 12 Apr 2017 16:37:56 -0600 Subject: [PATCH 05/14] Updates to metadata service docs --- PLUGINS.md | 17 ++++++++++------- services/metadata.js | 16 +++++++++++++++- 2 files changed, 25 insertions(+), 8 deletions(-) diff --git a/PLUGINS.md b/PLUGINS.md index 8bf00229d..399034b53 100644 --- a/PLUGINS.md +++ b/PLUGINS.md @@ -53,13 +53,6 @@ mismatch._ ## Plugin Dependencies -From your plugins you may import any component of server code relative to the -project root. An example could be: - -```js -const cache = require('services/cache'); -``` - You may also include additional external depenancies in your local packages by specifying a `package.json` at your plugin root which will result in a `node_modules` folder being generated at the plugin root with your specific @@ -67,6 +60,16 @@ dependencies. ## Server Plugins +### API + +You can access any API available inside the talk directory in a plugin by simply +importing the file relative to the talk project root. An example would be if you +wanted to import the `MetadataService`, you would simply write: + +```javascript +const MetadataService = require('services/metadata'); +``` + ### Specification Each plugin should export a single object with all hooks available on it. diff --git a/services/metadata.js b/services/metadata.js index 2cabed8b8..511429e24 100644 --- a/services/metadata.js +++ b/services/metadata.js @@ -36,7 +36,14 @@ class MetadataService { } /** - * Sets an object on the metadata field of an object. + * Sets an object on the metadata field of an object. An example could be: + * + * @example + * const MetadataService = require('services/metadata'); + * const CommentModel = require('models/comment'); + * + * // Sets the property `loaded` on the comment with `id=1`. + * MetadataService.set(CommentModel, '1', 'loaded', true); * * @static * @param {mongoose.Model} model the mongoose model for the object @@ -60,6 +67,13 @@ class MetadataService { /** * Removes the value for the metadata field as the specific key. * + * @example + * const MetadataService = require('services/metadata'); + * const CommentModel = require('models/comment'); + * + * // Removes the property `loaded` on the comment with `id=1`. + * MetadataService.unset(CommentModel, '1', 'loaded'); + * * @static * @param {mongoose.Model} model the mongoose model for the object * @param {String} id the value for the field `id` of the model From 941db338d0abce6a3fd519c5de5b482aed50f73e Mon Sep 17 00:00:00 2001 From: Wyatt Johnson Date: Wed, 12 Apr 2017 16:51:20 -0600 Subject: [PATCH 06/14] Updates for plugin deployment --- PLUGINS.md | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/PLUGINS.md b/PLUGINS.md index 399034b53..4339e9ab9 100644 --- a/PLUGINS.md +++ b/PLUGINS.md @@ -58,6 +58,43 @@ specifying a `package.json` at your plugin root which will result in a `node_modules` folder being generated at the plugin root with your specific dependencies. +## Deployment Solutions + +Plugins can be deployed with a production instance of Talk. + +### Source + +Source deployments can just modify the `plugins.json` file and include any +local plugins into the `plugins/` directory. After including the config, you +need to reconcile the plugins and build the static assets: + +```bash +# get plugin dependancies and remote plugins +./bin/cli plugins reconcile + +# build staic assets (including enabled client side plugins) +yarn build +``` + +Then the application can be started as is. + +### Docker + +If you deploy using Docker, you can extend from the `*-onbuild` image, an +example `Dockerfile` for your project could be: + +```Dockerfile +FROM coralproject/talk:latest-onbuild +``` + +Where the directory for your instance would contain a `plugins.json` file +describing the plugin requirements and a `plugins` directory containing any +other local plugins that should be included. + +Onbuild triggers will execute when the image is building with your custom +configuration and will ensure that the image is ready to use by building all +assets inside the image as well. + ## Server Plugins ### API From 90db03bc29e573ca67c16a762a01a9305e33d830 Mon Sep 17 00:00:00 2001 From: Wyatt Johnson Date: Thu, 13 Apr 2017 13:40:13 -0600 Subject: [PATCH 07/14] rearranged docs --- INSTALL.md | 148 ++++++++++++++++++++++++++--------------------------- 1 file changed, 74 insertions(+), 74 deletions(-) diff --git a/INSTALL.md b/INSTALL.md index 8d332b77a..a764693ad 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -8,84 +8,12 @@ - [MongoDB](https://www.mongodb.com/) v3.4 or later - [Redis](https://redis.io/) v3.2 or later -## Installation From Source - -### Requirements - -There are some runtime requirements for running Talk from source: - -- [Node](https://nodejs.org/) v7.9 or later -- [Yarn](https://yarnpkg.com/) v0.22.0 or later - -_Please be sure to check the versions of these requirements. Incorrect versions -of these may lead to unexpected errors!_ - -### Installing - -#### Download - -It is highly recommended that you download a released version as the code -available in `master` may not be stable. You can download the latest release -from the [releases page](https://github.com/coralproject/talk/releases). - -You can also clone the git repository via: - -```bash -git clone https://github.com/coralproject/talk.git -``` - -#### Setup - -We now have to install the dependancies and build the static assets. - -```bash -# Install package dependancies -yarn - -# Build static files -yarn build -``` - -After you create/modify the `plugins.json` (refer to `PLUGINS.md` for plugin -docs) file, you can re-run the following to install their dependancies: - -```bash -# Reconcile plugins -./bin/cli plugins reconcile - -# Build static files -yarn build -``` - -### Running - -Refer to the `README.md` file for required configuration variables to add to the -environment. - -You can start the server after configuring the server using the command: - -```bash -yarn start -``` - -This will setup the server to serve everything on a single node.js process and -is designed to be used in production. - -You can see other scripts we've made available by consulting the `package.json` -file under the `scripts` key including: - -- `yarn test` run unit tests -- `yarn e2e` run end to end tests -- `yarn build-watch` watch for changes to client files and build static assets -- `yarn dev-start` watch for changes to server files and reload the server while - also sourcing a `.env` file in your local directory for configuration - ## Installation From Docker We currently support packaging the Talk application via Docker, which automates the dependancy install and asset build process. -https://hub.docker.com/r/coralproject/talk/ +Available as [coralproject/talk](https://hub.docker.com/r/coralproject/talk/) on Docker Hub. Images are tagged using the following notation: @@ -165,4 +93,76 @@ If you're using plain docker: ```bash docker run -d -P coralproject/talk:latest -``` \ No newline at end of file +``` + +## Installation From Source + +### Requirements + +There are some runtime requirements for running Talk from source: + +- [Node](https://nodejs.org/) v7.9 or later +- [Yarn](https://yarnpkg.com/) v0.22.0 or later + +_Please be sure to check the versions of these requirements. Incorrect versions +of these may lead to unexpected errors!_ + +### Installing + +#### Download + +It is highly recommended that you download a released version as the code +available in `master` may not be stable. You can download the latest release +from the [releases page](https://github.com/coralproject/talk/releases). + +You can also clone the git repository via: + +```bash +git clone https://github.com/coralproject/talk.git +``` + +#### Setup + +We now have to install the dependancies and build the static assets. + +```bash +# Install package dependancies +yarn + +# Build static files +yarn build +``` + +After you create/modify the `plugins.json` (refer to `PLUGINS.md` for plugin +docs) file, you can re-run the following to install their dependancies: + +```bash +# Reconcile plugins +./bin/cli plugins reconcile + +# Build static files +yarn build +``` + +### Running + +Refer to the `README.md` file for required configuration variables to add to the +environment. + +You can start the server after configuring the server using the command: + +```bash +yarn start +``` + +This will setup the server to serve everything on a single node.js process and +is designed to be used in production. + +You can see other scripts we've made available by consulting the `package.json` +file under the `scripts` key including: + +- `yarn test` run unit tests +- `yarn e2e` run end to end tests +- `yarn build-watch` watch for changes to client files and build static assets +- `yarn dev-start` watch for changes to server files and reload the server while + also sourcing a `.env` file in your local directory for configuration \ No newline at end of file From 7aa262e97ff291909c660290588c8f4493266f18 Mon Sep 17 00:00:00 2001 From: Wyatt Johnson Date: Thu, 13 Apr 2017 13:46:37 -0600 Subject: [PATCH 08/14] Added new cluster style deployment docs --- INSTALL.md | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/INSTALL.md b/INSTALL.md index a764693ad..1fec24865 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -80,6 +80,61 @@ that are specific to your installation. Some pre-defined fields have been filled in the above example which are consistent with Docker Compose naming conventions for [Docker Links](https://docs.docker.com/compose/networking/#links). +### Scaling + +If you are interested in splitting apart services, you can simply adjust the +command being executed in the container to optimize for your use case. An +example would be if you wanted to run the API server and the job processor +on different machines. You can acheive this easily with docker compose: + +```yaml +version: '2' +services: + talk-api: + image: coralproject/talk:1.5 + command: cli serve + restart: always + ports: + - "5000:5000" + depends_on: + - mongo + - redis + environment: + - TALK_MONGO_URL=mongodb://mongo/talk + - TALK_REDIS_URL=redis://redis + talk-jobs: + image: coralproject/talk:1.5 + command: cli jobs process + restart: always + ports: + - "5001:5000" + depends_on: + - mongo + - redis + environment: + - TALK_MONGO_URL=mongodb://mongo/talk + - TALK_REDIS_URL=redis://redis + mongo: + image: mongo:3.2 + restart: always + volumes: + - mongo:/data/db + redis: + image: redis:3.2 + restart: always + volumes: + - redis:/data +volumes: + mongo: + external: false + redis: + external: false +``` + +Note that the only difference is in the `command` key. From this, you are able +to discretly control which modules are running in order to have the maximum +flexibility when managing your application. + ### Running If you're using docker compose: From 061e775227dd5d05df6f5b41c4a4cc2f1c7e28ae Mon Sep 17 00:00:00 2001 From: Wyatt Johnson Date: Fri, 14 Apr 2017 10:26:06 -0600 Subject: [PATCH 09/14] Spell checks + doc updates --- INSTALL.md | 12 ++++++------ PLUGINS.md | 16 +++++++++++----- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/INSTALL.md b/INSTALL.md index 1fec24865..a7ccf302d 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -11,14 +11,14 @@ ## Installation From Docker We currently support packaging the Talk application via Docker, which automates -the dependancy install and asset build process. +the dependency install and asset build process. Available as [coralproject/talk](https://hub.docker.com/r/coralproject/talk/) on Docker Hub. Images are tagged using the following notation: - `x` (where `x` is the major version number): any minor or patch updates will be included in this. If you're ok getting - new features occationally and all the bug fixes, this is the tag for you. + new features occasionally and all the bug fixes, this is the tag for you. - `x.y` (where `y` is the minor version number): any patch updates will be included with this tag. If you like getting fixes and having features change only when you want, this is the tag for you. **(recommended)** @@ -85,7 +85,7 @@ for [Docker Links](https://docs.docker.com/compose/networking/#links). If you are interested in splitting apart services, you can simply adjust the command being executed in the container to optimize for your use case. An example would be if you wanted to run the API server and the job processor -on different machines. You can acheive this easily with docker compose: +on different machines. You can achieve this easily with docker compose: ```yaml version: '2' @@ -132,7 +132,7 @@ volumes: ``` Note that the only difference is in the `command` key. From this, you are able -to discretly control which modules are running in order to have the maximum +to discretely control which modules are running in order to have the maximum flexibility when managing your application. ### Running @@ -178,7 +178,7 @@ git clone https://github.com/coralproject/talk.git #### Setup -We now have to install the dependancies and build the static assets. +We now have to install the dependencies and build the static assets. ```bash # Install package dependancies @@ -189,7 +189,7 @@ yarn build ``` After you create/modify the `plugins.json` (refer to `PLUGINS.md` for plugin -docs) file, you can re-run the following to install their dependancies: +docs) file, you can re-run the following to install their dependencies: ```bash # Reconcile plugins diff --git a/PLUGINS.md b/PLUGINS.md index 4339e9ab9..068a0886f 100644 --- a/PLUGINS.md +++ b/PLUGINS.md @@ -46,14 +46,20 @@ External plugins can be resolved by running: ./bin/cli plugins reconcile ``` -This will also traverse into local plugin folders and install their -dependancies. _Note that if the plugin is already installed and available in the -node_modules folder, it will not be fetched again unless there is a version -mismatch._ +This achieves two things: + +1. It will traverse into local plugin folders and install their dependencies. + _Note that if the plugin is already installed and available in the node_modules folder, it will not be + fetched again unless there is a version mismatch._ This will result in the + project `package.json` and `yarn.lock` files to be modified, this is normal as + this ensures that repeated deployments (with the same config) will have the + same config, these changes should not be committed to source control. +2. It will seek out dependencies that are listed in the object notation and try + to install them from npm. ## Plugin Dependencies -You may also include additional external depenancies in your local packages by +You may also include additional external dependencies in your local packages by specifying a `package.json` at your plugin root which will result in a `node_modules` folder being generated at the plugin root with your specific dependencies. From 9cf31e0bfa57d3c278d08801d7c7b72df76d6804 Mon Sep 17 00:00:00 2001 From: gaba Date: Fri, 14 Apr 2017 10:37:05 -0700 Subject: [PATCH 10/14] A note on the from/to parameters. --- graph/typeDefs.graphql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/graph/typeDefs.graphql b/graph/typeDefs.graphql index 3f61273d4..2c410ce3c 100644 --- a/graph/typeDefs.graphql +++ b/graph/typeDefs.graphql @@ -544,11 +544,11 @@ type RootQuery { users(query: UsersQuery): [User] # Asset metrics related to user actions are saturated into the assets - # returned. + # returned. Parameters `from` and `to` are related to the action created_at field. assetMetrics(from: Date!, to: Date!, sort: ASSET_METRICS_SORT!, limit: Int = 10): [Asset!] # Comment metrics related to user actions are saturated into the comments - # returned. + # returned. Parameters `from` and `to` are related to the action created_at field. commentMetrics(from: Date!, to: Date!, sort: ACTION_TYPE!, limit: Int = 10): [Comment!] } From a19fe02782f80da67da3fff6d99be95c2e5643b7 Mon Sep 17 00:00:00 2001 From: Wyatt Johnson Date: Fri, 14 Apr 2017 14:48:44 -0600 Subject: [PATCH 11/14] Added setup/usage docs --- INSTALL.md | 46 ++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 44 insertions(+), 2 deletions(-) diff --git a/INSTALL.md b/INSTALL.md index a7ccf302d..49e78ee7d 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -1,3 +1,11 @@ +## Contents + +- [Installation](#installation) - install the application on a machine + - [Via Docker](#installation-from-docker) + - [Via Source](#installation-from-source) +- [Setup](#setup) - setup the application for first use +- [Usage](#usage) - connect the application to a website + # Installation ## Requirements @@ -176,7 +184,7 @@ You can also clone the git repository via: git clone https://github.com/coralproject/talk.git ``` -#### Setup +#### Building We now have to install the dependencies and build the static assets. @@ -220,4 +228,38 @@ file under the `scripts` key including: - `yarn e2e` run end to end tests - `yarn build-watch` watch for changes to client files and build static assets - `yarn dev-start` watch for changes to server files and reload the server while - also sourcing a `.env` file in your local directory for configuration \ No newline at end of file + also sourcing a `.env` file in your local directory for configuration + +# Setup + +Once you've installed Talk (either via Docker or source), you still need to +setup the application. If you are unfamiliar with any terminoligy used in the +setup process, refer to the `TERMINOLOGY.md` document. + +## Via Web + +If you want to perform your setup via the web, you can navigate to your +installation of Talk at the path `/admin/install`. There you will be asked a +series of questions for your installation. + +## Via CLI + +If you want to perform your setup through the terminal, you can simply run: + +```bash +cli setup +``` + +And follow the instructions to perform initial setup and create your first user +account. + + +# Usage + +After setup is complete, you can then refer to the `/admin/configure` path to +get the embed code that you can copy/paste onto your blog or website in order to +start using Talk. + +_In order for the embed to work correctly, you will need to whitelist the domain +that is allowed to embed your site on the `/admin/configure` page, failure to do +so will result in the comment stream not loading._ From d4fc8a474d0cdca7ea47d513002f9b4207952b79 Mon Sep 17 00:00:00 2001 From: Wyatt Johnson Date: Fri, 14 Apr 2017 14:57:13 -0600 Subject: [PATCH 12/14] Should resolve bug relating to usernames being set as "undefined" --- services/users.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/services/users.js b/services/users.js index de9678089..14301ccf4 100644 --- a/services/users.js +++ b/services/users.js @@ -254,26 +254,28 @@ module.exports = class UsersService { * @param {Boolean} checkAgainstWordlist enables cheching against the wordlist * @return {Promise} */ - static isValidUsername(username, checkAgainstWordlist = true) { + static async isValidUsername(username, checkAgainstWordlist = true) { const onlyLettersNumbersUnderscore = /^[A-Za-z0-9_]+$/; if (!username) { - return Promise.reject(errors.ErrMissingUsername); + throw errors.ErrMissingUsername; } if (!onlyLettersNumbersUnderscore.test(username)) { - - return Promise.reject(errors.ErrSpecialChars); + throw errors.ErrSpecialChars; } if (checkAgainstWordlist) { // check for profanity - console.log('Username profanity check disabled: ', Wordlist.usernameCheck(username)); + let err = await Wordlist.usernameCheck(username); + if (err) { + throw err; + } } // No errors found! - return Promise.resolve(username); + return username; } /** From e028e30afdcf3261d56debb0a8f98d370be5cf17 Mon Sep 17 00:00:00 2001 From: Wyatt Johnson Date: Fri, 14 Apr 2017 15:04:35 -0600 Subject: [PATCH 13/14] Added line about SSL certificates --- INSTALL.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/INSTALL.md b/INSTALL.md index 49e78ee7d..57ef3712d 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -15,6 +15,11 @@ - 5GB storage (minimum) - [MongoDB](https://www.mongodb.com/) v3.4 or later - [Redis](https://redis.io/) v3.2 or later +- SSL Certificate + - This application assumes that you will be serving this application in a + production environment, and therefore requires that you serve it behind a + webserver with a valid SSL certificate. This is chosen in order to secure + user's sessions. ## Installation From Docker From bee27da7255532ee9f34b2f59218968307c6b7da Mon Sep 17 00:00:00 2001 From: Wyatt Johnson Date: Fri, 14 Apr 2017 15:16:42 -0600 Subject: [PATCH 14/14] Added note for production based deploy --- INSTALL.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/INSTALL.md b/INSTALL.md index 57ef3712d..18244f635 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -24,7 +24,8 @@ ## Installation From Docker We currently support packaging the Talk application via Docker, which automates -the dependency install and asset build process. +the dependency install and asset build process. This is the recommended way to +deploy the application when used in production. Available as [coralproject/talk](https://hub.docker.com/r/coralproject/talk/) on Docker Hub. @@ -165,6 +166,10 @@ docker run -d -P coralproject/talk:latest ## Installation From Source +This provides information on how to setup the application from source. Note that +this is not recommended for production deploys, but will work for development +and testing purposes. + ### Requirements There are some runtime requirements for running Talk from source: