I have my flask server running in AWS Elastic Beanstalk, however, I want to run some custom flask CLI commands that are listed in commands.py file of my repository. Previously when my server was hosted in Heroku, I was able to run these commands through the Heroku console, however I'm unable to figure out how to run these commands in Elastic Beanstalk or even go inside of the beanstalk environment and run my custom flask commands through the command line.
I tried using the eb cli but that seems to only allow me to mainly deploy, terminate, open the Elastic Beanstalk environment but nothing in the eb cli seems to allow me to even run flask --help inside the environment
even go inside of the beanstalk environment
If you use eb cli, then it would be eb ssh to ssh into your instance.
I'm unable to figure out how to run these commands in Elastic Beanstalk
Generally you would create .ebextentions config files with commands or container_commands to run the actual flask commands.
There are also other options, such as platform hooks.
Related
Context: I am playing around with Django and Vagrant and I would like to see if I can have them interact with each other where a Django app running locally can access a local Vagrant VM.
I have a Django app that I'm running locally using python manage.py runserver and I have a Vagrant VM that is up and running somewhere on my local machine in path/to/local/vagrant/vm. I would like to ssh and/or execute commands on the aforementioned local Vagrant VM through the Django app. Is that such thing possible? If so, how? If not, then how can I achieve something similar where I can have a Django app interact with a local VM.
The Django app and the Vagrant VM are independent in that the app is not running inside the VM.
From within VSCode, using the Azure web service extension, I can deploy a Hello-World flask app successfully to my Azure web app (linux, python 3.6 stack).
When I try to deploy my real flask app (with dependencies listed in a requirements.txt) file, and I specify "pip install --upgrade -r requirements.txt" as the web app "startup command" in the Azure portal, browsing the web app page gives an "Application Error".
The log for my web app shows the startup code failing when trying to build "psutil" due to the error unable to execute 'gcc': No such file or directory.
When the above failed, I also tried using "wheels" as part of my deployment as described here (https://blogs.msdn.microsoft.com/azureossds/2015/06/29/install-native-python-modules-on-azure-web-apps-api-apps/), but that didn't seem to change anything (same 'missing gcc' error).
Is this the correct way to deploy a flask app with python library dependencies from VSCode? I would expect that the deployment process would automatically process the requirements.txt (without having to specify the startup command) and I would expect it to be able to install the python libraries without error.
Due to you were using Azure WebApp for Linux based on Docker Container, the MSDN blog Install Python Modules on Azure App Services for Azure WebApp for Windows is not useful for your issue.
So for your issue of missing gcc error, per my experience, the solution to fix it is to configure a custom Linux container which had been pre-installed the gcc tool-chains and then to deploy your app into it from VS Code.
As references, please try to follow the documents below.
Configure a custom Linux container for Azure App Service . To install the gcc toolchains in a custom docker image via change the Docker file like install openssh as the section Enable SSH said.
Deploy to Azure using Docker from VS Code with Azure App Service extension.
I'm trying to deploy my own API. I am using Django and the Django Rest Framework. I have uploaded my Django via Elastic Beanstalk Command Line Interface via eb init and eb create.
I am following this tutorial and have followed all of the steps:
http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create-deploy-python-django.html
I have successfully created my environment and uploaded my app:
However, when I hit up the url via eb open, this shows:
How do I debug something that tells me nothing is broken? I feel like something is off. My intuition tells me it has to do with me trying to serve my API over SSL. I currently have my Django app redirect all http requests to https. Do I have to run manage.py runsslserver? Do I need to install any environment things from my requirements.txt file?
EDIT: Normally when I run python manage.py runsslserver, I'm greeted with this on localhost. I have set up an api-root and expected to see that when I hit the EBS url.
I've successfully been able to create and deploy ElasticBeanstalk environments using the eb cli tool, however now I'm trying to get my head around boto3 and deploying code.
But I can't for the life of me figure out how to actually deploy an app (or whatever the package containing the .ebextensions folder is called) using boto3.
Using eb cli, running eb deploy packages up that directory and uploads it all to AWS, with any changes to the .ebextensions to deploy the app.
However the docs for elasticbeanstalk for boto3 include:
create_application() - just makes the app specification, no uploading
create_application_version() - pulls a link to an app version, but I can't make one or upload one
create_environment() - makes the broader environment, still no good.
How do I actually deploy an app using boto, or am I stuck with eb cli?
I'm trying to deploy an app engine Managed VM python/flask application using the gcloud command.
When developing locally I can pass environment variables to my flask server. I do this so that I can read a config file per environment. For example:
gunicorn -b :8080 --env CONFIG_FILE=config_dev.py main:app
Now, i'd like to deploy my application and use config_production.py as my config file. It seems I'd need to pass the environment variable CONFIG_FILE=config_dev.py to gcloud preview app deploy to set it. I checked the help pages but didnt see a way to set this.
Previously when I was developing on app engine sandbox I could do:
appcfg.py -E ENVIRONMENT:dev update app.yaml
Is there an equivalent argument for gcloud?