Lets start by building an image.
$ toppcloud create-node —image-id 14362 —size-id 1 maetico.com
Creating node (image=Ubuntu 9.10 (karmic); size=256 server)
Status BUILD at IP 173.203.203.228
The hostname/ip is not setup in /etc/hosts
Would you like me to set it up? [y/n] y
Executing sudo python /home/elpargo/venvs/toppcloud/src/toppcloud-mongodb/toppcloud/update_etc_hosts.py /etc/hosts 173.203.203.228 maetico.com
So what is all that happen there? well toppcloud used libcloud to go to rackspace and create a node, using ubuntu 9.10 and the small 256MB image, it also added a nice shortcut so your machine will resolve properly even if DNS is not set yet.
Note: it will ask your for your provider and API key in your first run to create toppcloud.conf which is not shown up there.
Now we run:
toppcloud setup-node maetico.com
This will basically install toppcloud into the machine, in short it will setup your ssh key, Apache, mod_wsgi, Varnish, etc. everything you came here for. So it transform that vanilla ubuntu into a toppcloud machine.
Please note that setup-node is supposed to be non-distructive so previous installs can be upgraded. If it fails then it’s a bug.
Next
toppcloud default-node maetico.com
That’s to make all commands will go to that node, very handy.
Next to create a layout
toppcloud init ~/venvs/maetico.com
then we’ll create a index.html and drop it in the static folder.
and set default_host in your app.ini
[production]
app_name = maetico.com
version = 1
## Uncomment these to make them available:
#service.postgis =
#service.files =
#service.couchdb =
#service.mongodb =
runner = <insert your runner here>
## Uncomment to have /url called each time the app is updated:
# update_fetch = /url
## If you always upload this app to a particular hostname, use this:
default_host = maetico.com
Then we go for deploy
toppcloud update ~/venvs/maetico.com/
Note: you must end your path with / otherwise update will work but toppcloud will fail to find your app.ini
and if you go to the URL it’s up and running!
so what next? just make a change and run
toppcloud update ~/venvs/maetico.com/
change and update and change and update and again, super fast, super easy.
now for a real python app. go edit your app.ini and set the path to a WSGI file (it is relative to the basedir of app.ini)
make it something simple say:
from webob.dec import wsgify
from webob import Request
@wsgify
def application(req):
return “pronto aca…!”
update again and there python goodness!
Minor Notes:
Old deployments stay in the server and after a while they make add up cruft that is why we have
toppcloud query
toppcloud clean-node
query will show all old stuff as “defunt” and clean-node will get rid of it.
Also check out toppcloud serve this will give you a local server with code reload so you don’t have to waste those precious seconds waiting for the dev box to deploy.
PS: stay tunned for my new home page, it will replace that URL soon :)
PS2: next will be how to deploy a TurboGears app.
-
elpargo posted this