Info Re Multiple Flask Apps in One LightSail Container Service

0

assuming i'm correct that I'd be charged $15/month for each Container Service i am seeking a way to make each app available on one container service. since these are just for my portfolio, they won't get a lot of hits (possibly none). my idea was to have the url point to a general app that would have available all the deployment information/files for the apps and a user could select a link/push a button whatever and the app would make a lightsail api request to deploy the selected app. minutes later, that app would be active (and the general app would not be). i'm wondering how the api call would be validated, and also whether this would work. Thanks

  • I haven't done Flask app programming in a while, but I recall it being pretty modular and composable. E.g. you could probably just have one container service that has all your apps sitting on separate URL routes, like: /portfolio/app1, /portfolio/app2, /portfolio/app3, ...

  • that would involve a lot of work but maybe. throw all the static resources together, all the templates together, etc. multiple apps have an 'index.html' template and so i would have to rename these, and some inherit from a base.html and i would have to work that out etc. Then i would have to figure out how to handle the various route requests (every app has '/' -- i would have to work that out). i don't know i'm not a master of flask so maybe there's a way to do this i'll look into it. thanks for your comment [2nd edit] wow, 'master' is a non-inclusive word. but i was saying i'm NOT a master!

  • Here's a post that has an example of how to do this. The author even has exactly same purpose for this as you: portfolio site! https://peterhaas-me.medium.com/how-to-run-multiple-flask-applications-from-the-same-server-9ca2c0ad7bb3

    TL;DR: https://werkzeug.palletsprojects.com/en/2.0.x/middleware/dispatcher/

  • Pavel that looks great but I would have to pay Medium $50. Not just now ;) I'm currently going to look into nginx and see if I can have that redirect requests to a different port based on the url. But i don't really know how that would work. if you were willing to engage in some light copyright infringement you could send the story to me at myspam@cambiumsoftware.com

Ken
asked 12 days ago323 views
2 Answers
0

" how a multi-container app can be deployed on Lightsail container service" well I don't want to host a multi-container app, i want to host multiple small apps under one container-service.

This is the lightsail API i'm referring to: https://docs.aws.amazon.com/lightsail/2016-11-28/api-reference/Welcome.html

This allows you, in theory, to send commands to AWS outside of the ClI from your own computer. so i could send a request from an app. you evidently send a json in the request using GET or POST as specified in the api. but the json doesn't have authentication details so they'll just act on any request coming in? i could get a nice vps for $15 a month just trying the aws option

{ "containers": { "string" : { "command": [ "string" ], "environment": { "string" : "string" }, "image": "string", "ports": { "string" : "string" } } }, "publicEndpoint": { "containerName": "string", "containerPort": number, "healthCheck": { "healthyThreshold": number, "intervalSeconds": number, "path": "string", "successCodes": "string", "timeoutSeconds": number, "unhealthyThreshold": number } }, "serviceName": "string" }

Ken
answered 11 days ago
  • Did you give the video a try? I'd recommend doing that since my terminology may not have matched yours, but the video still might turn out to be useful.

    ===

    I am familiar with Lightsail API :) What I meant was I couldn't clearly understand how you intend to use it or why would you need to, from the description of your idea.

    ===

    wrt, but the json doesn't have authentication details so they'll just act on any request coming in, not quite, the authentication is set in the request headers and unauthenticated requests generate an error response to that effect.

    Please refer https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-configure.html for how to configure credentials for AWS CLI calls.

0

Hi,

I am not sure I was able to follow the "making lightsail api requests" part, or the "how would api be validated" piece of your post.

However this video - https://www.youtube.com/watch?v=6S2brobgmBA&t=1921s from the Lightsail team demo's how a multi app setup can be deployed on Lightsail container service and will likely help guide you.

Attaching a screenshot of the video paused to show what the link links to :) screenshot of the video paused

Thanks.

profile pictureAWS
EXPERT
AWS-SUM
answered 11 days ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions