GithubHelp home page GithubHelp logo

packtpublishing / hands-on-microservices-with-rust Goto Github PK

View Code? Open in Web Editor NEW
357.0 21.0 116.0 4.16 MB

Hands-On Microservices with Rust 2018, published by Packt

License: MIT License

Rust 90.02% Shell 2.72% Smarty 0.14% HTML 4.20% JavaScript 1.34% Dockerfile 1.10% PLpgSQL 0.49%

hands-on-microservices-with-rust's Introduction

Hands-On Microservices with Rust

Hands-On Microservices with Rust

This is the code repository for Hands-On Microservices with Rust, published by Packt.

Build, test, and deploy scalable and reactive microservices with Rust 2018

What is this book about?

Microservice architecture is sweeping the world as the de facto pattern for building web-based applications. Rust is a language particularly well-suited for building microservices. It is a new system programming language that offers a practical and safe alternative to C.

This book covers the following exciting features:

  • Get acquainted with leveraging Rust web programming
  • Get to grips with various Rust crates, such as hyper, Tokio, and Actix
  • Explore RESTful microservices with Rust
  • Understand how to pack Rust code to a container using Docker
  • Familiarize yourself with Reactive microservices
  • Deploy your microservices to modern cloud platforms such as AWS

If you feel this book is for you, get your copy today!

https://www.packtpub.com/

Instructions and Navigations

All of the code is organized into folders. For example, Chapter02.

The code will look like the following:

let server = builder.serve(|| {
 service_fn_ok(|_| {
 Response::new(Body::from("Almost microservice..."))
 })
});

Following is what you need for this book: This book is for developers who have basic knowledge of RUST, and want to learn how to build, test, scale, and manage RUST microservices. No prior experience of writing microservices in RUST is assumed.

With the following software and hardware list you can run all code files present in the book (Chapter 1-17).

Software and Hardware List

Chapter Software required OS required
1-17 Rust 1.31 Windows, Mac OS X, and Linux (Any)
1-17 Docker CE (18.09.1) Windows, Mac OS X, and Linux (Any)
1-17 Docker Compose (1.23.2) Windows, Mac OS X, and Linux (Any)
1-17 TeamCity (2018.2) - Professional Server License Windows, Mac OS X, and Linux (Any)

We also provide a PDF file that has color images of the screenshots/diagrams used in this book. Click here to download it.

Related products

Get to Know the Author

Denis Kolodin has been developing high-loaded network applications for more than 12 years. He has mastered and used different kind of programming languages like C, Java, Python and even Go for developing various applications from high-frequency trading robots to IPTV broadcasting servers. Now he enjoys creating peer-to-peer networking applications inspired by distributed systems based on a blockchain.

He started using Rust way back when version 1.0 was released and was delighted with features the programming language provided: zero-cost abstractions, safe multithreading, high-precision async programming and WebAssembly support. He is the core developer of Yew, a modern Rust framework inspired by Elm and React JS for creating multithreaded frontend apps with WebAssembly

He writes full-stack apps in Rust at his job and is known for his unique problem-solving capabilities when it comes to Rust.

Suggestions and Feedback

Click here if you have any feedback or suggestions.

Download a free PDF

If you have already purchased a print or Kindle version of this book, you can get a DRM-free PDF version at no cost.
Simply click on the link to claim your free PDF.

https://packt.link/free-ebook/9781789342758

hands-on-microservices-with-rust's People

Contributors

manjusha29 avatar mayankdpackt avatar murtazatinwala avatar packt-itservice avatar packtutkarshr avatar techsachinkumar avatar therustmonk avatar vishalmewadapackt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hands-on-microservices-with-rust's Issues

Example is not working or outdated. Error in the source code, Hands-On-Microservices-with-Rust/Chapter12

Hands-On-Microservices-with-Rust/Chapter12

2 | use actix::fut::wrap_future;
  |     ^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default

error[E0277]: the trait bound `queue_actor::QueueActor<T>: actix::Actor` is not satisfied
  --> src/queue_actor.rs:41:59
   |
