1 of 36

Rocket.Chat

Articles

2 of 36

Ghost Installation

Currently Ghost can be installed and setup from an npm package(ghost-cli) and Docker image.

For our version of Ghost a similar npm package(rc-ghost-cli) is created which will install and setup the modified version of Ghost(rc_ghost).�

Docker image uses ghost-cli package

Install from source code.

Uses ghost-cli

3 of 36

SideNav Articles Icon

Admin Panel for Articles

Set Title

Tokens for webhook calls

Enable

Url

4 of 36

API CALLBACKS

5 of 36

During Setup

Is ghost setup?

GET /ghost/api/v2/admin/authentication/setup

TRUE

FALSE

Redirects and open new tab with Ghost URL.

Is rc_uid and rc_token valid?

GET /api/v1/me

TRUE

Creates a new session for the user.

Setup Ghost

POST /api/v2/admin/auth..on/setup

TRUE

Redirects and open new tab with Ghost URL.

6 of 36

How User will be added and authenticated?

For adding user, Admin will have two options:

  • Invite-only: which will only Administrators to add users.
  • Invite-only(Disabled): which will allow all the RC users to create account, by a click on article icon on sidenav.

For Authentication:

  • rc_uid and rc_token will be used from the cookies.
  • Ghost server will verify it using RC API.
  • If verified, ghost session will be created.
  • So when a user is logged in on RC, he/she will be logged in on ghost.

Since Ghost will be using values from cookies, ghost server must be hosted under the domain RC.�E.g. RC: open.rocket.chat�Ghost: articles.open.rocket.chat

7 of 36

After setup, Redirections

Is ghost setup?

GET /ghost/api/v2/admin/authentication/setup

TRUE

FALSE

User exist?

GET /ghost/api/v2/admin/userexist

TRUE

Creates a new session for the user.

Is rc_uid and rc_token valid?

GET /api/v1/me

FALSE

Inviteonly setting in Ghost?

GET /ghost/api/v2/admin/invitesetting

FALSE

Add User

POST /api/v2/admin/auth...on/adduser

TRUE

8 of 36

LogOut

Destroy ghost session

DEL /ghost/api/v2/admin/session (with token in cookie)

9 of 36

Before Setup, if you visit the Ghost URL.

10 of 36

After Setup, if you visit the Ghost URL, w/o login in RC.

11 of 36

Public View

Setting options for Owner and Admin Only

12 of 36

Rocket.chat related settings

13 of 36

14 of 36

15 of 36

Roles in Ghost

  • Owner- There is only ever one owner of a Ghost site. The owner is a special user which has all the same permissions as an Administrator, The Owner can never be deleted.
  • Administrator- The top user level in Ghost is Administrator. Again, administrators can do everything that Authors and Editors can do, but they can also edit all site settings. Additionally, administrators have full access to add, manage or remove any other user of the site.
  • Editor- Editors are the 3rd user level in Ghost. Editors can do everything that an Author can do. Editors can also invite new Contributors to the site.
  • Author- Authors are the 2nd user level in Ghost. Authors can write, edit and publish their own posts. Authors are trusted users. If you don't trust users to be allowed to publish their own posts, they should be set as Contributors.
  • Contributor- This is the base user level in Ghost. Contributors can create and edit their own draft posts, but they are unable to publish posts. All the draft posts created by Contributors will have its parent user as Author. (Parent user is one who has added the contributor).

16 of 36

Roles in RC and Ghost

  • The Admin who setup ghost will have Owner access on Ghost.
  • All other users who create their account will have Authors role.
  • An admin in Ghost may not be an Admin in RC, vice-versa.

17 of 36

Since Editor and above can add users from RC, we are using token to fetch user details which contains users emails. As RC does not allow user to fetch another user’s email.

18 of 36

Parent editor of Contributor

19 of 36

Database syncing

Ghost will be using RC mongoDb directly(readonly), for the details which are required on Ghost side.

This way we don’t have to worry about datasync issue.

API will also be used along with Mongo.

Still we will use webhook callback for two functions:

  • For announcement of post.
  • If any user is deleted.

User profile details which are fetched from RC, will not be allowed to change in Ghost side.

20 of 36

Functions for RC interaction M: directly fetching from MongoDB, A: using RestAPI call.

getUser(M):

args- username/_id

It requires for the purpose of adding users in Ghost.

getMe(A):

args- _id, token

Used to verify if the userId and login token are correct. Requires during setup and creating user session.

getRoom(M):

args- _id/name

Used to validate the room to announce, or discussion room is fetched. Only roomId is stored in the Ghost DB, name/type is being fetched every time.

getSelfRoom(M/A):

args- _id

The direct room between user with him/herself. Need the id of the room to create Discussion room. First fetch will directly from M in subscriptions, if subscription doesn’t then API will be used to create one.

createDiscussion(A):

args- _id/token

API call is used to create discussion room with pid as fetched above.

validateSubscription(M):

args- rid, uid

To validate if a user is a member of a particular group.

21 of 36

22 of 36

Public View of Articles

23 of 36

To make the site private

This will allow only RC users and anyone with password to access the content.

24 of 36

For private Site

Password will be for the people who are not a member of RC, but want to access the site.�

For the members of RC, this authentication is not required, they will be authenticated from rc_uid and rc_token set in cookie by RC.

25 of 36

1) Post can be created in two mode: private, public:

  • private: only people from the announcing group/channel can access the post.
  • public: it will be available on the site.

2) But the post which are available on the site, will be available to internet users or only RC users will be decided by, if blog is private or not.

  • If the blog is private the only RC users & anyone with password will be able to access.
  • If the blog is public then any internet user will be able to access.

Post accessibility

26 of 36

Authors page

27 of 36

Author page

28 of 36

Creating new post

Collaboration allows other users from announcing room to collaborate on post.

Room to announce post

Collaborate with room

Private discussion

Announce the post

29 of 36

Post announcement message in channel/group

30 of 36

Customization message for announcement

31 of 36

Post View

32 of 36

Comment room in Iframe

33 of 36

Comment room is actually a discussion room with parent room as the direct room between user with himself/herself.

34 of 36

Scalability Limitation of Ghost

  • Current architecture of Ghost-Admin(where user will manage their content) is not very scalable. Ghost dropped postgreSQL, but it can be integrated easily, with the current architecture.
  • Current architecture does not work properly with multiple instance for one blog site.

MODIFICATIONS

  • Modifying the ghost to achieve such the scalability of RC.
  • Add PostgreSQL.
  • Allow to use multiple instance for a blog site:

35 of 36

Improving Scalability

36 of 36

Thank you