FPM controller on fly.io #15
Arpita-Jaiswal
started this conversation in
Ideas
Replies: 2 comments
-
|
In fpm-docker.dockerfile |
Beta Was this translation helpful? Give feedback.
0 replies
-
How to Deploy a Docker Image on fly.iohttps://github.com/AbrarNitk/fpm-app-config/blob/master/abrark-fpm.dockerfile |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Status: In Progress
Owner: @HeulitigStarted On: 18th October 2022
TODO:
4th November
heulitig/gunicorn-controllerdocker image at fly.io3rd November
running the controller service using gunicorn using a runner script.
heulitig/gunicorn-controller2nd November
1st November
django test service for testing
file
local_settings.pywhich the controller service will use.27th October
25th October
for storing package, instance and user information
21st October
20th October
19th October
18th October
Tables
The
fpm-controllerhas one table with following structure:This model stores the user, package and instance information.
How does it work?
We would have three entries:
fpm-controllerapp (fpm), (app.fifthtry.com)fpm-controllerservice (django),fpm package instances(fly.io machine)All the requests will be sent to the app then if the URL is not present in the sitemap, the request will be proxy-passed to the endpoint which, in this case, is the
fpm-controllerservice.When does the
tidget set in the request cookie?Whenever a request comes to the service which doesn't have
tidin the cookie, then, the django middleware (service) will settidin the cookie.Pages
API
Create an Instance
URL:
/api/create-instanceRequest parameters:
package-namedownload-base-urltidmachine config(CPU, RAM)Response:
Redirect to index page
This API would create an entry in the
UserPackagesmodel and also create and start a fly machine.The entry would contain the
instance_statusasPENDING.To create and start a machine we need to do the following steps:
package-nameanddownload-base-urlin the env (environmental variables)fpm serve --download-base-url <download-base-url>.fpm-readyAPI tofpm-controllerservice, this API would update theinstance_statusasREADYand set instance_id. (and probably IP too)Delete an Instance
URL:
/api/delete-instanceRequest parameters:
userpackages_idResponse:
Redirect to index page
This API would check for the entry in the
UserPackagesmodel and then call the fly.io API to delete the machine permanently. Then, the corresponding entry would change theinstance_statustoTERMINATED.List instances
URL:
/api/list-instancesRequest parameters:
tidResponse:
[ {
"package_name" : string,
"userpackage_id": int,
"status": string,
"IP": optional string,
}]
This API would return all the packages (probably instances too) against the user. This would simply do a query to the
UserPackagesmodel against thetid.How to create a machine on FLY: https://fly.io/docs/reference/machines/
How to create docker image: https://www.stereolabs.com/docs/docker/creating-your-image/
Beta Was this translation helpful? Give feedback.
All reactions