The following assumes that we use Amazon Web Services (AWS) to host both the actual Codidact instance in the future and to deploy the develop branch.
I have almost no practical experience with hosting applications. The only websites that I ever hosted were either completely static or I had access to the actual hardware (it was a raspberry pi.) Please take the following with care and do your own research.
Days ago, I did not even know what AWS is other than what the name suggests. I know my ways with systemd and docker but I am far from being an expert, please read the following with care and do your own research.
Amazon offeres a ton of services to host web applications. Over the past few days I did some research and would like to ask which service we should use to host Codidact.
The following are options that I consider reasonable: (There are more services availiable like Amazon Lightsail but I think it is not viable for this type of application.)
EC2: This is a service from Amazon were you rent a virtual machine and gain full control over it. Services would be managed with systemd.
Updating the service would have to be done manually for the most part. (That is not necessarly a bad thing, because it’s a lot simpler to just do something than to write a script that does it, but deploying a develop branch would be close to impossible.)
I do not think this scales well, but it is easy to setup.
ECS (EC2): We also rent a virtual machine, but run docker on it. Each of our services becomes a docker container.
This means additional work configuring the docker containers. (This would be a lot of work, do not underestimate this.) Updating would be done automatically either by pushing a new docker image or by commiting to the develop (or master) branch.
A positive side effect is that anyone else can run the docker images on their own machine. We could additionally configure docker compose which would mean that anyone with docker installed could run
docker compose upand have a complete Codidact instance running on their machine.
ECS (FARGATE): Very similar to ECS (EC2) but we do not control the virtual machine(s) that the containers run on. This is Amazons recommended way of running applications.
The idea is that we say “run these docker containers” and then Amazon does all the heavy lifting. But we would have to make structural changes to our application to really benefit from this. (If Codidact becomes really large like some people seem to expect it, this would likely be the way to go.)
However, the downside is that we can not host the database this way. Fargate does not support persistent storage on it’s own. We would have to host the database with one of the options above or use RDS. (RDS is Amazon’s database service which could be used to run a Postgres database, this is probably what we would do in this scenario.)
Another downside is that we can only use a very limited subset of docker’s features because the individual containers might run on completely different machines and we really know nothing about the environment.
Personally, we should deploy the develop branch with ECS (FARGATE) since we do not need the database to be persistent and this seems to be the most “modern” approach. I have no idea what would be best for the actual instance though.
Again, I lack any practical experience to make a well founded recommendation.
Note. I am posting this shortly before going to bed so I likely won’t respond immediately.
- It should be noted that switching would be feasible from ECS (FARGATE) to ECS (EC2) and from ECS (EC2) to EC2 but the other way around would be difficult.