I am trying to deploy a python flask app on an Amazon Linux EC2 instance. I am unable to spin up the upstart script and get it running.
I am following this tutorial (which is for ubuntu): https://www.digitalocean.com/community/tutorials/how-to-serve-flask-applications-with-gunicorn-and-nginx-on-ubuntu-14-04
My config file looks like: myapp.conf
description "Gunicorn application server running myproject"
start on runlevel [2345]
stop on runlevel [!2345]
respawn
setuid user
setgid www-data
env PATH=/home/ec2-user/flask/venv/bin
chdir /home/ec2-user/flask
exec gunicorn --workers 3 --bind unix:app.sock -m 007 wsgi
My wsgi file looks like: wsgi.py
from app import application
if __name__ == "__main__":
application.run()
My actual application looks like: app.py
from flask import Flask
application = Flask(__name__)
@application.route("/")
def hello():
return ""Hello World"
if __name__ == "__main__":
application.run(host='0.0.0.0')
When I do a:
sudo start myapp
I get an error saying unknown job. What exactly do I have to do to get this running? Or is there a different way to make upstart scripts on Amazon Linux instances? Could someone please help