tuna/fishroom

Name: fishroom

Owner: Tsinghua University TUNA Association

Description: Message forwarding for multiple IM protocols

Created: 2015-07-12 16:32:29.0

Updated: 2018-05-24 13:14:29.0

Pushed: 2018-05-23 17:51:21.0

Homepage: null

Size: 272

Language: Python

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

fishroom

Proudly Powered by Python3

Message forwarding for multiple IM protocols

Motivation

TUNA needs a chatroom, while each IM protocol/software has its own implementation for chatroom.

Unlike email and mailing list, instant messaging is fragmented: everyone prefers different softwares. As a result, people of TUNA are divided by the IM they use, be it IRC, wechat, telegram, or XMPP.

To reunify TUNA, we created this project to relay messages between IM clients, so that people can enjoy a big party again.

Supported IMs
Basic Architecture

Fishroom consists of a fishroom core process, which routes messages among IMs and process commands, and several IM handler processes to deal with different IMs. These components are connected via Redis pub/sub.

-------+
C      |<-+
-------+  |
-------+  |
PP     |<-+
-------+  |
-------+  |    +-------+       +---------------+
legram |<-+--> | Redis | <---> | Fishroom Core |
-------+  |    +-------+       +---------------+
-------+  |
tter   |<-+
-------+  |
-------+  |
b      |<-+
-------+
How to Use

Clone me first

clone https://github.com/tuna/fishroom
ishroom
Docker Rocks!

Get a redis docker and run it:

er pull redis:alpine
er run --name redis -v /var/lib/redis:/data -d redis:alpine

Modify the config file, and remember the redis hostname you specified in config.py. I suggest that just use redis as the hostname.

ishroom/config.py.example fishroom/config.py
fishroom/config.py

Modify Dockerfile, you may want to change the sources.list content. Build the docker for fishroom:

er build --tag fishroom:dev .

Since the code of fishroom often changes, we mount the code as a volume, and link redis to it.

You can test it using

is is fishroom core
er run -it --rm --link redis:redis -v /path/to/fishroom/fishroom:/data/fishroom fishroom:dev python3 -u -m fishroom.fishroom

ese are fishroom IM interfaces, not all of them are needed
er run -it --rm --link redis:redis -v /path/to/fishroom/fishroom:/data/fishroom fishroom:dev python3 -u -m fishroom.telegram
er run -it --rm --link redis:redis -v /path/to/fishroom/fishroom:/data/fishroom fishroom:dev python3 -u -m fishroom.IRC
er run -it --rm --link redis:redis -v /path/to/fishroom/fishroom:/data/fishroom fishroom:dev python3 -u -m fishroom.gitter
er run -it --rm --link redis:redis -v /path/to/fishroom/fishroom:/data/fishroom fishroom:dev python3 -u -m fishroom.xmpp

You may need tmux or simply multiple terminals to run the aforementioned foreground commands.

If everything works, we run it as daemon.

er run -d --name fishroom --link redis:redis -v /path/to/fishroom/fishroom:/data/fishroom fishroom:dev python3 -u -m fishroom.fishroom
er run -d --name fishroom --link redis:redis -v /path/to/fishroom/fishroom:/data/fishroom fishroom:dev python3 -u -m fishroom.telegram

To view the logs, use

er logs fishroom

Next we run the web interface, if you have configured the chat_logger part in config.py.

er run -d --name fishroom-web --link redis:redis -p 127.0.0.1:8000:8000 -v /path/to/fishroom/fishroom:/data/fishroom fishroom:dev python3 -u -m fishroom.web

Open your browser, and visit http://127.0.0.1:8000/, you should be able to view the web UI of fishoom.

Docker Sucks!

Install and run redis first, assuming you use ubuntu or debian.

get install redis

Modify the config file, the redis server should be on addr 127.0.0.1 and port 6379.

ishroom/config.py.example fishroom/config.py
fishroom/config.py

Ensure your python version is at least 3.5, next, we install the dependencies for fishroom.

get install -y python3-dev python3-pip libmagic1 libjpeg-dev libpng-dev libwebp-dev zlib1g-dev gcc
 install --upgrade pip setuptools
 install -r requirements.txt

Run fishroom and fishroom web.

n fishroom core
on3 -m fishroom.fishroom

art IM interfaces, select not all of them are needed
on3 -m fishroom.telegram
on3 -m fishroom.IRC
on3 -m fishroom.gitter
on3 -m fishroom.xmpp

on3 -m fishroom.web

Open your browser, and visit http://127.0.0.1:8000/, you should be able to view the web UI of fishoom.

Good Luck!

Related Projects
LICENSE
 program is free software: you can redistribute it and/or modify
nder the terms of the GNU Affero General Public License as published
he Free Software Foundation, either version 3 of the License, or
your option) any later version.

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.