Change Talk eviroment to production


#1

Hi! Great job with Talk guys!

I’ve just integrated Talk with my Ghost blog, using your documentation, installing from source, not from Docker.

The system is working perfectly, but it’s doing in development mode, using the config from the .env file, executing “yarn watch:server”. I can’t find any documentation about changing from development to production, and I don’t know what are the problems of running in development enviroment.

I’m trying to enable talk-plugin-google-auth plugin with no success (and without any visible errors) so I’m thinking of development eviroment. Could it be?

Lot of thanks for this great project


#2

Thank you for the kind words @tomascrespo! That’s awesome you’re using Talk - welcome aboard!

To change NODE_ENV to production, you can use this in your .env file: https://stackoverflow.com/questions/9198310/how-to-set-node-env-to-production-development-in-os-x

That shouldn’t affect Google Auth though, make sure that you’re adding the callback URL on the Google side.

From our docs:

You will need to enable the Google+ API in the dashboard and create credentials for a new OAuth client ID web application. The authorized JavaScript origin should be set to the Talk domain, and the authorized redirect URI should be set to http://<example.com>/api/v1/auth/google/callback. This is only required while the talk-plugin-google-auth plugin is enabled.

Configuration:

TALK_GOOGLE_CLIENT_ID (required) - The Google OAuth2 client ID for your Google login web app. You can learn more about getting a Google Client ID at the Google API Console.
TALK_GOOGLE_CLIENT_SECRET (required) - The Google OAuth2 client ID for your Google login web app. You can learn more about getting a Google Client ID at the Google API Console.


#3

Also make sure it’s enabled in your plugins.json file for both server and client.


#4

Hi @kgardnr, I added Google plugin in plugins.defaults.json, for both server and client, not in plugins.json. It looks easier. Is it correct? I’ve tried other simplier plugins,like talk-plugin-like and talk-plugin-love but it doesn’t change anything neither.

My plugins.defaults.json:

    {
      "server": [
        "talk-plugin-featured-comments",
        "talk-plugin-local-auth",
        "talk-plugin-profile-data",
        "talk-plugin-respect",
        "talk-plugin-google-auth",
        "talk-plugin-like",
        "talk-plugin-love"
      ],
      "client": [
        "talk-plugin-auth",
        "talk-plugin-author-menu",
        "talk-plugin-featured-comments",
        "talk-plugin-flag-details",
        "talk-plugin-ignore-user",
        "talk-plugin-local-auth",
        "talk-plugin-member-since",
        "talk-plugin-moderation-actions",
        "talk-plugin-permalink",
        "talk-plugin-profile-data",
        "talk-plugin-respect",
        "talk-plugin-sort-most-replied",
        "talk-plugin-sort-most-respected",
        "talk-plugin-sort-newest",
        "talk-plugin-sort-oldest",
        "talk-plugin-viewing-options",
        "talk-plugin-facebook-auth",
        "talk-plugin-google-auth",
        "talk-plugin-like",
        "talk-plugin-love"
      ]
    }

I think the correct way is make some simple plugin to work, like talk-plugin-love and then struggle with talk-plugin-google-auth. I don’t know what to put in the authorized redirect URI. Should I only replace example.com with my domain?

I’ve added the two required configuration vars in my .env file. It looks:

TALK_MONGO_URL=mongodb://127.0.0.1:27017/talk
TALK_REDIS_URL=redis://127.0.0.1:6379
TALK_ROOT_URL=http://talk.tomascrespo.com
TALK_PORT=3000
TALK_JWT_SECRET=password
TALK_GOOGLE_CLIENT_ID=16964mome3nktctakoj5mc810urt.apps.googleusercontom
TALK_GOOGLE_CLIENT_SECRET=6_ei1QylV
****

PD: Please, move the topic to Talk forum. I went wrong


#5

I’ve tried changing SET NODE_ENV=production and launch yarn watch:server and it start in development mode.

[root@centoscwp talk]# yarn watch:server
yarn run v1.12.3
$ nodemon --config .nodemon.json
[nodemon] 1.17.5
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: *.* bin/cli bin/cli-serve
[nodemon] starting `npm-run-all --parallel generate-introspection start:development`
$ WEBPACK=TRUE NODE_ENV=test ./scripts/generateIntrospectionResult.js
$ NODE_ENV=development ./bin/cli-serve -j -w
Outputted result of introspectionQuery to /home/talk/public_html/talk/client/coral-framework/graphql/introspection.json
Outputted result of introspectionQuery to /home/talk/public_html/talk/docs/source/_data/introspection.json
(node:18946) DeprecationWarning: current URL string parser is deprecated, and will be removed in a future version. To use the new parser, pass option { useNewUrlParser: true } to MongoClient.connect.
Dec 4 09:55:09 talk[18946] INFO:  serve (./serve:102): Setup is not currently available, migrations now being checked
  version: "4.6.7"
  origin: "jobs"
