Backends
API
https://github.com/Spordle/Play/tree/master/api
The API runs in Kubernetes, using a nodejs Dockerfile. Staging has a single cluster that handles requests and the RabbitMQ queue, while Production has one cluster to handle requests and another to handle queue events.
Dependencies
Kubernetes is hosted in AWS EKS. PostgreSQL is used as the database, which is hosted by RDS, and RabbitMQ is used as a message queue, which is hosted via Amazon MQ. Files are uploaded to S3 buckets.
The API links to admin and reports (in emails), and generates URLs for Metabase and the iCal lambda.
Deployment
Github Actions automatically deploys to staging when a commit is pushed to master. Deploys to production are manual.
https://github.com/Spordle/Play/actions
Lambdas
https://github.com/Spordle/Play/tree/master/fn
Play uses two AWS Lambdas; one for generating PDF reports (described above) and another for generating an iCal file so that game officials can subscribe to their calendars.
Dependencies
The reports lambda depends on the Reports app, and the iCal lambda only depends on the database. The iCal lambda creates link to the admin app.
Deployment
Buddy CI is used to manually deploy to staging or production since these are very rarely changed. The serverless library is used to manage the Lambda configuration and deployment.
https://app.buddy.works/hisports/hisports/pipelines
Frontends
Admin
https://github.com/Spordle/Play/tree/master/admin
The admin app is a React single-page application that’s hosted in Amplify and built with webpack.
Dependencies
Admin depends on the API, with links to Reports and the iCal lambda, and embeds Metabase as an iframe.
Deployment
Github Actions automatically deploys to staging when a commit is pushed to master. Deploys to production are manual. This is done in the same deployment pipeline as the API, so both are always updated together.
https://github.com/Spordle/Play/actions
Reports
https://github.com/Spordle/Play/tree/master/reports
There are two parts to reports: the React single-page application for all the rendering, which is hosted on Netlify, and the PDF generator which is an AWS Lambda that runs Puppeteer.
Dependencies
Reports depends on the API.
Deployment
Buddy CI automatically deploys to staging when a commit is pushed to master. Deploys to production are manual.
https://app.buddy.works/hisports/hisports/pipelines
Websites
https://github.com/Spordle/Play/tree/master/web
The legacy websites are React single-page applications that are individually deployed to Netlify. Each website has custom build configurations through env variables, so they are required to be built individually.
Dependencies
Websites depend on the API, and may link to Reports depending on configuration.
Deployment
Buddy CI automatically deploys a staging site when a commit is pushed to master. Deploys to production are manual.
https://app.buddy.works/hisports/hisports/pipelines
Services
Reporting
Metabase is hosted in the Kubernetes cluster. There’s one instance for production and another for staging.
https://metabase.hisports.app/
Emails
Emails are sent using AWS SES. The API uses nodemailer library with an SMTP connection to SES.
Bounces are automatically suppressed by AWS and added to its suppression list. The API logs every email sent to be able to verify delivery, which you can find in Cloudwatch.
DNS
Cloudflare manages all DNS for Play.
hisports.app
is used for all API/app related domains, and hisports.site
is used for websites only. See also: Domain migration
The HiSports account also manages the domains omahahockey.ca and northwestdistrictmha.ca on behalf of OMAHA and NWD.
Errors
Errors are logged in Sentry. This is only used for the API and Admin app.