gRPC terminal chat
lets you easly host your own chat server and set up terminal chat clients with that one wierd friend
- Register user
- Send messages to other users
- Get messages from many users at once
- Get history of messages (Everyone have their own session)
- Send messages to user even if he is offline
- Catch up with messages after login
gRPC terminal chat
is the only tool that you need for human interacions.
- Python gRPC powers client-server calls
- Google protocolbuffers Unified declaration of messages and code generation
- ETCD highly avaible and fast storage
-
ETCD v2.3.7
-
Python 3.8+
-
grpcio-tools 1.51.1
-
python libs defined in requirements.txt files
Warning
Writing to your friends about your secrets and wet dreams could be foolish, Security wasn't addressed yet. 🚩
git clone https://github.com/Gregb122/grpc-terminal-chat.git
Install grpc-tools to generate code from proto files
python3 -m pip install grpcio-tools
and then in a root directory of the project:
python3 -m grpc_tools.protoc -I protobufs --python_out=. --pyi_out=. --grpc_python_out=. protobufs/common/*.proto
You should put valid path to python interpreter(1st arg)
cd grpc-terminal-chat
virtualenv -p /usr/bin/python3.8 python_3.8_virtualenv
then ctivate:
source python_3.8_virtualenv/bin/activate
Run etcd2, you can do this with docker:
docker run --name etcd2 -d -p 2379:2379 -p 2380:2380 -p 4001:4001 -p 7001:7001 -v ~/temp/data0/etcd:/data wolfdeng/etcd2-docker
And to check if ETCD instance is running:
etcdctl --endpoints=http://<ip_of_etcd:2379> ls
install required python libs from requirements.txt:
pip install -r chat_server/requirements.txt
run server:
Set ip address of your ETCD server as env variable:
export ETCD_SERVER_IP_ADDR=<etcd server ip>
python3 -m chat_server.src.main
docker-compose -f "docker_compose.yml" up
Install required python libs from requirements.txt:
pip install -r chat_client/requirements.txt
To start the interactive program with default args, simply run:
python3 -m chat_client.src.main
grpc-terminal-chat
was built with terminal in mind. You often can quit current scope by typing /q. Remember to register before login.
pip install tox
Run tests and code coverage
tox -e py
You can generate html file from coverage raport
coverage html -i
You can use SonarQube, to install follow official docs:
Set project-key to:
grpc-terminal-chat
After project creation set up env variables
export SONAR_RUN_HOST_URL=<server url:port>
export SONAR_RUN_LOGIN=<server token>
Then, just run:
sonar-scanner