Skip to content

About the Infrastructure

Logan Davidson edited this page Nov 23, 2023 · 2 revisions

All of Republic of Rome Online's infrastructure is hosted on AWS (Amazon Web Services). The roronline.com domain is registered and managed on AWS Route 53.

Frontend

The frontend is a Next.js React application. The source code for this application is stored in the 'frontend' folder within the same GitHub repository as the backend. It is continuously deployed to the AWS Amplify hosting environment whenever changes are made to the 'frontend' folder in the main branch of the repository. Amplify is responsible for the deployment of the frontend.

The specific infrastructure used in the frontend server is heavily abstracted by Amplify, but it will certainly run on a Node.js server.

Backend

The backend is a Django application at it's core, with it's source code stored in the 'backend' folder within the same GitHub repository as the frontend. Hosted on AWS Elastic Beanstalk, deployment is triggered by changes made to the 'backend' folder in the main branch. Unlike the frontend, backend deployment is performed by a GitHub action.

The backend application runs in a Docker container with a Python runtime. Within this container, the NGINX server is responsible for terminating SSL/TLS connections and passing the decrypted requests on to the Django/Daphne application. The reason the SSL/TLS connections are not terminated by a load balancer is because load balancers are too expensive. Django is used to provide a REST framework API and the application logic that sits between clients and the PostgreSQL database. The database is hosted on Amazon RDS.

The Django application runs alongside Daphne, which is a server responsible for managing HTTP and WebSocket connections (handed over by the NGINX server) and communicating with the Django application using the ASGI protocol. Django uses an extension called Channels to provide asynchronous functionality, which is essential for supporting WebSocket connections.

Inside the same Docker container stack is a second container that runs Redis. Redis is used as a message broker to allow communication between the coroutines that manage open WebSocket connections. The reason that the message broker runs within the same container stack, rather than a dedicated service like AWS ElastiCache, is to save money.

The backend also provides some web pages, which are mainly for administrative use. The Django admin portal is hosted at api.roronline.com/admin and the web browsable API is hosted at api.roronline.com/rorapp/api. The backend uses the 'api' subdomain, while the frontend uses the 'www' subdomain.

Clone this wiki locally