Hi all, A small script I'd like to share -- I use it for zero-downtime Web2Py deploys to Bluemix (using a so-called Blue-Green deploy method).
The script takes advantage of knowing that domain-mapping to apps is in 'routes.py', using that to map routes in Bluemix to the new deploy. I posted earlier about how to prepare a manifest.yml file which does the rest of the work mapping services and setting memory/instances, etc. In short, I run this deploy.py from my app directory and it does the rest. Regs, Duncan. import subprocess, getpass # Set your config items here: username = '[email protected]' org = '[email protected]' space = 'dev' app = 'thisismyappname-main' # Get password and log in pwd = getpass.getpass('Password:') print('Please wait....') print(subprocess.check_output(['cf','auth',username,pwd])) print(subprocess.check_output(['cf','target','-o',org,'-s',space])) # Check if we are green- or blue-mode currently apps = subprocess.check_output(['cf','apps']) if app + 'green' in apps: color = 'blue' else: color = 'green' print('Pushing: "'+color+'". Please be patient.... This could take a while depending on your upload speed.') print(subprocess.check_output(['cf','push',app+color,'-f','./manifest.yml'])) execfile('app/routes.py') for domain in routers['BASE']['domains']: print('\nMapping route: '+domain) try: print(subprocess.check_output(['cf','map-route',app+color,domain])) except: print("Skipping "+domain) try: print(subprocess.check_output(['cf','map-route',app+color,'.'.join(domain.split('.')[1:]),'-n',domain.split('.')[0]])) except: print("Skipping with host "+domain) if color == 'blue': print(subprocess.check_output(['cf','delete','-f',app + 'green'])) else: print(subprocess.check_output(['cf','delete','-f',app + 'blue'])) print("Blue-green deploy complete.") -- 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.

