Merge branch 'master' into master

This commit is contained in:
Kim Gardner
2019-01-16 14:44:51 +00:00
committed by GitHub
25 changed files with 252 additions and 52 deletions
-1
View File
@@ -28,7 +28,6 @@ The current recommended release version is v4.5.0. ^4.5 (and all future even-num
- [Talk Product Roadmap](https://www.pivotaltracker.com/n/projects/1863625)
- [Our Blog](https://blog.coralproject.net/)
- [Community Forums](https://community.coralproject.net/)
- [Community Guides for Journalism](https://guides.coralproject.net/)
- [More About Us](https://coralproject.net/)
+17 -5
View File
@@ -1,8 +1,10 @@
#!/usr/bin/env node
const throng = require('throng');
const { CONCURRENCY } = require('../config');
const { logger } = require('../services/logging');
const util = require('./util');
const program = require('commander');
const serve = require('../serve');
//==============================================================================
// Setting up the program command line arguments.
@@ -22,8 +24,18 @@ program
)
.parse(process.argv);
// Start serving.
serve(program).catch(err => {
console.error(err);
util.shutdown(1);
throng({
workers: CONCURRENCY,
start: i => {
logger.info({ workerID: i }, 'started worker');
// Load in the serve.
const serve = require('../serve');
// Start serving.
serve(program).catch(err => {
console.error(err);
util.shutdown(1);
});
},
});
@@ -62,6 +62,7 @@
font-weight: 300;
margin-bottom: 8px;
overflow-wrap: break-word;
word-break:break-word;
}
.body {
@@ -1,6 +1,7 @@
import React from 'react';
import QuestionBox from '../../../components/QuestionBox';
import DefaultQuestionBoxIcon from '../../../components/DefaultQuestionBoxIcon';
import PropTypes from 'prop-types';
import cn from 'classnames';
import styles from './QuestionBoxBuilder.css';
import { Icon } from 'coral-ui';
@@ -12,6 +13,7 @@ const icons = [{ default: DefaultIcon }, 'forum', 'build', 'format_quote'];
class QuestionBoxBuilder extends React.Component {
render() {
const {
title,
questionBoxIcon,
questionBoxContent,
onContentChange,
@@ -20,7 +22,7 @@ class QuestionBoxBuilder extends React.Component {
return (
<div className={styles.root}>
<h4>Include an Icon</h4>
<h4>{title}</h4>
<ul className={styles.iconList}>
{icons.map(item => {
@@ -53,4 +55,12 @@ class QuestionBoxBuilder extends React.Component {
}
}
QuestionBoxBuilder.propTypes = {
title: PropTypes.string,
questionBoxIcon: PropTypes.string,
questionBoxContent: PropTypes.string,
onContentChange: PropTypes.func,
onIconChange: PropTypes.func,
};
export default QuestionBoxBuilder;
@@ -69,6 +69,7 @@ class Settings extends React.Component {
{questionBoxEnable && (
<div className={styles.questionBoxContainer}>
<QuestionBoxBuilder
title={t('configure.include_an_icon')}
questionBoxIcon={questionBoxIcon}
questionBoxContent={questionBoxContent}
onIconChange={onQuestionBoxIconChange}
+3
View File
@@ -217,6 +217,9 @@ const CONFIG = {
// messages through the websocket to keep the socket alive.
KEEP_ALIVE: process.env.TALK_KEEP_ALIVE || '30s',
// CONCURRENCY is the number of workers that will serve traffic.
CONCURRENCY: parseInt(process.env.TALK_CONCURRENCY || '1'),
//------------------------------------------------------------------------------
// Cache configuration
//------------------------------------------------------------------------------
+2 -2
View File
@@ -104,8 +104,8 @@ sidebar:
children:
- title: Authentication
url: /integrating/authentication/
- title: Asset Management
url: /integrating/asset-management/
- title: CMS Integration
url: /integrating/cms-integration/
- title: Asset Scraping
url: /integrating/asset-scraping/
- title: Configuring the Comment Stream
+2 -1
View File
@@ -1,3 +1,4 @@
/ /talk/
/talk/reference/server/ /talk/api/server/
/talk/reference/graphql/ /talk/api/graphql/
/talk/reference/graphql/ /talk/api/graphql/
/talk/integrating/asset-management/ /talk/integrating/cms-integration/
@@ -19,3 +19,40 @@ Application servers: c4.xlarge (16 VM nginx + Talk VM machine pairs)
Mongo nodes: 3x c3.medium (large db cluster, 1 master, 2 read replicas)
If you need help with Talk performance or want custom scaling help or recommendations, let us know by logging a ticket and one of our engineers will get in touch with you: https://support.coralproject.net
## How to Scale Talk Components
### Scaling the Talk Application
In addition to scaling by adding additional app servers, Talk as a server component can flex to various roles. Depending on the desired configuration the roles can be split up to ensure high availability, and best matching to underlying host resources.
There are three components to the Talk application that can be served independently or in combination on a single thread: API Server, WebSockets, and Jobs
![ServerArchitectureDiagram](/talk/images/ServerArch.png)
In the diagram we see the difference between a Typical configuration (which just adds additional Talk application instances) vs the Split configuration where different Talk components could be spread across different machine resources to optimize infrastructure utilization.
See [Serving the Application](/talk/configuration-cli-tools/#serving-the-application)
### Scaling Redis
Redis serves as a general cache and pub/sub broker. We treat all the data stored in Redis as ephemeral, so using as a cache serves us well for Talk to synchronize expensive query caches. It also serves as our pub/sub broker for use with live updates as propagated through the GraphQL subscription system. For this reason it is not recommended to implement multiple instances of Redis.
### Scaling MongoDB
MongoDB is treated as our general store for persisted data. Talk supports the most common strategies for scaling MongoDB instances including replicas and/or sharding. Depending on your specific data use cases, refer to MongoDBs documentation for more information about scaling https://www.mongodb.com/mongodb-scale.
### Load Balancer
While this subject lives outside the Talk ecosystem, it is critical for application delivery. For websockets to work correctly, a load balancer must be selected that can support long lived connections that are required for websockets to work.
## Running Talk in Production
When you are ready to launch your production instance of Talk update your NODE_ENV environment variable from `development` to `production` mode.
Then launch talk with `yarn start` or with the command `NODE_ENV=production ./bin/cli-serve -j -w`
By default Talk will run on a single thread, but you can also run multiple Talk threads on a single application instance by setting the environment variable `TALK_CONCURRENCY`. [See Advanced Configuration](/talk/advanced-configuration/#talk-concurrency)
+5 -4
View File
@@ -29,7 +29,7 @@ permalink: /pre-launch-checklist/
- See [Authenticating with Talk](/talk/integrating/authentication/)
- [ ] Do you want to integrate Talk with your CMS to automate embedding Talk Comment Stream into your site?
- See [Asset Management](/talk/integrating/asset-management/)
- See [CMS Integration](/talk/integrating/cms-integration/)
- [ ] Do you want to use Social sign-on?
- Facebook
@@ -58,9 +58,10 @@ permalink: /pre-launch-checklist/
- Install [talk-plugin-rich-text](/talk/plugin/talk-plugin-rich-text)
- [ ] Do you want to display comment counts?
- Use the GraphQL [CommentCountQuery](https://docs.coralproject.net/talk/api/graphql/#CommentCountQuery)
- Install [talk-plugin-deep-reply-count](/talk/plugin/talk-plugin-deep-reply-count) if necessary.
- [ ] Do you want to display comment counts on your embed stream or on a homepage with dozens of articles?
- Install [talk-plugin-comment-count](https://github.com/coralproject/talk-plugin-comment-count) for summary counts on multiple articles
- Install [talk-plugin-deep-reply-count](/talk/plugin/talk-plugin-deep-reply-count) to add counts to the embed stream
- Or use the GraphQL [CommentCountQuery](https://docs.coralproject.net/talk/api/graphql/#CommentCountQuery)
- [ ] Do you want to translate Talk to a different language?
@@ -23,6 +23,10 @@ otherwise the application will fail to start.
Configure the duration for which comment counts are cached for, parsed by
[ms](https://www.npmjs.com/package/ms). (Default `1hr`)
## TALK_CONCURRENCY
This environment variable allows multiple worker processes to be spawned to handle traffic. (Default `1`)
## TALK_DEFAULT_LANG
This is a **Build Variable** and must be consumed during build. If using the
-2
View File
@@ -11,8 +11,6 @@ To log a bug or request a feature, submit a Support ticket ([support@coralprojec
You can also request help on Github by [submitting an issue](https://github.com/coralproject/talk/issues). This also increases your chances of having someone from the community respond to help.
And you can also search our [Coral Community](https://community.coralproject.net) to see if your issue has been solved, or to get tips from the community.
## How can our dev team contribute to Talk?
We are lucky to work with newsroom dev teams and individual contributors who span the world, and come from newsrooms of all sizes. You can read our [Contribution Guide](https://github.com/coralproject/talk/blob/master/CONTRIBUTING.md) to get started, but feel free to reach out to us via Github too.
@@ -38,3 +38,6 @@ If you're using `talk-plugin-auth`:
* See if you can isolate if it's a particular group of users that are experiencing this issue, e.g. mods, admins, subscribers? Confirm they have the appropriate permissions to comment.
* Note if this is a new issue that happened after an upgrade - did you read the [migration docs](/talk/migration/3/) and the [release notes](https://github.com/coralproject/talk/releases)? This might help you resolve the issue.
* If you're still experiencing issues, log a [support ticket](mailto:support@coralproject.net) so we can help diagnose the issue
If a user has been locked out due to too many failed login attempts:
* How long does the user have to wait before they will be allowed to login? 10 mins
+5
View File
@@ -146,3 +146,8 @@
tags:
- default
- sorting
- name: talk-plugin-comment-count
description: This plugin enables adding comment counts to Talks embed or in other locations on your site.
link: https://github.com/coralproject/talk-plugin-comment-count
tags:
- counts
Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

@@ -26,6 +26,9 @@ Plugins are available for the following 3rd party authentication providers:
* [Facebook](/talk/plugin/talk-plugin-facebook-auth/)
* [Google](/talk/plugin/talk-plugin-google-auth/)
_FAQ: Can I create a Twitter auth plugin?_
This is currently not possible because Talk uses passport.js which does not support Twitter's oAuth2 requirements.
## Custom Token Integration
You can integrate Talk with any authentication service to enable single sign-on
@@ -61,6 +64,9 @@ The generated JWT must contain the following claims:
- [`iss`](https://tools.ietf.org/html/rfc7519#section-4.1.1): the issuer for the token must match the value of `TALK_JWT_ISSUER`
- [`aud`](https://tools.ietf.org/html/rfc7519#section-4.1.3): the audience for the token must match the value of `TALK_JWT_AUDIENCE`
### Generate a key to sign the JWT
Optionally you can use https://github.com/coralproject/coralcert to generate a key with which to sign the JWTs and specify the secret as an environment variable.
### Push token into embed
We're assuming that your CMS is capable of authenticating a user account, or
@@ -1,23 +1,81 @@
---
title: Asset Management
permalink: /integrating/asset-management/
title: CMS Integration
permalink: /integrating/cms-integration/
---
## Embedding Comments on Your Site
Talk provides an embed script that you can drop into your site where you want a comments section to appear. By default that script dynamically generate Assets
in Talk in order to make it easier for lighter installations.
You can find the embed script inside talk under `Configure > Tech Settings > Embed Script`. It should look something like this, but with your domain in place of `<TALK_ROOT_URL>`:
```
<div id="coral_talk_stream"></div>
<script src="<TALK_ROOT_URL>/static/embed.js" async onload="
Coral.Talk.render(document.getElementById('coral_talk_stream'), {
talk: '<TALK_ROOT_URL>'
});
"></script>
```
## Triggering the Comments Section (client side, i.e. Your site)
When the embed script is triggered on your page load several things are initiated inside Talk, including fetching all comments for the specified article, establishing websocket connections for this user, and checking users session for SSO/authentication.
Instead of greedily triggering the embed to render on _EVERY PAGE LOAD_, we highly recommend implementing a _“lazy”_ rendering strategy to only render the comments section if a user wants to interact with it. This will greatly improve your initial page load performance, and will be critical to managing server resources if youre running Talk on a heavy-traffic production site.
We recommend using one of these _“lazy”_ loading strategies:
#### Scroll to Comments Section
Wait for user to scroll to the comment section before triggering the embed to render.
You can pass lazy: true to the render options, like so:
```
Coral.Talk.render(document.getElementById('container'), {
talk: 'https://my-talk-installation.com',
lazy: true,
});
```
Or you can enable lazy rendering by default on all assets using ENV variable `TALK_DEFAULT_LAZY_RENDER=TRUE`
_*Note: This feature requires Talk version 4.6.8 or greater_
#### Show Comments Button
You can hide the comments section until a user clicks button, then trigger the embed to render
This example uses jQuery to render the embed on the button's click event
```
<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
<div id="coral_talk_stream">
<button>Show Comments</button>
</div>
<script type="text/javascript">
$('#coral_talk_stream button').on('click', function() {
$.getScript('<TALK_ROOT_URL>/static/embed.js', function() {
Coral.Talk.render(document.getElementById('coral_talk_stream'), {
talk: '<TALK_ROOT_URL>',
});
});
});
</script>
```
## Creating Assets in Talk (server side, i.e. What you need to send to Talk)
One of the most frequent questions that we get asked by organizations trying to
integrate Talk is: _How do we hook our CMS up to Talk so that articles are in
sync?_
This guide is designed to explain the steps to take your base installation of
Talk and configure it to allow only assets pushed into it from your CMS, and
keep your URL/title in sync. We won't cover here how to install the plugin, as
it is covered in our [Plugins Overview](/talk/plugins/).
### “Lazy Asset Creation
Talks provided embed script by default dynamically generates Assets in Talk based on each unique url that triggers it. The url must reference an existing Permitted Domain. If your articles/stories always have unique urls, then you will not need to modify the default behavior.
## Why do we need to create a plugin?
Assets created in this way will then be scraped to load metadata, see [Asset Scraping](/talk/integrating/asset-scraping/)
By default, Talk will use "Lazy Asset Creation" to dynamically generate Assets
in Talk in order to make it easier for lighter installations. In order to have
more strict control over this flow, we will create a plugin that will:
## Customizing the Integration with a Plugin
In order to have more strict control over the asset creation flow to allow only assets pushed into it from your CMS, and keep your URL/title in sync we will create a plugin.
We will create a plugin that will:
1. Disable "Lazy Asset Creation" by [Overriding a Resolver](#overriding-a-resolver).
2. Create Assets from our CMS by [Creating a New Asset Route](#creating-a-new-asset-route).
@@ -25,6 +83,9 @@ more strict control over this flow, we will create a plugin that will:
We will then modify our embed so that we can [Target the Asset](#target-the-asset).
This guide is designed to explain the steps to take your base installation of Talk and configure it. We won't cover here how to install the plugin, as it is covered in our [Plugins Overview](/talk/plugins/).
But first we should grab our basic plugin structure:
```sh
+67 -21
View File
@@ -3,22 +3,13 @@ title: Notifications
permalink: /integrating/notifications/
---
Talk currently supports 3 types of email notifications.
There are several plugins included with Talk that once enabled will control how and when Talk sends emails to users based on user activity. Only basic user profile notifications are enabled by default.
1. When someone replies to my comment
2. When a staff member replies to my comment
3. When my comment gets featured
Talk support 3 options for notification frequency: immediately, hourly or daily. Commenters can also opt-out of email notifications. Notifications are set to OFF by default.
Commenters cannot enable notifications until they have verified their email.
Note: Notifications are not currently supported for users that sign-up via Facebook or Google auth, or don't have an email attached to their account for any other reason.
_NOTE: Notifications are only supported for users that have an email address in Talk! If you are using authenticate via Facebook, Google, or SSO and you want to persist the users email, you will also need to enable `talk-plugin-local-auth` ([See Authentication](/talk/integrating/authentication/))_
### Configuring SMTP
You must setup SMTP to use notifications. The following ENV variables must be set:
You must setup SMTP to send email notifications. The following ENV variables must be set:
```
TALK_SMTP_FROM_ADDRESS=email@email.com
@@ -28,28 +19,74 @@ TALK_SMTP_HOST=smtp.domain.net
TALK_SMTP_PORT=2525
```
### Enabling Notifications
See our documentation on [setting env variables](/talk/advanced-configuration/#talk-smtp-from-address) for reference.
Enabling the `talk-plugin-notifications` creates a NotificationManager that creates and manages events send from the event emitter that is linked to the Graph API PubSub system.
When running Talk in production we recommend using a 3rd party mail service provider like SendGrid or MailGun.
Adding the `talk-plugin-notifications` plugin will also enable the `notifications` plugin hook. Any plugin that registers before the `talk-plugin-notifications` plugin will get picked up by.
If you are having difficulty with your SMTP settings you can add `DEBUG=talk:jobs:mailer` to your .env to see additional logs from the mailer service.
See https://github.com/coralproject/talk/blob/8b669a31c551a042f0f079d8cfc16825673eb8f0/plugins/talk-plugin-notifications-reply/index.js for an example.
All notifications require SMTP settings to be correctly configured first, then enable the corresponding plugin, and configure any settings in the Talk Admin. If SMTP is not enabled, it will log to the server console that some variables were not provided.
### Notification Categories
### Notification Types & Plugins
Talk currently supports the following Notifications options out of the box:
In addition to the core notifications included with Talk, some plugins add features that are supported by and will add additional types of email notifications. Commenters can opt-out of most email notifications, and comment activity notifications are set to OFF by default. Commenters cannot enable notifications until they have verified their email.
`talk-plugin-notifications-category-reply`
`talk-plugin-notifications-category-staff-reply`
`talk-plugin-notifications-category-featured`
You can see a list of all the plugins related to notifications by visiting:
https://docs.coralproject.net/talk/plugins-directory/?q=notifications
#### Type: User Profile Notifications (Included by Talk core)
* When user registers, sends email confirmation and verification
* When user requests password reset
* When user changes username, sends confirmation
* When a user is banned or suspended
_NOTE: Users can not opt-out of User Profile Notifications_
#### Type: GDPR Notifications (optional)
`talk-plugin-profile-data:`
* When my comment history is ready for download (only one link can be generated every 7 days, and the link is valid for 24 hours)
`talk-plugin-local-auth:`
* When user changes their email address
* When a user adds a new email address
#### Type: Comment Activity Notifications (optional)
Talk support 3 options for notification frequency for this type of notification:
* immediately
* hourly
* daily
`talk-plugin-notifications:`
* Enables notifications configuration (required for all comment activity notifications below)
`talk-plugin-notifications-category-reply:`
* When someone replies to my comment
`talk-plugin-notifications-category-staff-reply:`
* When a staff member replies to my comment
`talk-plugin-notifications-category-featured:`
* When my comment gets featured
### Notification Digests
Notification digests are enabled by enabling the corresponding plugin, otherwise comment activity notifications are sent immediately.
* `talk-plugin-notifications-digest-daily`
* `talk-plugin-notifications-digest-hourly`
Talk supports hourly and daily digests out the box, if you would like to create your own, refer to the below:
https://github.com/coralproject/talk/blob/9cc9969320dca47bb0f8f81e8d944ae4d19e548b/plugins/talk-plugin-notifications/server/connect.js#L69-L102
### Customizing Notifications
Enabling the `talk-plugin-notifications` creates a NotificationManager that creates and manages events send from the event emitter that is linked to the Graph API PubSub system. This allows the instance that received the mutation to also fire off a notification job that can be handled. It also enabels the `notifications` plugin hook. Any plugin that registers after the `talk-plugin-notifications` can export the notifications plugin to reference it.
See https://github.com/coralproject/talk/blob/8b669a31c551a042f0f079d8cfc16825673eb8f0/plugins/talk-plugin-notifications-reply/index.js for an example.
### Connect API
This exposes the `graph/connectors.js` via the `connect` hook.
@@ -67,3 +104,12 @@ See https://github.com/coralproject/talk/blob/90290cfa2de88e62f687e1ed0235ba6dfe
### Email Templates
Email templates are text based and support translations. If you would like to create a new email template, you can register it via the Connect API, see https://github.com/coralproject/talk/blob/8b669a31c551a042f0f079d8cfc16825673eb8f0/plugins/talk-plugin-notifications/server/connect.js#L12-L28###
Any email template registered with the same name as another template will replace the existing template for that type of email. _NOTE: that also means that the template data sent to each email template will __not__ change, so bear that in mind when designing templates that you may not have rich access to data._
An example of this is with the `talk-plugin-notifications-category-featured` plugin:
Notification translation is located: https://github.com/coralproject/talk/blob/dd0601a80132d2849c53ef7eaf12ff382f3920b9/plugins/talk-plugin-notifications-category-featured/translations.yml#L13
Where the template content is provided: https://github.com/coralproject/talk/blob/dd0601a80132d2849c53ef7eaf12ff382f3920b9/plugins/talk-plugin-notifications-category-featured/index.js#L79
+2 -2
View File
@@ -67,9 +67,9 @@ External plugins can be resolved by running:
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
__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`
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.
+1
View File
@@ -136,6 +136,7 @@ de:
code_of_conduct_summary_desc: 'Verfassen Sie eine Einleitung, die über jedem Kommentarbereich erscheint. Nützlich z.B. für Community-Richtlinien.'
include_question_here: 'Stellen Sie Ihre Frage hier:'
include_text: 'Fügen Sie Ihren Text hier ein.'
include_an_icon: 'Fügen Sie ein Icon hinzu'
moderate: Moderieren
moderation_settings: Moderations-Einstellungen
open: Öffnen
+1
View File
@@ -139,6 +139,7 @@ en:
hours: Hours
code_of_conduct_summary: 'Summary of your Code of Conduct'
code_of_conduct_summary_desc: 'This message will appear above every comments stream on your site. Click here to learn more about writing a good code.'
include_an_icon: 'Include an Icon'
include_question_here: 'Write your question here:'
include_text: 'Include your text here.'
moderate: Moderate
+2 -1
View File
@@ -1,6 +1,6 @@
{
"name": "talk",
"version": "4.6.10",
"version": "4.7.0",
"description": "A better commenting experience from Mozilla, The New York Times, and the Washington Post. https://coralproject.net",
"main": "app.js",
"private": true,
@@ -205,6 +205,7 @@
"style-loader": "^0.16.0",
"subscriptions-transport-ws": "^0.7.2",
"supports-color": "^4",
"throng": "^4.0.0",
"timeago.js": "^2.0.3",
"timekeeper": "^1.0.0",
"tlds": "^1.196.0",
@@ -29,6 +29,8 @@ Configuration:
guide. This is only required while the `talk-plugin-facebook-auth` plugin is
enabled.
_NOTE: FabceBook auth requires your site to use `https` (SSL) not `http`. If your site is not `https` you can not use this plugin!_
## GDPR Compliance
In order to facilitate compliance with the
+2 -2
View File
@@ -91,12 +91,12 @@ class Task {
static shutdown() {
debug('Shutting down the Queue');
return new Promise((resolve, reject) => {
return new Promise(resolve => {
// Shutdown and give the queue 5 seconds to shutdown before we start
// killing jobs.
getQueue().shutdown(5000, err => {
if (err) {
return reject(err);
return resolve();
}
debug('Queue shut down.');
+7
View File
@@ -12823,6 +12823,13 @@ throat@^4.0.0:
resolved "https://registry.yarnpkg.com/throat/-/throat-4.1.0.tgz#89037cbc92c56ab18926e6ba4cbb200e15672a6a"
integrity sha1-iQN8vJLFarGJJua6TLsgDhVnKmo=
throng@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/throng/-/throng-4.0.0.tgz#983c6ba1993b58eae859998aa687ffe88df84c17"
integrity sha1-mDxroZk7WOroWZmKpof/6I34TBc=
dependencies:
lodash.defaults "^4.0.1"
through2@^2.0.0:
version "2.0.3"
resolved "https://registry.yarnpkg.com/through2/-/through2-2.0.3.tgz#0004569b37c7c74ba39c43f3ced78d1ad94140be"