System will be orchastrated using either Terraform or AWS Cloudformation
- EC2 instances running custom docker images of our custom go server fetched from AWS ECS
- These would be running behind a load balancer
- Redis cluster running on Elastic cache
- Need to make this a dependency for EC2 cluster. Need primary & secondary endpoint to be populated
in
.env
file for the web server (downloaded from S3 bucket on launch)
- Need to make this a dependency for EC2 cluster. Need primary & secondary endpoint to be populated
in
- Database is still TODO (DynamoDB/AWS Keyspaces)two keyspaces, one for keeping track of the user connections, other for pixels
- CDN setup is TODO (prob. cloudfront)
- user first tries to get board from cloudfront
- if fails, fetches from redis
- Client does
POST /api/draw
with{ x: <int32 x>, y: <int32 y>, color: <int32> }
(TODO: look into using fewer bits) if possible - On server, check client last write time (in cache or from Cassandra)
- if its too soon, reject
- else allow write
- Update redis bitfield with new pixel
- Update cassandra entry for the pixel
- Update client's last write time in cassandra
- Publish update to other clients on websocket
- Need to use redis pubsub to tell other servers about the update so they can update their clients
- Download entire board using
GET /api/board
- Watch websocket for updates on per pixel level and re-draw on updates
- Periodically download the entire snapshot from
/api/board
to ensure board stays in sync