41 |     pub fn new(handler: T, mut sys: &mut SystemRunner) -> Result<Addr<Self>, Error> {
   |                                                           ^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `actix::Actor` is not implemented for `queue_actor::QueueActor<T>`
   | 
  :::~l/.cargo/registry/src/github.com-1ecc6299db9ec823/actix-0.10.0/src/address/mod.rs:72:20
   |
72 | pub struct Addr<A: Actor> {
   |                    ----- required by this bound in `actix::Addr`


Chapter 06 grpc-ring doesn't build

bash-3.2$ git clone https://github.com/PacktPublishing/Hands-On-Microservices-with-Rust.git
Cloning into 'Hands-On-Microservices-with-Rust'...
remote: Enumerating objects: 63, done.
remote: Counting objects: 100% (63/63), done.
remote: Compressing objects: 100% (55/55), done.
remote: Total 1152 (delta 12), reused 25 (delta 7), pack-reused 1089
Receiving objects: 100% (1152/1152), 3.83 MiB | 8.42 MiB/s, done.
Resolving deltas: 100% (417/417), done.
bash-3.2$ cd Hands-On-Microservices-with-Rust/Chapter06/grpc-ring/
bash-3.2$ cargo build
Updating crates.io index
Updating git repository https://github.com/stepancheg/grpc-rust
Updating git repository https://github.com/stepancheg/rust-http2
Compiling libc v0.2.51
Compiling semver-parser v0.7.0
Compiling autocfg v0.1.2
Compiling rand_core v0.4.0
Compiling arrayvec v0.4.10
Compiling byteorder v1.3.1
Compiling stable_deref_trait v1.1.1
Compiling lazy_static v1.3.0
Compiling cfg-if v0.1.7
Compiling nodrop v0.1.13
Compiling smallvec v0.6.9
Compiling memoffset v0.2.1
Compiling scopeguard v0.3.3
Compiling slab v0.4.2
Compiling lazycell v1.2.1
Compiling futures v0.1.25
Compiling fnv v1.0.6
Compiling protobuf v2.4.2
Compiling proc-macro2 v0.4.27
Compiling unicode-xid v0.1.0
Compiling syn v0.15.29
Compiling remove_dir_all v0.5.1
Compiling memchr v2.2.0
Compiling scoped-tls v0.1.2
Compiling slab v0.3.0
Compiling failure_derive v0.1.5
Compiling ucd-util v0.1.3
Compiling void v1.0.2
Compiling regex v1.1.5
Compiling httpbis v0.8.0 (https://github.com/stepancheg/rust-http2#ff3d0720)
Compiling safemem v0.3.0
Compiling rustc-demangle v0.1.13
Compiling quick-error v1.2.2
Compiling utf8-ranges v1.0.2
Compiling termcolor v1.0.4
Compiling owning_ref v0.4.0
Compiling tokio-trace-core v0.1.0
Compiling thread_local v0.3.6
Compiling crossbeam-utils v0.6.5
Compiling log v0.4.6
Compiling rand_core v0.3.1
Compiling rand_chacha v0.1.1
Compiling rand_pcg v0.1.2
Compiling rand v0.6.5
Compiling backtrace v0.3.14
Compiling semver v0.9.0
Compiling regex-syntax v0.6.6
Compiling humantime v1.2.0
Compiling lock_api v0.1.5
Compiling rand_isaac v0.1.1
Compiling rand_hc v0.1.0
Compiling rand_xorshift v0.1.1
Compiling protoc v2.4.2
Compiling log v0.3.9
Compiling tls-api v0.1.20
Compiling log-ndc v0.2.0
Compiling crossbeam-queue v0.1.2
Compiling rustc_version v0.2.3
Compiling tls-api-stub v0.1.20
Compiling rand_jitter v0.1.3
Compiling rand_os v0.1.3
Compiling iovec v0.1.2
Compiling net2 v0.2.33
Compiling num_cpus v1.10.0
Compiling rand v0.4.6
Compiling rand v0.5.6
Compiling unix_socket v0.5.0
Compiling atty v0.2.11
Compiling crossbeam-epoch v0.7.1
Compiling base64 v0.9.3
Compiling tokio-sync v0.1.4
Compiling tokio-executor v0.1.7
Compiling tokio-timer v0.1.2
Compiling parking_lot_core v0.4.0
Compiling aho-corasick v0.7.3
Compiling bytes v0.4.12
Compiling futures-cpupool v0.1.8
Compiling mio v0.6.16
Compiling quote v0.6.11
Compiling crossbeam-deque v0.7.1
Compiling tempdir v0.3.7
Compiling tokio-current-thread v0.1.6
Compiling tokio-timer v0.2.10
Compiling tokio-io v0.1.12
Compiling mio-uds v0.6.7
Compiling tokio-codec v0.1.1
Compiling tokio-threadpool v0.1.13
Compiling tempfile v3.0.7
Compiling parking_lot v0.7.1
Compiling tokio-fs v0.1.6
Compiling env_logger v0.6.1
Compiling tokio-reactor v0.1.9
Compiling protobuf-codegen v2.4.2
Compiling synstructure v0.10.1
Compiling tokio-tcp v0.1.3
Compiling tokio-udp v0.1.3
Compiling tokio-uds v0.2.5
Compiling tokio v0.1.18
Compiling tokio-core v0.1.17
Compiling protoc-rust v2.4.2
Compiling grpc-compiler v0.7.0 (https://github.com/stepancheg/grpc-rust#0f1faf9d)
Compiling protoc-rust-grpc v0.7.0 (https://github.com/stepancheg/grpc-rust#0f1faf9d)
Compiling failure v0.1.5
Compiling grpc-ring v0.1.0 (/Users/cody/projects/Hands-On-Microservices-with-Rust/Chapter06/grpc-ring)
Compiling tokio-uds v0.1.7
Compiling tokio-tls-api v0.1.20
Compiling grpc v0.7.0 (https://github.com/stepancheg/grpc-rust#0f1faf9d)
error[E0433]: failed to resolve: could not find grpc_protobuf in {{root}}
--> src/ring_grpc.rs:49:64
|
49 | req_marshaller: ::grpc::rt::ArcOrStatic::Static(&::grpc_protobuf::MarshallerProtobuf),
| ^^^^^^^^^^^^^ could not find grpc_protobuf in {{root}}

error[E0433]: failed to resolve: could not find grpc_protobuf in {{root}}
--> src/ring_grpc.rs:50:65
|
50 | resp_marshaller: ::grpc::rt::ArcOrStatic::Static(&::grpc_protobuf::MarshallerProtobuf),
| ^^^^^^^^^^^^^ could not find grpc_protobuf in {{root}}

error[E0433]: failed to resolve: could not find grpc_protobuf in {{root}}
--> src/ring_grpc.rs:59:64
|
59 | req_marshaller: ::grpc::rt::ArcOrStatic::Static(&::grpc_protobuf::MarshallerProtobuf),
| ^^^^^^^^^^^^^ could not find grpc_protobuf in {{root}}

error[E0433]: failed to resolve: could not find grpc_protobuf in {{root}}
--> src/ring_grpc.rs:60:65
|
60 | resp_marshaller: ::grpc::rt::ArcOrStatic::Static(&::grpc_protobuf::MarshallerProtobuf),
| ^^^^^^^^^^^^^ could not find grpc_protobuf in {{root}}

error[E0433]: failed to resolve: could not find grpc_protobuf in {{root}}
--> src/ring_grpc.rs:80:76
|
80 | req_marshaller: ::grpc::rt::ArcOrStatic::Static(&::grpc_protobuf::MarshallerProtobuf),
| ^^^^^^^^^^^^^ could not find grpc_protobuf in {{root}}

error[E0433]: failed to resolve: could not find grpc_protobuf in {{root}}
--> src/ring_grpc.rs:81:77
|
81 | resp_marshaller: ::grpc::rt::ArcOrStatic::Static(&::grpc_protobuf::MarshallerProtobuf),
| ^^^^^^^^^^^^^ could not find grpc_protobuf in {{root}}

error[E0433]: failed to resolve: could not find grpc_protobuf in {{root}}
--> src/ring_grpc.rs:92:76
|
92 | req_marshaller: ::grpc::rt::ArcOrStatic::Static(&::grpc_protobuf::MarshallerProtobuf),
| ^^^^^^^^^^^^^ could not find grpc_protobuf in {{root}}

error[E0433]: failed to resolve: could not find grpc_protobuf in {{root}}
--> src/ring_grpc.rs:93:77
|
93 | resp_marshaller: ::grpc::rt::ArcOrStatic::Static(&::grpc_protobuf::MarshallerProtobuf),
| ^^^^^^^^^^^^^ could not find grpc_protobuf in {{root}}

warning: unused import: Ring
--> src/lib.rs:5:24
|
5 | use crate::ring_grpc::{Ring, RingClient};
| ^^^^
|
= note: #[warn(unused_imports)] on by default

error: aborting due to 8 previous errors

For more information about this error, try rustc --explain E0433.
error: Could not compile grpc-ring.

To learn more, run the command again with --verbose.

ch15 "docker-compose -f docker-compose.test.yml up" fails in mails service

This can be reproduced by doing a 'cargo build' at the mails folder.

(base) Hands-On-Microservices-with-Rust/Chapter15/deploy/microservices/mails$ cargo build
Updating crates.io index
Updating git repository https://github.com/lettre/lettre
error: no matching package named lettre_email found
location searched: https://github.com/lettre/lettre
required by package mails-microservice v0.1.0 (/home/tankh/projects/github/khtan-private/rust/Hands-On-Microservices-with-Rust/Chapter15/deploy/microservices/mails)

This seems to suggest a typo(?) in mails/Cargo.toml :

[dependencies]
...
lettre = { git = "https://github.com/lettre/lettre" }
lettre_email = { git = "https://github.com/lettre/lettre" }

Below are the versions of my Linux toolset:
Docker version 20.10.5, build 55c4c88
docker-compose version 1.21.2, build a133471
cargo 1.52.0-nightly (c68432f1e 2021-03-02)
rustc 1.52.0-nightly (51748a8fc 2021-03-05)
rustdoc 1.52.0-nightly (51748a8fc 2021-03-05)

actix and rabbitmq code example failed

queue_actor.rs


76 | impl<T: QueueHandler> StreamHandler<Delivery, LapinError> for QueueActor<T> {
   |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ within `queue_actor::QueueActor<T>`, the trait `std::marker::Unpin` is not implemented for `T`

async/await update?

First of all, I have to say this This book is ABSOLUTELY AMAZING!. Congrats for this amazing work Denis!

Is there any plan to make a Second Edition updating it to async/await syntax now that is a stable rust feature?

Thanks!

Chapter 6 jsonrpc_client

Hello,

thank you for the wonder book. I was hoping that you can update chapter 6 code. Currently the jsonrpc examople doesn't work. I get the following message for the compiler:

error[E0107]: wrong number of type arguments: expected 1, found 0
  --> src/main.rs:19:13
   |
19 |     client: Client
   |             ^^^^^^ expected 1 type argument

Thanks

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.