Skip to content

gabrielkryss/rust-production-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rust Production Server

This is my repo to practice and learn production coding. A place where I experiment and figure out how to make a production grade web server from scartch. Hence this repo will slowly evolve as I learn new practices and learning how to implement them in Rust.

References and Resources

Much appreciation and thanks to Jeremy Chone and his production coding tutorial series! I learned a tremendous ammount from his tutorial series as well as discussing software development with him on his discord server. Needlesss to say, his material is a main inspiration for this on going project

Future work

Evenetually I'd like to deploy a k8s cluster with this repo but I am currently learning Kubernetes.

Starting the DB

# Start postgresql server docker image:
docker run --rm --name pg -p 5432:5432 \
   -e POSTGRES_PASSWORD=welcome \
   postgres:15

# (optional) To have a psql terminal on pg. 
# In another terminal (tab) run psql:
docker exec -it -u postgres pg psql

# (optional) For pg to print all sql statements.
# In psql command line started above.
ALTER DATABASE postgres SET log_statement = 'all';

Dev (watch)

NOTE: Install cargo watch with cargo install cargo-watch.

# Terminal 1 - To run the server.
cargo watch -q -c -w crates/services/web-server/src/ -w crates/libs/ -w .cargo/ -x "run -p web-server"

# Terminal 2 - To run the quick_dev.
cargo watch -q -c -w crates/services/web-server/examples/ -x "run -p web-server --example quick_dev"

Dev

# Terminal 1 - To run the server.
cargo run -p web-server

# Terminal 2 - To run the tests.
cargo run -p web-server --example quick_dev

Unit Test (watch)

cargo watch -q -c -x "test -- --nocapture"

# Specific test with filter.
cargo watch -q -c -x "test -p lib-core test_create -- --nocapture"

Unit Test

cargo test -- --nocapture

cargo watch -q -c -x "test -p lib-core model::task::tests::test_create -- --nocapture"

Tools

cargo run -p gen-key


More resources for Rust for Production Coding

This repo on GitHub

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published