Git Product home page Git Product logo

ens-reminder's Introduction

Rust project template

lines of code dependency status codecov Build, Test & Deploy

Features

Continuous Integration

  • Build, test and deploy
    • Run rustfmt, clippy and doc build

Main features. Comes with the kitchen sink. Remove what you don't need.

  • Command line argument parsing using StructOpt.
  • Version info including commit hash.
  • Error handling using anyhow and thiserror.
  • Logging using tracing with log and futures compatibility, -v, -vv, etc. command line arguments.
  • Preloaded with serde, rand, rayon, itertools.
  • Tests using proptest, pretty_assertions and float_eq. I recommend the closure style proptests.
  • Benchmarks using criterion (run cargo criterion).
  • Dependencies build optimized, also in dev build.
  • From scratch Docker build statically linked to musl.

Deployment

Using GitHub actions for each PR it will push a Docker container image to the Github container registry. A Helm chart is included for easy deployment to Kubernetes clusters. The ingress rule assumes a Traefik frontend.

Todo: Tutorial using: https://github.com/redkubes/otomi-core

Hints

Lint, build, test, run

cargo fmt && cargo clippy --all-targets --all-features && cargo build --all-targets --all-features && cargo test && cargo run --

Run benchmarks

cargo bench --bench criterion --features="bench proptest"

How to use the template

Update Cargo.toml and regenerate deploy/Chart.yaml from it using the included script:

./deploy/generate.py > ./deploy/Chart.yaml

Change the name of the crate from rust_service_template to the new name in ./criterion.rs and ./src/cli/main.rs.

Implement your service in src/lib.rs.

If your service makes outbound connections, add egress rules to deploy/templates/network-policy.yaml.

Deploy using Helm on a Kubernetes cluster using Traefik for ingress management.

To do

Copy from Tokio:

  • Add license, contributing, and other changelogs

  • Rustdocs with Katex.

  • Long running / fuzz mode for proptests.

  • loom support for concurrency testing, maybe simulation.

  • Add crates.io publishing

Build images locally

for arch in x86_64 aarch64; do
  docker run --rm \
    -v "$(pwd)":/src \
    -v $HOME/.cargo:/usr/local/cargo:Z \
    -v /usr/local/cargo/bin \
    ghcr.io/recmo/rust-static-build:1.58-$arch \
    cargo build --locked --release --features mimalloc
done
for arch in amd64 arm64; do
  docker build --platform linux/$arch --tag rust-service-template:latest-$arch .
done
docker manifest rm ghcr.io/recmo/rust-service-template:latest
docker manifest create \
    rust-service-template:latest \
    rust-service-template:latest-amd64 \
    rust-service-template:latest-arm64
docker manifest inspect rust-service-template:latest

ens-reminder's People

Contributors

zepedroresende avatar

Watchers

James Cloos avatar  avatar

ens-reminder's Issues

RUSTSEC-2021-0139: ansi_term is Unmaintained

ansi_term is Unmaintained

Details
Status unmaintained
Package ansi_term
Version 0.12.1
URL ogham/rust-ansi-term#72
Date 2021-08-18

The maintainer has adviced this crate is deprecated and will not
receive any maintenance.

The crate does not seem to have much dependencies and may or may not be ok to use as-is.

Last release seems to have been three years ago.

Possible Alternative(s)

The below list has not been vetted in any way and may or may not contain alternatives;

See advisory page for additional details.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.