A chatserver written in python
Project description
Chat Server
A simple chat server written in python
TLS Certificates
Setup is only currently required if you want to use tls. To do this you need to generate a crt and key file.
mkdir certs
cd certs
openssl req -newkey rsa:2048 -nodes -keyout chatserv.key -x509 -days 365 -out chatserv.crt
Running The Server
Pip
You can install chatserver using pip.
pip install --upgrade chatserver
chatserver
Build Locally
Make sure poetry is installed and up to date.
pip install --upgrade poetry
Install all the dependencies
poetry install
You can now run the project from outside poetry's virtual env
poetry run chatserver
Or from within it
chatserver
If you want to use TLS you need to set environment variables>
CERT_FILE
KEY_FILE
With Docker
You can either build locally or use the image from the registry
# Build locally
docker build -t chatserver .
docker run --name chatserver_name -p 7878:7878 chatserver
# Using the image from the registry
docker build -t chatserver .
docker run --name chatserver_name -p 7878:7878 registry.gitlab.com/mokytis/python-chatserver:latest
To use tls you will need to mount a direcory containg the crt and key files and set enviornment variables.
Example:
docker run -i -t -d \
-p 7878:7878 \
-v /path/to/certs/directory:/certs \
-e CERT_FILE='/certs/chatserv.crt' \
-e KEY_FILE='/certs/chatserv.key' \
--name chatserver
chatserver
Connecting To The Server
No TLS
If the server is not using tls you can connect to the server using any TCP client.
nc localhost 7878
TLS
If the server is using TLS you can connect using openssl
openssl s_client -connect localhost:7878
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file chatserver-0.1.2.tar.gz
.
File metadata
- Download URL: chatserver-0.1.2.tar.gz
- Upload date:
- Size: 4.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.0.3 CPython/3.8.0 Linux/5.0.0-38-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 351a0df1664f22694062c4647056b573d120e93043b685a159f8ee9c631ab4a5 |
|
MD5 | a674d8b6036b6e91960d4671b0486112 |
|
BLAKE2b-256 | e26b09fac3155ab95dbb179ffd3a95d24780dc21c6b9b891176f24f402b922a8 |
Provenance
File details
Details for the file chatserver-0.1.2-py3-none-any.whl
.
File metadata
- Download URL: chatserver-0.1.2-py3-none-any.whl
- Upload date:
- Size: 4.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.0.3 CPython/3.8.0 Linux/5.0.0-38-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 21c1a0154a936513f454ad73119e46f371e9a6a7907b67a1c0142b3828557b81 |
|
MD5 | 3c5c23b050309aa0cd37e0da0f3454cf |
|
BLAKE2b-256 | 2f081fc1a3b3cea6019e18a814299f7e2c61dd5cefdec8922cb7ea9841c213e6 |