diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 66ae8ade8..72c75ce27 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -1,9 +1,10 @@
# Contributor's Guide
-Welcome! We are very excited that you are interested in contributing to Talk.
+Welcome! We are very excited that you are interested in contributing to Talk.
This document is a companion to help you approach contributing. If it does not do so, please [let us know how we can improve it](https://github.com/coralproject/talk/issues)!
+By contributing to this project you agree to the [Code of Conduct](https://coralproject.net/code-of-conduct.html).
## Product Roadmap
@@ -13,7 +14,7 @@ You can view product ideas and our longer term roadmap here https://trello.com/b
## Contribute to the documentation
-Clear docs are a prerequisite for a successful open source project. We value non-code and code contributions equally.
+Clear docs are a prerequisite for a successful open source project. We value non-code and code contributions equally.
We are looking for _documentarians_ to:
@@ -40,7 +41,7 @@ Talk is designed to integrate into existing environments in a variety of ways:
If you're considering deploying Talk, [please let us know](https://github.com/coralproject/talk/wiki/Contact-Us)! We are quite literally doing this for you and want to help you succeed any way we can.
-If you are writing custom integration code in your fork of Talk, please consider keeping it generic and filing a Pull Request to contribute it back to the project! See our [forking and merging guidelines](https://github.com/coralproject/talk/wiki/Forking,-Branching-and-Merging) for more info.
+If you are writing custom integration code in your fork of Talk, please consider keeping it generic and filing a Pull Request to contribute it back to the project! See our [forking and merging guidelines](https://github.com/coralproject/talk/wiki/Forking,-Branching-and-Merging) for more info.
## Write some code
@@ -48,9 +49,9 @@ First, [set up a dev environment](https://github.com/coralproject/talk/blob/mast
### Build a New Feature / Plugin
-Talk is beginning life as a Commenting Platform, but is architected to support many varieties of community engagement.
+Talk is beginning life as a Commenting Platform, but is architected to support many varieties of community engagement.
-Please [contact us](https://github.com/coralproject/talk/wiki/Contact-Us) early and often if you'd like to help. We would love to hear your ideas for features and plugins and help you find a way to productively engage the project.
+Please [contact us](https://github.com/coralproject/talk/wiki/Contact-Us) early and often if you'd like to help. We would love to hear your ideas for features and plugins and help you find a way to productively engage the project.
To get an idea of where the Coral Team is going, see:
@@ -66,13 +67,10 @@ Examples:
### Work on the Core
-There is always more work to be done to make an application more stable, scaleable and secure.
+There is always more work to be done to make an application more stable, scaleable and secure.
If you see issues in the code or have ideas on how we may improve Talk, please consider:
* [contributing a fix](https://github.com/coralproject/talk/wiki/Forking,-Branching-and-Merging),
* [filing an issue](https://github.com/coralproject/talk/issues), or
* or otherwise [letting us know](https://github.com/coralproject/talk/wiki/Contact-Us).
-
-
-
diff --git a/INSTALL.md b/INSTALL.md
index f5f82f294..008c4cba3 100644
--- a/INSTALL.md
+++ b/INSTALL.md
@@ -1,95 +1,94 @@
-# Installing a dev environment
-
-By contributing to this project you agree to the [Code of Conduct](https://coralproject.net/code-of-conduct.html).
+# Installation
## Requirements
### System
-- Any flavor of Linux, OSX or Windows
+- Any flavour of Linux, OSX or Windows
- 1GB memory (minimum)
- 5GB storage (minimum)
-### Software
+## Installation From Source
-* [Node](https://nodejs.org/es/download/package-manager) v7 or later
-* Mongo v3.2 or later
-* Redis v3.2 or later
+### Requirements
+
+There are some runtime requirements for running Talk from source:
+
+- [Node](https://nodejs.org/) v7 or later
+- [MongoDB](https://www.mongodb.com/) v3.2 or later
+- [Redis](https://redis.io/) v3.2 or later
+- [Yarn](https://yarnpkg.com/) v0.19.1 or later
_Please be sure to check the versions of these requirements. Insufficient versions of these may lead to unexpected errors!_
-## First time setup
+### Installing
-### Installation
+```bash
+# Download the tarball containing the repository
+curl -L https://github.com/coralproject/talk/tarball/master -o coralproject-talk.tar.gz
-Navigate to a directory.
+# Untar that file and change to that directory
+tar xpf coralproject-talk.tar.gz
+mv coralproject-talk-* coralproject-talk
+cd coralproject-talk
-```
-git clone https://github.com/coralproject/talk
-cd talk
-yarn install
-```
+# Install package dependancies
+yarn
-### Environmental Variables
-
-Talk uses environmental variables for configuration. You can learn about them in the [README file](README.md).
-
-
-## Workflows
-
-### The server
-
-Starting the server:
-
-```
-yarn start
-```
-
-Browse to `http://localhost:3000` (or your custom port.)
-
-### Building the front end
-
-Our build process will build all front end components registered [here](https://github.com/coralproject/talk/blob/6052cac1d3494f8060325a88bb2ce03c88c2f94c/webpack.config.dev.js#L9-L15).
-
-One time build:
-
-```
+# Build static files
yarn build
```
-Build, then rebuild when a file is updated (development build):
+### Running
-```
-yarn build-watch
+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
```
+You can see other scripts we've made available by consulting the `package.json`
+file under the `scripts` key including:
-### Testing
+- `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
-Run all tests once:
+## Installation From Docker Hub
-`
-yarn test
-`
+### Requirements
-Run our end to end tests (will install Selenium and nightwatch):
+There are some runtime requirements for running Talk for Docker:
-`
-yarn e2e
-`
+- [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 ensure all tests are passing before submitting a PR!_
+_Please be sure to check the versions of these requirements. Insufficient versions of these may lead to unexpected errors!_
-## Troubleshooting
+### Installing
+```bash
+# Create a directory for talk
+mkdir coralproject-talk
+cd coralproject-talk
-##### Can't ping the redis server!
+# Download the docker-compose.yml file from the repository
+curl -LO https://raw.githubusercontent.com/coralproject/talk/master/docker-compose.yml
+```
-- Check that Redis Server is running.
-- Check that TALK_REDIS_URL is set.
-
-##### Authenticaiton doesn't work!
-
-- Make sure Redis is the correct version.
+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.
+### Running
+```bash
+# Start the services using compose
+docker-compose up -d
+```
diff --git a/README.md b/README.md
index 274fd7f3d..f47fbd2f6 100644
--- a/README.md
+++ b/README.md
@@ -12,7 +12,7 @@ See our [Contribution Guide](https://github.com/coralproject/talk/blob/master/CO
To set up a development environment or build from source, see [INSTALL.md](https://github.com/coralproject/talk/blob/master/INSTALL.md).
-To launch a Talk server of your own from your browser without any need to muck about in a terminal or think about engineering concepts, stay tuned. We will launch [our installer](https://github.com/coralproject/talk-install) shortly!!
+To launch a Talk server of your own from your browser without any need to muck about in a terminal or think about engineering concepts, stay tuned. We will launch [our installer](https://github.com/coralproject/talk-install) shortly!
### Configuration
@@ -37,6 +37,7 @@ Facebook Login enabled app.
- `TALK_SMTP_PASSWORD` (*required for email*) - password for the SMTP provider you are using.
- `TALK_SMTP_HOST` (*required for email*) - SMTP host url with format `smtp.domain.com`.
- `TALK_SMTP_PORT` (*required for email*) - SMTP port.
+- `TALK_INSTALL_LOCK` (_optional for dynamic setup_) - Defaults to `FALSE`. When `TRUE`, disables the dynamic setup endpoint.
Refer to the wiki page on [Configuration Loading](https://github.com/coralproject/talk/wiki/Configuration-Loading) for
alternative methods of loading configuration during development.
diff --git a/bin/cli b/bin/cli
index 5b52d96b9..c0690e455 100755
--- a/bin/cli
+++ b/bin/cli
@@ -4,7 +4,7 @@
* Module dependencies.
*/
-const util = require('../util');
+// const util = require('./util');
const program = require('./commander');
program
@@ -15,18 +15,14 @@ program
.command('users', 'work with the application auth')
.parse(process.argv);
-// If there is no command listed, output help.
-if (!process.argv.slice(2).length) {
- program.outputHelp();
- return;
-}
-
-// The ensures that the child process that is created here is always cleaned up
-// properly when the parent process dies.
-util.onshutdown([
- (signal) => {
- if ((program.runningCommand.killed === false) && (program.runningCommand.exitCode === null)) {
- program.runningCommand.kill(signal);
- }
+/**
+ * When this provess exists, check to see if we have a running command, if we do
+ * check to see if it is still running. If it is, then kill it with a SIGINT
+ * signal. This is for the use case where we want to kill the process that is
+ * labled with the PID written out by the parent process.
+ */
+process.once('exit', () => {
+ if ((program.runningCommand.killed === false) && (program.runningCommand.exitCode === null)) {
+ program.runningCommand.kill('SIGINT');
}
-]);
+});
diff --git a/bin/cli-assets b/bin/cli-assets
index 76ca5735b..166152baf 100755
--- a/bin/cli-assets
+++ b/bin/cli-assets
@@ -10,7 +10,7 @@ const Table = require('cli-table');
const AssetModel = require('../models/asset');
const mongoose = require('../services/mongoose');
const scraper = require('../services/scraper');
-const util = require('../util');
+const util = require('./util');
// Register the shutdown criteria.
util.onshutdown([
diff --git a/bin/cli-jobs b/bin/cli-jobs
index 4d348fabb..f22e1068b 100755
--- a/bin/cli-jobs
+++ b/bin/cli-jobs
@@ -7,7 +7,7 @@
const program = require('./commander');
const scraper = require('../services/scraper');
const mailer = require('../services/mailer');
-const util = require('../util');
+const util = require('./util');
const mongoose = require('../services/mongoose');
const kue = require('../services/kue');
diff --git a/bin/cli-serve b/bin/cli-serve
index 0427dcf34..08b451904 100755
--- a/bin/cli-serve
+++ b/bin/cli-serve
@@ -2,13 +2,12 @@
const app = require('../app');
const program = require('./commander');
-const debug = require('debug')('talk:server');
const http = require('http');
const scraper = require('../services/scraper');
const mailer = require('../services/mailer');
const kue = require('../services/kue');
const mongoose = require('../services/mongoose');
-const util = require('../util');
+const util = require('./util');
/**
* Get port from environment and store in Express.
@@ -79,7 +78,7 @@ function onListening() {
let bind = typeof addr === 'string'
? `pipe ${ addr}`
: `port ${ addr.port}`;
- debug(`Listening on ${ bind}`);
+ console.log(`Listening on ${ bind}`);
}
/**
diff --git a/bin/cli-setup b/bin/cli-setup
index eaa2b90b1..185b04f01 100755
--- a/bin/cli-setup
+++ b/bin/cli-setup
@@ -9,7 +9,10 @@ const inquirer = require('inquirer');
const mongoose = require('../services/mongoose');
const SettingModel = require('../models/setting');
const SettingsService = require('../services/settings');
-const util = require('../util');
+const SetupService = require('../services/setup');
+const UsersService = require('../services/users');
+const util = require('./util');
+const errors = require('../errors');
// Register the shutdown criteria.
util.onshutdown([
@@ -29,60 +32,165 @@ program
// Setup the application
//==============================================================================
-SettingsService
- .init()
- .then((settings) => {
- if (program.defaults) {
- return settings.save();
- }
+const performSetup = () => {
- console.log('We\'ll ask you some questions in order to setup your installation of Talk.\n');
-
- return inquirer.prompt([
- {
- type: 'input',
- name: 'organizationName',
- message: 'Organization Name',
- default: settings.organizationName,
- validate: (input) => {
- if (input && input.length > 0) {
- return true;
- }
-
- return 'Organization Name is required.';
- }
- },
- {
- type: 'list',
- choices: SettingModel.MODERATION_OPTIONS,
- name: 'moderation',
- default: settings.moderation,
- message: 'Select a moderation mode'
- },
- {
- type: 'confirm',
- name: 'requireEmailConfirmation',
- default: settings.requireEmailConfirmation,
- message: 'Should emails always be confirmed'
- }
- ])
- .then((answers) => {
-
- // Update the settings that were changed.
- Object.keys(answers).forEach((key) => {
- if (answers[key] !== undefined) {
- settings[key] = answers[key];
- }
+ if (program.defaults) {
+ return SettingsService
+ .init()
+ .then(() => {
+ console.log('Settings created.');
+ console.log('\nTalk is now installed!');
+ util.shutdown();
+ })
+ .catch((err) => {
+ console.error(err);
+ util.shutdown(1);
});
+ }
- return settings.save();
+ // Get the current settings, we are expecing an error here.
+ return SettingsService
+ .retrieve()
+ .then(() => {
+
+ // We should NOT have gotten a settings object, this means that the
+ // application is already setup. Error out here.
+ throw errors.ErrSettingsInit;
+
+ })
+ .catch((err) => {
+
+ // If the error is `not init`, then we're good, otherwise, it's something
+ // else.
+ if (err !== errors.ErrSettingsNotInit) {
+ throw err;
+ }
+
+ })
+ .then(() => {
+
+ // Create the base settings model.
+ let settings = new SettingModel();
+
+ console.log('We\'ll ask you some questions in order to setup your installation of Talk.\n');
+
+ return inquirer.prompt([
+ {
+ type: 'input',
+ name: 'organizationName',
+ message: 'Organization Name',
+ default: settings.organizationName,
+ validate: (input) => {
+ if (input && input.length > 0) {
+ return true;
+ }
+
+ return 'Organization Name is required.';
+ }
+ },
+ {
+ type: 'list',
+ choices: SettingModel.MODERATION_OPTIONS,
+ name: 'moderation',
+ default: settings.moderation,
+ message: 'Select a moderation mode'
+ },
+ {
+ type: 'confirm',
+ name: 'requireEmailConfirmation',
+ default: settings.requireEmailConfirmation,
+ message: 'Should emails always be confirmed'
+ }
+ ])
+ .then((answers) => {
+
+ // Update the settings that were changed.
+ Object.keys(answers).forEach((key) => {
+ if (answers[key] !== undefined) {
+ settings[key] = answers[key];
+ }
+ });
+
+ console.log('\nWe\'ll ask you some questions about your first admin user.\n');
+
+ return inquirer.prompt([
+ {
+ type: 'input',
+ name: 'displayName',
+ message: 'Display Name',
+ filter: (displayName) => {
+ return UsersService
+ .isValidDisplayName(displayName, false)
+ .catch((err) => {
+ throw err.message;
+ });
+ }
+ },
+ {
+ name: 'email',
+ message: 'Email',
+ format: 'email',
+ validate: (value) => {
+ if (value && value.length >= 3) {
+ return true;
+ }
+
+ return 'Email is required';
+ }
+ },
+ {
+ name: 'password',
+ message: 'Password',
+ type: 'password',
+ filter: (password) => {
+ return UsersService
+ .isValidPassword(password)
+ .catch((err) => {
+ throw err.message;
+ });
+ }
+ },
+ {
+ name: 'confirmPassword',
+ message: 'Confirm Password',
+ type: 'password',
+ filter: (confirmPassword) => {
+ return UsersService
+ .isValidPassword(confirmPassword)
+ .catch((err) => {
+ throw err.message;
+ });
+ }
+ },
+ ]);
+ })
+ .then((user) => {
+
+ if (user.password !== user.confirmPassword) {
+ return Promise.reject(new Error('Passwords do not match'));
+ }
+
+ return SetupService.setup({
+ settings: settings.toObject(),
+ user: {
+ email: user.email,
+ displayName: user.displayName,
+ password: user.password
+ }
+ });
+ });
+ })
+ .then(({user}) => {
+ console.log('Settings created.');
+ console.log(`User ${user.id} created.`);
+ console.log('\nTalk is now installed!');
+ util.shutdown();
+ })
+ .catch((err) => {
+ console.error(err);
+ util.shutdown(1);
});
- })
- .then(() => {
- console.log('Talk is now installed!');
- util.shutdown();
- })
- .catch((err) => {
- console.error(err);
- util.shutdown(1);
- });
+};
+
+// Start tthe setup process.
+performSetup();
diff --git a/bin/cli-users b/bin/cli-users
index 072a143ee..01f46ad2e 100755
--- a/bin/cli-users
+++ b/bin/cli-users
@@ -9,7 +9,7 @@ const inquirer = require('inquirer');
const UsersService = require('../services/users');
const UserModel = require('../models/user');
const mongoose = require('../services/mongoose');
-const util = require('../util');
+const util = require('./util');
const Table = require('cli-table');
const validateRequired = (msg = 'Field is required', len = 1) => (input) => {
diff --git a/bin/commander.js b/bin/commander.js
index 2a3d1e363..ad346a911 100644
--- a/bin/commander.js
+++ b/bin/commander.js
@@ -2,7 +2,6 @@ const pkg = require('../package.json');
const dotenv = require('dotenv');
const fs = require('fs');
const program = require('commander');
-const util = require('../util');
// Perform rewrites to the runtime environment variables based on the contents
// of the process.env.REWRITE_ENV if it exists. This is done here as it is the
@@ -27,6 +26,10 @@ const parseArgs = require('minimist')(process.argv.slice(2), {
}
});
+/**
+ * If the config flag is present, then we have to load the configuration from
+ * the file specified. We will then load those values into the environment.
+ */
if (parseArgs.config) {
let envConfig = dotenv.parse(fs.readFileSync(parseArgs.config, {encoding: 'utf8'}));
@@ -35,8 +38,15 @@ if (parseArgs.config) {
});
}
-// If the `--pid` flag is used, put the current pid there.
+/**
+ * If the pid flag is present, then we have to create a pid file at the location
+ * specified.
+ */
if (parseArgs.pid) {
+ const util = require('./util');
+
+ console.log('Wrote PID');
+
util.pid(parseArgs.pid);
}
diff --git a/util.js b/bin/util.js
similarity index 100%
rename from util.js
rename to bin/util.js
diff --git a/client/coral-admin/src/AppRouter.js b/client/coral-admin/src/AppRouter.js
index 9c0f271cc..9721123fa 100644
--- a/client/coral-admin/src/AppRouter.js
+++ b/client/coral-admin/src/AppRouter.js
@@ -1,21 +1,25 @@
import React from 'react';
import {Router, Route, IndexRoute, browserHistory} from 'react-router';
-import ModerationContainer from 'containers/ModerationQueue/ModerationContainer';
-import CommentStream from 'containers/CommentStream/CommentStream';
-import Configure from 'containers/Configure/Configure';
import Streams from 'containers/Streams/Streams';
-import CommunityContainer from 'containers/Community/CommunityContainer';
+import Configure from 'containers/Configure/Configure';
import LayoutContainer from 'containers/LayoutContainer';
+import CommentStream from 'containers/CommentStream/CommentStream';
+import InstallContainer from 'containers/Install/InstallContainer';
+import CommunityContainer from 'containers/Community/CommunityContainer';
+import ModerationContainer from 'containers/ModerationQueue/ModerationContainer';
const routes = (
-
-
-
-
-
-
-
+
+ );
+};
+
+export default InitialStep;
diff --git a/client/coral-admin/src/containers/Install/components/Steps/FinalStep.js b/client/coral-admin/src/containers/Install/components/Steps/FinalStep.js
new file mode 100644
index 000000000..e549ebe63
--- /dev/null
+++ b/client/coral-admin/src/containers/Install/components/Steps/FinalStep.js
@@ -0,0 +1,20 @@
+import React from 'react';
+import styles from './style.css';
+import {Button} from 'coral-ui';
+import {Link} from 'react-router';
+
+const InitialStep = () => {
+ return (
+
+
+ Thanks for installing Talk! We sent an email to verify your email
+ address. While you finish setting the account, you can start engaging
+ with your readers now.
+
+ The remainder of the Talk installation will take about ten minutes.
+ Once you complete the following two steps, you will have a free
+ installation and provision of Mongo and Redis.
+