how to create an application:
- give git repo (and branch, defaults to default branch) //it sends a request to backend, returns if the repo exists and if the branch exists (it works for private repo as we use user token)
- select a language (or autodetect)
- select the port the webserver listens to or use env var $PORT
- specify additional env vars (key value pairs)
- specify a name of the application (for now it's not used but it will be used to create a dns record) //sends a request to backend to check if the name is available
backend operations:
- check that the application name is available
- insert the application in the db with status pending
- push the application to the image builder queue
- image builder gets the application from the queue
- image builder update the application status to building
- image builder pulls the repo
- image builder builds the image
- if the build fails and the fault was image builder then retry, if the fault was the user then update the status to failed and send to the queue a message that the build for application xxx failed
- if the build is succesful then update the application with the image id to use and sends to the queue a message that the build was succesful
- backend receives the message and updates the application status to starting
- creates the container given all the info (image id, port, env vars, name)
- starts the container
- if starting the container fails retry for 3 times then update the status to failed
- if the container is running then update the status to running
for future:
- specify additional add ons like databases (databases, databases web views, ... (for now only db and db's web views))
- add a volume to the application (specify name and mount path) 2
- let user create an application
- add a service that sets a dns record for an application, for now we make a trasparent one that just returns the ip and port of the application
- after you create an application return the state of the application and the application id
- add endpoint to get all the applications of an user
- let user delete an application
- let user forcefully restrt an application
- let the user update an application
- visibility
- name
- listening port
- envs
- branch
- code base (based on commit on that branch)
- application status polling endpoint
- create a database service
- add a db system to visualize the database
- log reader system (will need pagination)
- implement a crude version of warden
- email sender to user with stuff (db credentials, warden notifications, ...)
- rename oauth service to git provider
- add getGitRepos function in oauth service
- return the list of repos (name and branches) owned by the user (sorted by latest update)
- CreateApplicationFromApplicationIDandImageID calls the db too many times, should add a cache layer for the application and the users and update could be more granular so that it doesnt need to retrive the entire application to update it
- paginate the list of repos
- add git service method that creates a channel for a repo that send info about updates to the repo
- repos shouldnt return a bool in updates and delete cause it's not really used
to retrive logs correctly from the ui:
- get logs
- use the last timestamp in the
fromparameter and addX-Last-Log-Nanoheader with the same timestamp to prevent the server from returning the same single log line