Installing Mozilla Talk (Coral Project)
Notes on how talk installation worked for me
Prerequisites
- Target blog (website) url: https://testblog.binarybuffer.com
- Domain to host comments software: https://talk-coral.binarybuffer.com
- OS: Ubuntu 16.04 LTS
- Docker version: 1.12.6
- Docker-compose version: 1.16.1
- Version of Talk docker image: coralproject/talk:3.4.0
Installation
First of all, you need to decide how access to talk server would be handled. Talk server exposes 5000 port in docker container for HTTP interface. I see following options:
- Expose port directly to the internet
- Bind this port only to localhost and then reverse-proxy it with something like nginx
I am not sure how to support SSL with option 1, and I am comfortable with SSL setup in pt 2, so that is the option I picked. Set up will look like this:
browser <---> HTTPS <---> talk-coral.binarybuffer.com (nginx) <---> HTTP <----> 127.0.0.1:5000 (talk)
- Create
dockerc-compose.yml
with following contents:Note that you have to specify Facebook app id and secret, otherwise it will refuse to startup because facebook login is enabled. As far as I can see there is no way to disable facebook login without specifying Plugin config via environment variable.version: '2' services: talk: image: coralproject/talk:3.4.0 restart: always ports: - "127.0.0.1:5000:5000" depends_on: - mongo - redis environment: - TALK_MONGO_URL=mongodb://mongo/talk - TALK_REDIS_URL=redis://redis - TALK_ROOT_URL=https://talk-coral.binarybuffer.com - TALK_JWT_SECRET=14iswearitisrandom - TALK_FACEBOOK_APP_ID=123 - TALK_FACEBOOK_APP_SECRET=test 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
- Start everything with
docker-compose up -d
- Modify nginx to proxy requests to Talk, you can add something like this in you nginx virtual host config:
Reload nginxlocation / { proxy_pass http://localhost:5000; include /etc/nginx/proxy_params; } location /api/v1/live { proxy_pass http://localhost:5000; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; include /etc/nginx/proxy_params; }
nginx -s reload
- Open browser and point it to
/admin/install
url, https://talk-coral.binarybuffer.com/admin/install in my case. You should see something like this Go ahead, click get started. Questions are pretty straightforward, make sure to specify correct domain on the last step. This is domain where your blog/site which will be using comments is hosted. In my case it is https://testblog.binarybuffer.com - When installation have finished. Navigate to
/admin/install
again and sign in with the account you just created. You should see something like this: Click on Configure and you will get the code which you need to use on your website: - If you are using hugo, just post it at the end of your post like this:
NOTE The url for the script generated by Talk is incorrect and missing second slash after protocol. I have raised a issue on the project.<div id="coral_talk_7653206149518315"></div> <script src="https://talk-coral.binarybuffer.com/embed.js" async onload=" Coral.Talk.render(document.getElementById('coral_talk_7653206149518315'), { talk: 'https://talk-coral.binarybuffer.com/' }); "></script>
Thats it. You now should be able to post comments and moderate them via interface. Now, lest take a look for an overhead for this page with and without comments.
- Without comments, when loading page in Chrome: 3 requests, 85.9 Kb transferred
- With comments, when loading page in Chrome: 14 requests, 693 Kb transferred. This is almost 5-times increase in number of requests and most 10 times increase in number of data transferred.
This is defintiely not that lightweight. I think the reason for that is that system is built on top of a lot of tech like GraphQL and other things, and they need to bring all those libraries. But I think that downloading 600Kb (it is after compression), to render under-5kb textx is a bit overkill. To put it into perspective. Lets say you have 100k new views (people did not visit your website before), this will generate 47 Gb of additonal traffic just for comments functionality alone. Now, this might be absolutely fine for your use case.
So, decision is yours.