Coder Social home page Coder Social logo

cqrs-demo's Introduction

cqrs-demo

A demo application using the cqrs-es framework with a backing postgres repository.

Requirements

  • rust 1.53 or greater
  • docker & docker-compose for starting an instance of Postgres
  • postman or curl (or your favorite Restful client)

Alternatively, if a standard Postgres instance is running locally it can be utilized instead of the docker instance, see the init script for the expected table configuration.

Installation

Clone this repository

git clone https://github.com/serverlesstechnology/cqrs-demo

Enter the project folder and start a docker instance of PostgreSql

cd cqrs-demo
docker-compose up -d

Start the application

cargo run

Call the API, the easiest way to do this is to import the provided postman collection into your Postman client or the test_api.sh curl script found in the curl directory. Note that the command calls are configured to return a 204 status with no content, only the query call will return a 200 OK response with a body. For feedback on state you should call a query.

Docs you might want

Serverless cqrs-demo

A serverless demo is also available in this package. The bootstrap binary that is built may be run on AWS Lambda but requires a number of services to do so (e.g., IAM roles, database, etc.). For simplicity this demo will only be deployed in docker and tested locally, and will use the same database as before.

Additional Requirements

  • The x86 MUSL library - get with rustup target add x86_64-unknown-linux-musl
  • musl-gcc compiler - may be obtained on Ubuntu via sudo apt install musl-tools

Building

Build a release version of the bootstrap binary targeting x86-MUSL and build this into a docker image using the provided Dockerfile.

cargo build --release \
  --target x86_64-unknown-linux-musl \
  --bin bootstrap
docker build -t cqrs-srvrls .

Ensure that the Postgres docker image is running, then start a new docker container using the created image.

docker run --rm --network=host cqrs-srvrls

Use the test_lambda.sh script in the curl directory to test the lambda container. The application is designed to be deployed using an AWS API Gateway proxy integration or Lambda Function URL. These use the v2.0 of the AWS Lamba proxy integration, more information on this format is available here.

cqrs-demo's People

Contributors

serverlesstechnology avatar davegarred avatar berkes avatar andrewwebber avatar

Stargazers

Paul Smal avatar

Watchers

 avatar  avatar

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.