Hi all,

I've been trying out the www.bluemix.net IBM PaaS. 

It took me a bit of digging to realise there is in fact a Python runtime. 
But you need a buildpack. The setup is different enough from Heroku to 
warrant this mini-HowTo:

Step 1:

Use the source version of Web2Py and copy the entire lot into a folder 
path: 'env/app' so that web2py.py is in the 'app' folder.

Step 2:

You need to have a requirements.txt file in the 'app' folder -- even if it 
is empty. (Although you might want to add a single line with just psycopg2, 
for example.)

Step 3: 

You need to have a manifest.yml in the 'en'v folder (top level of the 
project) with something like the following content:

applications:
- host: mycoolapp
  name: mycoolapp
  command: python web2py.py -a 'yourpassword' -i 0.0.0.0 -p $PORT
  path: app
  domain: ng.bluemix.net
  mem: 128M
  buildpack: git://github.com/ephoning/heroku-buildpack-python.git
  instances: 1

You need to make sure that 'mycoolapp' is changed to be unique and 
'yourpassword' is changed, too, obviously.

Step 4:

Push this entire 'env' directory to BlueMix by navigating to the 'env' 
directory and running:

cf push

This assumes you have installed the CloudFoundry CLI command line tool, 
although it also works if you put all the same resources described above 
into an empty/new linked JazzHub git project from BlueMix and simply press 
'Deploy' from the web page provided. Handy.

Some points to consider:

1. The file structure will hold and run the default SQLite db internally, 
but that's probably not what you want because the files are not 
designed/guaranteed to be persistent (flushed with a new/fresh deploy, for 
instance). Instead you can add PostgreSQL and use that for data persistence 
-- BlueMix gives you a Postgres connection URL, ready to use! You just add 
it as a service to the app.

2. If you change instances = 1 to a larger number, then you'll probably 
also want to add a Redis service and use Redis for sessions (or a db for 
sessions). This will most likely allow people to remain logged in when they 
are load balanced via round robin to another instance, but I have not 
tested that. (What I *did* test is that you don't stay logged in with 
multiple instances running, which suggests for larger-scale apps with 
multiple instances running you'l want a central Redis for sessions.)

3. You get a SSL-ready address at something like 
https://mycoolapp.ng.bluemix.net (wildcard certificate exists for 
*.ng.bluemic.net), but since it seems to have some kind of reverse proxy, 
Web2Py doesn't detect that the admin is being used under HTTPS: so you 
might want to also store errors in the DB, too. The default with Web2Py is 
errors in stored the file path. Or modify the app admin to ignore HTTPS 
(just remember to use HTTPS when logging in!) 

I hope this helps someone. BlueMix is free during Beta. Pricing to be 
announced in June, I think. It will be interesting to see what the pricing 
is.

Overall I think the service is pretty good -- especially if you need formal 
DevOps. IBM have made the DevOps thing quite neat in BlueMix. I 
particularly like being able to 'click the Postgres hexagon' and get a DB 
connection URL back without any install/setup issues.

Regs,
Duncan.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to