Topics:
- ⚙️ Rust
- 🟨 Hyper
- 🟥 Redis
- 🐳 Docker
docker --version
# Docker version 19.03.8, build afacb8b
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
rustc --version
# rustc 1.44.1 (c7087fe00 2020-06-17)
rustup --version
# rustup 1.21.1 (7832b2ebe 2019-12-20)
cargo version
# cargo 1.44.1 (88ba85757 2020-06-11)
A local Redis container, running on localhost:6379
docker pull bitnami/redis
# This will eat your terminal
docker run --rm --name redis \
-e ALLOW_EMPTY_PASSWORD=yes \
-p 6379:6379 \
bitnami/redis
# ctrl+c to stop
Install the redis-cli
brew install redis
redis-cli --version
# redis-cli 6.0.5
Save your terminal
# Run docker in detached mode
docker run --rm --name redis \
-e ALLOW_EMPTY_PASSWORD=yes \
-d -it -p 6379:6379 bitnami/redis
# Stop the container
docker stop redis
Database GUI? Visit redis://127.0.0.1:6379 in a browser. On my machine, I get prompted to open TablePlus.
# Run with:
cargo run
# Run with hot reloading:
systemfd --no-pid -s http::3000 -- cargo watch -x run
# Find previous task on a port
netstat -vanp tcp | grep 3000
docker build --rm -t rust-websocket-server .
docker images
docker run --rm \
--name rrd \
-p 3000:3020\
rust-websocket-server:latest
Remove those pesky <none>
images when building new images
# fish-shell
docker rmi (docker images -f 'dangling=true' -q)
# fish-shell
docker rm (docker ps -a -q)
curl -X POST http://localhost:3000/echo/uppercase -d "poop"