Dec 4 09:55:09 talk[18946] INFO:  serve (./serve:119): Migrations do not have to be run

Same result if I do export NODE_ENV=production
Same result too if I do NODE_ENV=production yarn watch:server

Always starts in development mode.

I think the way to start Talk in production is:
[root@centoscwp talk]# NODE_ENV=production ./bin/cli-serve -j -w
Or you can do it using yarn this way:
[root@centoscwp talk]# yarn start
I found this reading the scripts section at package.json file.

But I don’t know what are the differences between running it in development or production.


#6

Where you created the Google API Keys, at https://console.cloud.google.com/apis/credentials

  1. Click on the OAuth 2.0 client ID you created
  2. Check that it is Client ID for Web application
  3. Under Authorised redirect URIs
  4. Add http://<example.com>/api/v1/auth/google/callback
  5. Where example.com is YOUR domain you’re using the auth on, e.g. “localhost” for dev + “staging.domain” for staging + “domain” for prod

You’re not telling Google where you’re using this, so it’s not working.


#7

Add

NODE_ENV=production

to your .env file

And make sure you are loading this file either with something like dot-env, or by running source .env. And rebuild the app.


#8

Currently the problem is not the callback URI.
The problem is that the plugins I add to plugins.defaults.json are not been activated. Even the simplest plugins, like and love reactions are not activated.

Should I rebuild the app after add this plugins to plugins.defaults.json?
I only restart Talk


#9

You have 2 options here: https://docs.coralproject.net/talk/plugins#deployment-solutions

I assume you’re going the Source route, in which case:

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:

# get plugin dependencies and remote plugins
./bin/cli plugins reconcile

# build static assets (including enabled client side plugins)
yarn build

#10

Yes, I’m doing from source, not using Docker.

After doing ./bin/cli plugins reconcile andyarn build the plugins are activated and working. Like, love and even Google auth plugin is working perfectly. :blush: Lots of thanks for your help @kgardnr
However, I think is a bit strange having to recompile to enable plugins.

One more question. In your demo at https://lab.coralproject.net/ if you enable the reactions switch you get a cool set of reactions emoji (look attached pic). What plugins is that? I want it!!!


#11

Hurray!! I’m glad you got it working!

Ah, yes, so Talk does support emojis, but we don’t have shortcuts for it, e.g. :smile:. Not yet. If this is something you wanted to contribute, we’d love to have it! Otherwise, it will probably be a bit lower priority for our team as of now. That could change in 2019.


#12

shortcuts? I’m not speaking about shortcuts. I’m speaking about the reactions block, other than like and love.

Also, I can view in that demo webpage a switch to allow user using Pseudonyms, so they can use a meaninful name, not an username with no spaces. Currently, could I enable pseudonyms?


#13

Yeah, we don’t have that - if you copy and paste an emoji though it does work.

We don’t support pseudonyms or “display names” unless you’re using an outside auth system, but out of the box users can create any username they like, could be “kim_gardner”, could be “unknown543”.


#14

Also one thing to clarify about the Labs page you’re referring to: we built that before we built Talk, as a way to showcase our research and help users test different concepts.

Not all of the features made it into Talk (so far) - and Talk also has a lot of features that aren’t in the Labs!

The best place to look to find out more about Talks’ features are our docs, docs.coralproject.net and use the Labs only as an interesting thought experiment to learn more about the research behind different ideas in online community.

Thanks for installing Talk!

Andrew
Project Lead, The Coral Project


#15

Oh! Thanks @kgardnr and @andrew_coral. I thought lab was a demo of Talk current version


#16

Not at all - it’s over two years old! :smiley:

How did you find it? We don’t link to it anywhere on our site except in the Research section.


#17

I found it in this forum, here


#18

Only as a curiosity (and perhaps for docs)

I’ve just tried talk-plugin-facebook-auth, to allow my comenters could Google and Facebook to login, but Facebook login requires you use https in your site from 6 Oct 2018. So, if your site is not https you can’t use Facebook OAuth.