code4nothing / doh-score

a website for geeks who love tip&tricks
0 stars 1 forks source link

A one-click script deploys a white-page web-app in production #2

Open arialdomartini opened 10 years ago

arialdomartini commented 10 years ago

There's a simple script (hopefully: a python script, runnable in the terminal) able to deploy a walking skeleton web-app on a given VPS. After the deployment procedure, a dead-simple web-app is published and visible at a specific web URL.

The script runs with no human intervention (hence, it's able to setup the necessary software on the VPS.

arialdomartini commented 10 years ago

@mattiapiccinetti Two notes:

1 - I think this user story could be easier achieved if we could choose a WSGI container. At first I thought we could use a start script like

from app import app
app.run(debug = True)

which is suggested in the HelloWorld tutorial. Unfortunately, this is not only not scalable and not production ready, but it makes harder to manager the operation to stop the process (one could store somewhere the PID of the background task, but this is a weird trick to me).

I tried with Gunicon and I found that the solution come much easier

gunicorn app:app -p pid

serves the app in a background process, storing its pid in the file pid.

Gunicorn is just one of the several WSGI container we could use.

Do you have any preference? See more details here http://flask.pocoo.org/docs/deploying/wsgi-standalone/#gunicorn

2 - I realised I can't test my script (and send a Pull Request) before having a Hello World app. You could write one, then share the branch name with me: I will pull your code and include with my script.

arialdomartini commented 10 years ago

Ok, I managed to test my script (manually deploying a simple web app on the server). You can checkout the first version of the Fabric script from the branch https://github.com/arialdomartini/doh-score/tree/deployment.

As soon as you have developed a Hello World Flask web app we could merge our branches and procede with a PL.

'night!