Code Monkey home page Code Monkey logo

ticket-booking's Introduction

Demo application - Ticket booking system

Ticket booking

The ticket booking system is built on the Spiral Framework, a high-performance PHP framework that allows developers to create reusable, independent, and easy-to-maintain services. In this demo application, you can find an example of using RoadRunner's gRPC plugin to create and consume gRPC services.

You can purchase tickets using a fake payment gateway in this demo system. You can also view and manage your bookings and receive notifications about your tickets and transactions. It's a great way to get a feel for how a real ticket booking system works without any of the actual commitment (or expense).

To ensure the best performance, reliability, and observability, we have used several powerful tools and technologies such as Opentelemetry, Centrifugo, RoadRunner, Grafana, Bidrdog, Buggregator, and Temporalio. These help us understand how the system behaves, identify and fix issues, and optimize the resources.

Grafana dashboard

Our demo ticket booking system is a great example of how Spiral Framework and other tools can be used to build a modern and performance-driven application. We hope you have a blast using it and learning more about the capabilities of Spiral Framework and the other tools we've used.

Happy (fake) ticket shopping!

Requirements

  • PHP 8.1
  • composer
  • docker

Installation

Clone project into a desired folder

Run console commands

docker compose up -d

Services dashboards

Project structure

  • frontend - SPA GUI
  • centrifugo - Centrifugo API
  • web - REST API
  • users - GRPC microservice. It's responsible for user management and auth tokens management. Works only with database.
  • cinema - GRPC microservice. It's responsible for movies and reservation. Works with database and temporal.
  • payment - GRPC microservice. Fake payment gateway. It's receives requests for money charging and responses with receipt.
  • shared - Shared package for all microservices. It contains common classes, proto files and compiler, DTO's, GRPC clients, e.t.c. docker-compose.yaml contains all necessary containers to run project.

Database

  • Connection address: 127.0.0.1:5432
  • Username: homestead
  • Password: secret
  • Database: homestead

ticket reservation

TODO

  • Register stripe in sandbox mode
  • Book and charge before 15 min screening. User will have the ability to cancel ticket.
  • Schema of services

ticket-booking's People

Contributors

butschster avatar dependabot[bot] avatar gropaga avatar meekstellar avatar msmakouz avatar sanchesfree avatar spiralscout 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

ticket-booking's Issues

Can not run locally

Hello,

This seems a very curious and valuable example. Wanted to look closer, tried to run it locally with:

docker compose up

Unfortunately getting different errors like:

container for service "cinema" is unhealthy

or

container for service "payment" is unhealthy

chmod: ./rr: No such file or directory

When trying to run this example, i run run.sh i get ./rr does not exist during the compile

when docker starts,

web
cinema
payment
users
centrifugo-rpc

all those containers just repeat: chmod: ./rr: No such file or directory

NoFreeWorkers: context deadline exceeded

Hi guys. Pulling the project´s docker files starting it all up, it only takes a while before requests stepping out of the SPA FE app, for example auth/profile or tickets/reserve keep hanging forever. After a couple of interactions with the app, I can inside inside the logs of the web container:

ERROR server no free workers in the pool, wait timeout exceed {"reason": "no free workers", "internal_event_name": "EventNoFreeWorkers", "error": "worker_watcher_get_free_worker: NoFreeWorkers:\n\tcontext deadline exceeded"}

Dockerfile uses the following version ARG ROAD_RUNNER_IMAGE=2023.3.12. I tried to set num_workers to 0, but to no avail. Would you have any suggestion for me as to what might be wrong? The specs of the machine within which the error is encountered is a Linux one with 8 CPUs and 16 GB of RAM. When I observe the load on CPUs and RAM sideways, there are plenty of available resources even with the error in place.

Getting issues with the frontend container

When I run the run.sh I got the following logs in the frontend container:

yarn install v1.22.19
warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
[1/4] Resolving packages...
success Already up-to-date.
Done in 0.26s.
yarn run v1.22.19
$ nuxt
Nuxi 3.0.0                                                                                                                                                                                                                            04:35:42
Usage: npx nuxi dev|build|build-module|cleanup|clean|preview|start|analyze|generate|prepare|typecheck|usage|info|init|create|upgrade|test|add|new [args]                                                                              04:35:42

Use npx nuxi [command] --help to see help for each command                                                                                                                                                                            04:35:42

Done in 0.11s.

If I change the dev command in /frontend/package.json from nuxt to nuxt dev, it shows :

Nuxi 3.0.0                                                                                                                                                                                                                            04:38:00
Nuxt 3.0.0 with Nitro 1.0.0                                                                                                                                                                                                           04:38:00
                                                                                                                                                                                                                                      04:38:01
  > Local:    http://localhost:3000/ 
  > Network:  http://172.24.0.17:3000/


 ERROR  Cannot start nuxt:  Cannot read properties of undefined (reading 'options')                                                                                                                                                   04:38:01

  at axiosModule (node_modules/@nuxtjs/axios/lib/module.js:12:13)
  at installModule (node_modules/@nuxt/kit/dist/index.mjs:416:9)
  at async initNuxt (node_modules/nuxt/dist/index.mjs:1825:7)
  at async load (node_modules/nuxi/dist/chunks/dev.mjs:6779:9)
  at async Object.invoke (node_modules/nuxi/dist/chunks/dev.mjs:6840:5)
  at async _main (node_modules/nuxi/dist/cli.mjs:50:20)

and visiting localhost:3000 does not show the web page. Could it be because of the axios module does not play well with nuxt 3 ?

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.