Final project for DM585.
To use the system you need the following:
- Docker and Docker Compose.
Note: The Dockerfiles are setup to use Jolie 1.12.2, so we have not tested other version.
You can start and stop the system using the following commands in your terminal:
# Start services
docker compose up
# Seed system with users and rewards
npm run seed
# Stop services
docker compose stopYou can also run them manually using Jolie. You can use our devcontainer to get Jolie.
The RouletteWeb will be running on http://localhost:8015/index.html, and can be opened in your browser of choice.
- The actual Roulette game can be found on http://localhost:8015/catalogue/roulette/index.html.
- The Roulette reward history can be found on http://localhost:8015/catalogue/roulette/index.html?page=history.
- Our web service catalogue can be found on http://localhost:8015/catalogue/index.html.
If you have run npm run seed then you can sign in as alice@domain.dk or bob@domain.dk on the roulette game.
Note: Right now the system does not unlock the user every day, and for testing we have placed a button "RESET ROULETTE" on the result screen after spinning the wheel, so you can try it again.
Double note: Sometimes the correct reward isn't displayed as the EventRelay hasn't put it into RewardHistory yet after spinning. This is due to timings, and because in development mode we can play multiple times a day, as the same user.
The Jolie services found in tools can be used to run tests and seed the system (inserting users and rewards).
When the system is running you can run the npm run seed file to run the Seed service.
- This will insert users
alice@domain.dkandbob@domain.dkwhich can be used to sign in with on the website. - It will also insert some rewards.
You can see what this service will insert in seed.json.
You can spin the roulette wheel from the terminal using npm run test:roulette or do it from http://localhost:8015/catalogue/roulette/index.html
You can see the reward history from the terminal using npm run test:history or see it from http://localhost:8015/catalogue/roulette/index.html?page=history.
You reset the system (delete the database files) using npm run reset.
You can preview what it will do with npm run reset:preview.
Here is a overview over our different Jolie services.
- Gateway
- Roulette
- Rewards
- Users
- Utilities
- Tools
. # Root Jolie monorepo.
├── common # common interfaces and types, like Email.
│ ├── interfaces.ol
│ └── types.ol
├── compose.yaml # Docker Compose.
├── params.global.jsonc # Central service configuration used by ./scripts/setup.sh.
├── README.md # This README.
├── scripts # Useful script
│ ├── clean.sh # Delete all databases (reset system to see changes).
│ ├── preview-clean.sh # See what files will be deleted by clean.sh.
│ └── setup.sh # Setup service parameters.
├── services # Implemented services.
│ ├── games # Only contains Roulette for now.
│ │ └── roulette # Services used by Roulette service.
│ │ ├── event-log # Event log for Saga.
│ │ │ ├── Dockerfile
│ │ │ ├── interfaces.ol
│ │ │ ├── lib
│ │ │ │ └── sqlite-jdbc-3.47.1.0.jar
│ │ │ ├── main.ol
│ │ │ ├── parameters.ol
│ │ │ ├── params.json
│ │ │ └── types.ol
│ │ ├── event-relay # Event relay to take rewards from EventLog to RewardHistory.
│ │ │ ├── Dockerfile
│ │ │ ├── lib
│ │ │ │ └── sqlite-jdbc-3.47.1.0.jar
│ │ │ ├── main.ol
│ │ │ ├── parameters.ol
│ │ │ ├── params
│ │ │ │ ├── 1.json
│ │ │ │ └── 2.json
│ │ │ └─── params.json
│ │ ├── lock # User lock.
│ │ │ ├── load-balancer
│ │ │ │ ├── Dockerfile
│ │ │ │ ├── main.ol
│ │ │ │ ├── parameters.ol
│ │ │ │ └── params.json
│ │ │ └── shard
│ │ │ ├── Dockerfile
│ │ │ ├── interfaces.ol
│ │ │ ├── lib
│ │ │ │ └── sqlite-jdbc-3.47.1.0.jar
│ │ │ ├── main.ol
│ │ │ ├── parameters.ol
│ │ │ └── params
│ │ │ ├── 1.json
│ │ │ └── 2.json
│ │ ├── roulette # Roulette orchestrator.
│ │ │ ├── Dockerfile
│ │ │ ├── interfaces.ol
│ │ │ ├── main.ol
│ │ │ ├── parameters.ol
│ │ │ └─── params.json
│ │ └── web # Roulette demo page + company portfolio.
│ │ ├── Dockerfile
│ │ ├── interfaces.ol
│ │ ├── lib
│ │ ├── main.ol
│ │ ├── parameters.ol
│ │ ├── params.json
│ │ ├── templates # Mustache templates.
│ │ │ ├── dev.html
│ │ │ ├── empty-page.html
│ │ │ ├── footer.html
│ │ │ ├── header.html
│ │ │ ├── login-dialog.html
│ │ │ ├── logout-button.html
│ │ │ ├── page.html
│ │ │ ├── roulette.html
│ │ │ └── user.html
│ │ └── web # Web files.
│ │ ├── assets
│ │ │ ├── favicon.svg
│ │ │ └── logo.svg
│ │ ├── catalogue
│ │ │ ├── index.html
│ │ │ └── roulette
│ │ │ └── index.html
│ │ ├── contact.html
│ │ └── index.html
│ ├── gateway # API Gateway.
│ │ ├── Dockerfile
│ │ ├── extenders.ol
│ │ ├── main.ol
│ │ ├── parameters.ol
│ │ ├── params.json
│ │ ├── surface.ol
│ │ └── surface.sh
│ ├── rewards # Reward services.
│ │ ├── history # Reward history.
│ │ │ ├── load-balancer
│ │ │ │ ├── Dockerfile
│ │ │ │ ├── main.ol
│ │ │ │ ├── parameters.ol
│ │ │ │ └── params.json
│ │ │ └── shard
│ │ │ ├── Dockerfile
│ │ │ ├── interfaces.ol
│ │ │ ├── lib
│ │ │ │ └── sqlite-jdbc-3.47.1.0.jar
│ │ │ ├── main.ol
│ │ │ ├── parameters.ol
│ │ │ ├── params
│ │ │ │ ├── 1.json
│ │ │ │ └── 2.json
│ │ │ └── types.ol
│ │ ├── load-balancer # Reward loadbalancer to reward shards.
│ │ │ ├── Dockerfile
│ │ │ ├── interfaces.ol
│ │ │ ├── main.ol
│ │ │ ├── parameters.ol
│ │ │ └── params.json
│ │ ├── rebalancer # Rebalancer. Is used in the prototype to add rewards to RewardShard's.
│ │ │ ├── Dockerfile
│ │ │ ├── interfaces.ol
│ │ │ ├── main.ol
│ │ │ ├── parameters.ol
│ │ │ └── params.json
│ │ └── shard # Reward shard.
│ │ ├── Dockerfile
│ │ ├── interfaces.ol
│ │ ├── lib
│ │ │ └── sqlite-jdbc-3.46.1.3.jar
│ │ ├── main.ol
│ │ ├── parameters.ol
│ │ ├── params
│ │ │ ├── 1.json
│ │ │ └── 2.json
│ │ └── types.ol
│ ├── users # User services.
│ │ ├── email-auth # Email authenticator.
│ │ │ ├── interfaces.ol
│ │ │ ├── main.ol
│ │ │ └── parameters.ol
│ │ ├── load-balancer # User load balancer.
│ │ │ ├── Dockerfile
│ │ │ ├── main.ol
│ │ │ ├── parameters.ol
│ │ │ └── params.json
│ │ └── shard # User shard.
│ │ ├── Dockerfile
│ │ ├── interfaces.ol
│ │ ├── lib
│ │ │ └── sqlite-jdbc-3.47.1.0.jar
│ │ ├── main.ol
│ │ ├── parameters.ol
│ │ ├── params
│ │ │ ├── 1.json
│ │ │ └── 2.json
│ │ └── types.ol
│ └── utilities # Utility services.
│ ├── event-utils # Service used to query sagas and events.
│ │ ├── interfaces.ol
│ │ └── main.ol
│ ├── hash-utils # Service used to hash strings.
│ │ ├── interfaces.ol
│ │ └── main.ol
│ ├── pretty-console # Service used to get better printing.
│ │ ├── interfaces.ol
│ │ └── main.ol
│ └── weighted-load-balancer # Interface for weighted load balancers. Used by RewardShard to get getWeight.
│ └── main.ol
└── tools # Service tools.
├── history-test # Fetch history for user.
│ ├── main.ol
│ ├── parameters.ol
│ ├── params.json
│ └── run.sh
├── roulette-test # Spin roulette wheel for user.
│ ├── main.ol
│ ├── parameters.ol
│ ├── params.json
│ └── run.sh
└── seed # Seed databases.
├── main.ol
├── parameters.ol
├── params.json
├── run.sh
└── seed.json

