Вопрос

I'm trying to deploy a Flask application on AWS Elastic Beanstalk. I need to run custom Python scripts on an ad-hoc basis. I previously used Heroku and there, all I need to do is issue this command using the heroku toolbelt:

heroku run doStuff

where doStuff is the name of my Python module.

Is it possible to achieve this using the eb tool in AWS Elastic Beanstalk?

Alternatively I assume I'll have to SSH into the EC2 instance where the app is running and run the command directly there. If this is the case, where on the EC2 instance will I find the files of my app?

Thanks

Это было полезно?

Решение

Looks like you will have to SSH and run your scripts. Your deployed app version can be found here: /opt/python/current

One another option is to have a custom (and secret, may be) URL mapped to this in your flask app. When you hit the URL, then the execute the required commands.

If on the other hand, the scripts are required at app deployment / server restart, you can use the .ebextensions: http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/customize-containers-ec2.html#customize-containers-format-commands

Here you can setup various actions to be run before app code is run.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top