Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gets the API service working in ECS. Online SP now works in staging! #81

Merged
merged 41 commits into from
Oct 3, 2022

Conversation

willroberts
Copy link
Collaborator

@willroberts willroberts commented Oct 3, 2022

This gets practice games working online! You can create an account and play a practice game at https://staging.duelyst.org.

This is another massive PR, with the following changes:

App Changes:

  • Passes the game_type into NetworkManager's connect() function, which will make it easier for us to differentiate between Game & SP services running on the same domain.
  • Mildly refactors the WebSocket connection logic in app/sdk/networkManager.coffee to split out the determination & validation of the WebSocket URL from the connection logic. Also enables retries in local development to slightly reduce code duplication.

Server Changes:

  • Adds support for configuring Firebase authentication via new environment variables: FIREBASE_PROJECT_ID, FIREBASE_CLIENT_EMAIL, and FIREBASE_PRIVATE_KEY. These are used in staging to supply credentials from AWS SSM Parameter Store.
  • Cleans up the process of downloading index.html and register.html from S3 in API, with more logs and more reliability when constructing URLs/paths (which previously used string addition).
  • Cleans up isDevelopment() / isStaging() / isProduction() logic to simply differentiate development vs. not development, resulting in more consistency between staging and production modes.
  • Disables email sending for all use cases, since we don't have a working Mandrill config / subscription currently.

Build Changes:

  • Adds Dockerfiles for API & migrations.
  • Cleans up the base Dockerfile, adding some Python/GCC/G++ dependencies for bcrypt in API/Worker.
  • Adds a helper script for building the staging frontend code (scripts/build_staging_app.sh).

Infrastructure Changes:

  • Gets the API service in ECS working, including healthchecks from the LB.
  • Adds a database migrations service in ECS which can be selectively enabled to run migrations.
  • Sets container memory allocation to 350MB. I was hoping for 512MB, but AWS gives us 936MB instead of 1024MB, and underlying processes like dockerd and containerd consume 150MB+ already. :(
  • Adds more environment variables and secrets to ECS services, such as setting NODE_ENV, configuring Firebase, and enabling all cards in staging.
  • Adds redirects to CloudFront+S3 from the LB for static assets, avoiding API entirely to reduce load.
  • Fixes CORS configuration for CloudFront and S3.
  • Loosens the requirements of open ports and LB target groups for ECS services, for things like migrations which don't need ingress traffic.
  • Adds support for the CloudWatch Agent (which enables Disk/Memory metrics in EC2), but I disabled it again since it uses like 70MB of our already-limited memory.
  • Adds documentation for deployments to AWS via Terraform.

@willroberts willroberts merged commit 8e71f9a into open-duelyst:main Oct 3, 2022
@willroberts willroberts deleted the ecs-api branch October 3, 2022 20:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant