#Moving from Render to AWS

1 messages · Page 1 of 1 (latest)

round widget
#

Hi there, I try to move a project from Render which is very slow to AWS. It's a Python project using Flask. I put the same commands or config that I have on render but it fails. Here are the screenshots of my config and the related logs. If you have any idea on how to proceed? Thanks in advance.

#

I also have this banner, I don't know if it's related

olive relic
#

The error is saying that gunicorn doesn't exist as a command

#

is this a global package locally? It would need to be installed in the container, and added to the environments $PATH.....if im understanding the error correctly.

round widget
olive relic
# round widget thank you so much really appreciate, will have a look at it, because gunicorn sh...

In my experience if it isn't installed global, I would need to use the package manager to run the command because the binary will be installed to the local source code, but if it needs to be global on the container then I can use the command directly, like you are trying. Let me know what you find, if you don't mind. I'm curious to know.

Example with yarn

local in project yarn [command]
global to machine [command], because the binary is on the machine and added to the $PATH.

it's also possible that Render has abstracted something I am unaware of. And im not sure you are using EC2 like that post.

round widget
olive relic
#

what AWS resource is hosting the site?

round widget
#

what do you mean by that sorry dont't get it

olive relic
#

so you deploy the code from a repository, but it needs to be served somewhere after being built and deployed. That can be S3, ECS, EC2 or other combinations with Lambda etc.

#

since im assumming gunicorn is http requests, there should be a server to handle the requests in AWS. Which is where your code should be deploying to after build.

round widget
#

oh okay it's app runner. It's the first time I use AWS

olive relic
#

ah...I think you said that....my bad. Let me look at app runners docs

round widget
#

thanks so much

olive relic
#

do you have a yaml for the config? which method are you using?

round widget
#

requirements.txt file

olive relic
#

is this a private repo?

round widget
#

the build works in the logs only the start command fails

round widget
#

or maybe because it's already running somewhere else?

olive relic
#

can you share the repo link with me?

olive relic
round widget
olive relic
#
#

this could be something.....the actual characters used for the command. I need to hop away for a bit. I will try to look at the repo and see if I can find something this evening.

round widget
#

thank you so much I work on it to see if can find something

olive relic
round widget
#

I gonna try because I pasted the command nothing to loose

olive relic
#

copy/paste is the devil

round widget
#

you see the placeholder is gunicorn

#

keeps failing

#

same error

#

the start command doesn't work

olive relic
#

how are you deploying? manually moving the code?

#

on push?

round widget
#

On push

olive relic
#

you have all this done? I don't see it in the repo.

#

requirements.txt is the packages, but I don't see anything actually configuring app runner

round widget
olive relic
#

of course...if I find anything else I will let you know

round widget
#

All the examples that I’ve found or articles are only with docker not with repo 😡

olive relic
#

well....theres a container there whether you set it up or not, just know that.

#

what you are doing now is what vercel, netlify and all the others have abstracted.

round widget
#

Yes I know I thought it was going to be easier 🤣🤣

cerulean crypt
#

My guess is that the python env in the container isn't correct.

run:
  runtime-version: 3.11
  pre-run:  
    - pip3 install pipenv
    - pipenv install
    - python3 copy-global-files.py
  command: pipenv run gunicorn django_apprunner.wsgi --log-file -

try specifying pipenv to run gunicorn

#

it's tricky to swap runtime providers because you're never quite sure which abstractions they include, I suspect if you used another container service like Fargate or a managed EC2 service like Elastic Beanstalk, you'd get a different set of requirements.

#

further, in the app runner environment, it may expect more flags on the gunicorn command with a settings file

olive relic
cerulean crypt
#

port binding is further down the process, currently, the container is trying to bootstrap the process with an invalid calling path. The problem is configuring the container service to have the right python environment. Tools like pipenv attempt to standardize it, pip and python don't quite act like npm and node.

olive relic
#

Ahh, so pipenv knows where it all is?

cerulean crypt
#

yea, pipenv makes a virtual environment and tries to intercept all the dependencies into a local config.

#

now you can see how node_modules ends up being the black hole that it is

#

in python, there's like "system python" which is built into the OS, and then theres your python

#

keeping them separate is a pain

olive relic
#

ahhhh I gotcha

#

thanks for the info

cerulean crypt
#

everytime I do python, it takes me forver to get the virtual env correct

olive relic
#

yeah, ts/js builds are bad enough, that seems like a second env in a container and could get twisted up easily.

cerulean crypt
#

@round widget , if I were to debug this, I'd write a bash file to log out path variables and create verbose install logs to force app runner to give me more info.

#

app runner, is a service that takes in simple commands to instantiate your whole app inside a container. at this point you are fighting against the virtual machine attempting to run your app. somewhere in AWS is a cpu with the most basic permissions doing its best.

#

This situation illustrates a common misconception that workloads are portable. Even if you fully containerize an app, whenever you switch platforms, there's always some level of incompatibility.

#

Curious, why is Render slow? Are you reaching the service limits on Render?

round widget
#

So much help thank you so much @cerulean crypt and @olive relic. I will try things tonight. What I don't understand @cerulean crypt is that I don't use container it's only with my repo, I shouldn't have to set up any yaml file. I also use venv to set up my environment I'm thinking right now that I've used Python 3.12 for the project and on AWS they have until 3.11. Does that matter? That's probably why the path is not found? On render I took the free tier and it takes so long to show the page. You can test it if you want https://community-blog-dia1.onrender.com/register that's why I wanted to change.

round widget
cerulean crypt
#

now's a good time to learn 😛

round widget
#

👍👍