If you answered "yes" to any of these rhetorical questions, then this project is for you! Host and manage a poker game from the comfort of your computer with pri♦ate_p♡ker (or pp for short)! Get started with any of the following artifacts:
ssh
One can host a server within a Docker container for the following benefits:
ssh
Host and manage poker over ssh
with the following commands:
Run the container (two options):
From source:
docker build -t poker .
docker run -d --name poker -p $port:22 --rm poker
From the official Docker image:
docker run -d --name poker -p $port:22 --rm ognf/poker:latest
Create a user:
docker exec poker ./create_user $username
This creates a user in the container's user space and adds the user
to a group that enables the user to send their own public ssh
key
to the server.
Users can then create an ssh
key pair and copy their public key to
the server:
ssh-keygen -q -t rsa -b 4096 -N "" -f ~/.ssh/poker_id_rsa
export PUBLIC_KEY="$(cat ~/.ssh/poker_id_rsa.pub)"
ssh -i ~/.ssh/poker_id_rsa -o SendEnv=PUBLIC_KEY -p $port $username@$host
If congratulated with a Success
message, subsequent ssh
commands
will result in the user being greeted by the poker TUI. Users also no
longer have to specify the SendEnv
option in subsequent ssh
commands:
ssh -i ~/.ssh/poker_id_rsa -p $port $username@$host
(Optionally) Create a tmux session in the container for managing poker bots:
docker exec poker tmux new-session -d -s bots ./pp_bots
You can reattach to the session to manage the bots with a TUI:
docker exec -it poker tmux attach -t bots
Delete a user:
docker exec poker ./delete_user $username
Stop the server:
docker stop poker
The poker over ssh
Docker image is < 40MB, but requires some additional
user management on the host's part. If you're playing a poker game in a
local or private network, and all your users are familiar with cargo
,
it's less work to just use the poker binaries directly rather than using
Docker and ssh
.
From source:
For the host, run the server binary:
RUST_LOG=info cargo run --bin pp_server -r -- --bind $host
For users, run the client binary:
cargo run --bin pp_client -r -- $username --connect $host
From crates.io:
For the host, install and run the server:
cargo install pp_server
RUST_LOG=info pp_server --bind $host
For users, install and run the client:
cargo install pp_client
pp_client $username --connect $host
See each subdirectory's docs or README.md
s for more specific info.
.
├── pp_admin # Scripts and configs for managing the server within Docker
├── pp_bots # Bots binary source
├── pp_client # Client binary source
├── pp_server # Server binary source
└── private_poker # Library that the client and server use
I use this project to learn Rust and to play poker with friends and family. I'm probably disinterested in anything related to this project that doesn't contribute to those goals. Specifically, the following features are omitted from this project and left as an exercise for forkers:
ssh-chat