- git_sync_command
- compile_time_git_info
- enum_extension
- macros_helpers
- svg_component
- client
- common
- tufa_grpc_client
- tufa_grpc_server
- server
- telegram_bot
- error_occurence
- from_sqlx_postgres_error
- from_str
- type_variants_from_reqwest_response
- generate_quotes
- postgresql_crud
- error_occurence_lib
- config
cargo install --locked trunk
rustup target add wasm32-unknown-unknown
trunk serve
https://github.com/Alexandre-Borghi/yew-highlighting
sudo apt install cmake
sudo apt install cmake
- simple route request
- get_providers_posts route request
- change project config
- change tests constants
- start docker daemon
- build docker container (maybe some steps can be ignored)
- run docker container
- stop docker container
- remove docker container
- remove all unused right now docker containers and images
- run containers with docker-compose
- stop containers with docker-compose
- default docker volumes folder on linux
- pull and run mongodb docker container
- start mongodb docker container
- create new rust library
- pull and run postgres docker container
- start postres docker container
- shutdown wsl(if db clients cannot connect to db in wsl2)
- give priviligies to volumes folder
- start command
- run ci tests
- run local tests
- show tree visualization of a dependency graph
- how to tune rustfmt
- check vulnerabilities in project
- fix Error: I/O error: Permission denied (os error 13) error
- cargo watch
- install custom linker dependencies
- start deleopment
- pull redis image
- launch Postgres
- install sqlx-cli
- example add sqlx migration
- how to use logger
- subscribe route test (change email and name))
- how to install remove unused dependencies tool
- how to install logs formatter?
- docker build
- Generate query metadata to support offline compile-time verification
- run docker container
- smaller rust docker builds
- ignore Digital Ocean for now
- ignore How to get started with postmark
- property-based testing
- if tests will be more than 1024
- Error: I/O error: Permission denied (os error 13) fix
- The script needs to be marked as executable and then launched
- see logs with cargo test
- run integration tests
- run unit tests
- run continious integration tests
- links
curl http://127.0.0.1:8080/kekw/index.html
curl http://127.0.0.1:8080/get_providers_posts/
./env
.libs/config_lib/src/get_project_information/project_constans.rs
sudo dockerd
rustup install nightly
rustup target add x86_64-unknown-linux-musl
cargo +nightly build --release
sudo docker build -t server-image .
docker run --env-file .env --name server-container -p 8000:8000 --rm -it server-image
sudo docker stop server-container
sudo docker rm server-container
sudo docker system prune -f
sudo docker-compose up -d
sudo docker-compose down
/var/lib/docker/volumes
(need to write path to your project directory)
sudo docker run -p 27017:27017 --name mongo-tufa-wsl2 -v ~/projects/server/mongodb_volume:/data/db -d mongo:latest
with docker:
sudo docker start mongo-tufa-wsl2
with docker-compose(other services too):
sudo docker-compose -f docker-compose.yml up -d
cargo new example_lib --lib
sudo docker run -p 5432:5432/tcp --name postgres-tufa-wsl2 -v ~/db-volumes/postgresql-volumes/tufa-dev-volume -e POSTGRES_PASSWORD=postgres -d postgres:latest
with docker:
sudo docker start postgres-tufa-wsl2
with docker-compose(other services too):
sudo docker-compose -f docker-compose.yml up -d
windows console:
wsl --shutdown
then reopen wsl
sudo chown -R username /folderexample
(/db-volumes/mongodb or postgresql)
cd libs/tests_lib && cargo test local && cd .. && cd .. && cargo run
cd libs/tests_lib && cargo test ci -- --show-output
cd libs/tests_lib && cargo test local -- --show-output
cargo tree
You can tune rustfmt for a project with a configuration file, rustfmt.toml.
Details can be found in rustfmt’s
cargo-audit, a convenient cargo sub-command to check if vulnerabilities have
been reported for any of the crates in the dependency tree of your project.
installation:
cargo install cargo-audit
usage:
cargo audit
cd .. sudo chmod -R 777 server && cd server
cargo watch -x check -x test -x "run | bunyan"
cargo watch -q -x run
page
On Windows:
cargo install -f cargo-binutils
rustup component add llvm-tools-preview
[target.x86_64-pc-windows-msvc]
rustflags = ["-C", "link-arg=-fuse-ld=lld"]
[target.x86_64-pc-windows-gnu]
rustflags = ["-C", "link-arg=-fuse-ld=lld"]
On Linux:
Ubuntu
sudo apt-get install lld clang
Arch
sudo pacman -S lld clang
[target.x86_64-unknown-linux-gnu]
rustflags = ["-C", "linker=clang", "-C", "link-arg=-fuse-ld=lld"]
On MacOS
brew install michaeleisel/zld/zld
[target.x86_64-apple-darwin]
rustflags = ["-C", "link-arg=-fuse-ld=/usr/local/bin/zld"]
[target.aarch64-apple-darwin]
rustflags = ["-C", "link-arg=-fuse-ld=/usr/local/bin/zld"]
cargo watch -x check -x test -x "run"
sudo docker pull redis
sudo ./scripts/init_db.sh
(sudo coz got pesmission denied error)
cargo install --version=0.5.7 sqlx-cli --no-default-features --features postgres
sqlx migrate add create_subscriptions_table
log provides five macros: trace, debug, info, warn and error. RUST_LOG=debug cargo run, for example, will surface all logs at debug-level or higher emitted by our application or the crates we are using. RUST_LOG=session_based_authentication, instead, would filter out all records emitted by our dependencies.
curl -i -X POST -d '[email protected]&name=Tom' http://127.0.0.1:8000/subscriptions
cargo install cargo-udeps
usage:
cargo +nightly udeps
cargo install bunyan
sudo docker build --tag session_based_authentication --file Dockerfile .
sqlx prepare
or
cargo sqlx prepare -- --lib
(to use generated .json query data - env var SQLX_OFFLINE must be true)
sudo docker run -p 8000:8000 session_based_authentication
We could go even smaller by using rust:1.59.0-alpine, but we would have to cross-compile to the linux-musl target - out of scope for now. Check out rust-musl-builder if you are interested in generating tiny Docker images. Another option to reduce the size of our binary further is stripping symbols from it - you can find more information about it here.
There are two mainstream options for property-based testing in the Rust ecosystem: quickcheck and proptest.
If you have large test suite with a flat file structure, you'll soon be building tens of executable every time you run cargo test. While each executable is compiled in parallel, the linking phase is instead entirely sequential! Bundling all your test cases in a single executable reduces the time spent compiling your test suite in CI3. If you are running Linux, you might see errors like
thread 'actix-rt:worker' panicked at 'Can not create Runtime: Os { code: 24, kind: Other, message: "Too many open files" }',
when you run cargo test after the refactoring. This is due to a limit enforced by the operating system on the maximum number of open file descriptors (including sockets) for each process - given that we are now running all tests as part of a single binary, we might be exceeding it. The limit is usually set to 1024, but you can raise it with ulimit -n X (e.g. ulimit -n 10000) to resolve the issue.
sudo chown -R $(whoami) session_based_authentication/
chmod +x ./scripts/init_redis.sh ./script/init_redis.sh
cargo test -- --nocapture
cargo test integration
(integration tests will fail if they run with unit tests)
cargo test unit
cargo test ci
cargo run -q | bunyan
RUST_LOG=info TELOXIDE_TOKEN="" cargo run
cargo install cargo-run-script
cargo run-script *script name*