mirror of
https://github.com/wassname/talk.git
synced 2026-07-17 11:33:39 +08:00
* Update version-5-installation.md
The command `npm run start` doesn't work locally following these directions, but `npm run start:development` does. Based on the package.json commands, the `:development` command seems reasonable:
```
"start": "NODE_ENV=production node dist/index.js",
"start:development": "NODE_ENV=development CONCURRENCY=${CONCURRENCY:-1} TS_NODE_PROJECT=./src/tsconfig.json ts-node-dev --inspect --transpile-only --no-notify -r tsconfig-paths/register ./src/index.ts",
```
Here's the output I received from `npm run start`:
```
Hanss-MBP:talk [redacted]$ npm run start
> @coralproject/talk@5.4.0 start /Users/[redacted]/workspace/talk
> NODE_ENV=production node dist/index.js
{"name":"coral","clusterNode":"master","hostname":"[redacted].com","pid":25656,"level":50,"err":{"message":"SIGNING_SECRET is required in production environments","name":"Error","stack":"new Server (src/core/server/index.ts:126:15)\nObject.createCoral [as default] (src/core/index.ts:10:10)\nbootstrap (src/index.ts:76:20)\nObject.bootstrap (src/index.ts:109:1)\nModule._compile (internal/modules/cjs/loader.js:959:30)\nObject.Module._extensions..js (internal/modules/cjs/loader.js:995:10)\nModule.load (internal/modules/cjs/loader.js:815:32)\nFunction.Module._load (internal/modules/cjs/loader.js:727:14)\nFunction.Module.runMain (internal/modules/cjs/loader.js:1047:10)\ninternal/main/run_main_module.js:17:11\n"},"msg":"can not bootstrap server","time":"2019-12-20T23:27:38.314Z","src":{"file":"/Users/[redacted]/workspace/talk/src/index.ts","line":104,"func":"error"},"v":0}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @coralproject/talk@5.4.0 start: `NODE_ENV=production node dist/index.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @coralproject/talk@5.4.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/[redacted]/.npm/_logs/2019-12-20T23_27_38_335Z-debug.log
```
* fix: expanded on docs
Co-authored-by: Wyatt Johnson <accounts+github@wyattjoh.ca>
137 lines
3.9 KiB
Markdown
137 lines
3.9 KiB
Markdown
---
|
|
title: Installing Version 5
|
|
permalink: /
|
|
---
|
|
|
|
Online comments are broken. Our open-source commenting platform, Coral, reimagines
|
|
moderation, comment display, and conversation. Use Coral to add safer, smarter discussions to your site without giving away your data.
|
|
|
|
More than 70 publishers in 14 countries trust Coral to run their on-site communities, including the Washington Post, the Wall Street Journal, and Der Spiegel.[Read more about Coral here](https://coralproject.net/).
|
|
|
|
<div class="callout">
|
|
We offer hosting and support packages for Coral, as well as exclusive, customer-only resources. [Contact us for more information.](https://coralproject.net/pricing/)
|
|
</div>
|
|
|
|
Built with ❤️ by Coral by [Vox Media](https://product.voxmedia.com/).
|
|
|
|
Try out a test version of Coral by running it via a Heroku App:
|
|
|
|
[](https://heroku.com/deploy?template=https://github.com/coralproject/talk)
|
|
|
|
## Requirements
|
|
|
|
- MongoDB >=4.2
|
|
- Redis >=3.2
|
|
- NodeJS >=12
|
|
- NPM >=6.7
|
|
|
|
## Running
|
|
|
|
You can install Coral 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:5](https://hub.docker.com/r/coralproject/talk) image.
|
|
|
|
### Docker
|
|
|
|
The easiest way to get started with Coral 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 <<EOF
|
|
version: "2"
|
|
services:
|
|
talk:
|
|
image: coralproject/talk:5
|
|
restart: always
|
|
ports:
|
|
- "127.0.0.1:3000:5000"
|
|
depends_on:
|
|
- mongo
|
|
- redis
|
|
environment:
|
|
- MONGODB_URI=mongodb://mongo:27017/coral
|
|
- REDIS_URI=redis://redis:6379
|
|
- SIGNING_SECRET=<replace me with something secret>
|
|
mongo:
|
|
image: mongo:4.2
|
|
volumes:
|
|
- ./data/mongo:/data/db
|
|
redis:
|
|
image: redis:3.2
|
|
volumes:
|
|
- ./data/redis:/data
|
|
EOF
|
|
|
|
# Start up Coral using Docker.
|
|
docker-compose up -d
|
|
```
|
|
|
|
Then head on over to http://localhost:3000 to install Coral!
|
|
|
|
### Source
|
|
|
|
Coral requires NodeJS >=12, we recommend using `nvm` to help manage node
|
|
versions: https://github.com/creationix/nvm.
|
|
|
|
```bash
|
|
# Clone and cd into the Coral directory.
|
|
git clone https://github.com/coralproject/talk.git
|
|
cd talk
|
|
|
|
# Install dependencies.
|
|
npm install
|
|
|
|
# Build the application dependencies.
|
|
# This might take a while.
|
|
npm run build
|
|
```
|
|
|
|
This should output all the compiled application code to `./dist`.
|
|
|
|
Running Coral with default settings assumes that you have:
|
|
|
|
- MongoDB >=4.2 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 execute the following
|
|
assuming you have Docker installed on your local machine:
|
|
|
|
```bash
|
|
docker run -d -p 27017:27017 --restart always --name mongo mongo:4.2
|
|
docker run -d -p 6379:6379 --restart always --name redis redis:3.2
|
|
```
|
|
|
|
Then start Coral with:
|
|
|
|
```bash
|
|
# Start the server in development mode.
|
|
npm run start:development
|
|
```
|
|
|
|
Then head on over to http://localhost:3000 to install Coral!
|
|
|
|
Note that if you want to run Coral in production from source, you'll need to
|
|
create a secret for signing that differs from the unsafe default. You can do
|
|
this by using something like `openssl rand -base64 32`. You can then place this
|
|
secret in a `.env` file in your `talk` directory as such:
|
|
|
|
```bash
|
|
SIGNING_SECRET=<replace me with something secret>
|
|
```
|
|
|
|
You can then run Coral with the production command instead:
|
|
|
|
```bash
|
|
# Start the server in production mode.
|
|
npm run start
|
|
```
|