Python – Build-out deployment strategy

Build-out deployment strategy… here is a solution to the problem.

Build-out deployment strategy

So I’m applying zc.buildout to an existing django project. I would like to know to deploy it now. How do I implement sandboxing on a production server?

Solution

Not sure what “sandbox effect” means. If you mean “isolated build”: yes, that’s what builds do. If you specify it in ~/.buildout/default.cfg, it can use the per-user cache directory. If you want to use very strict sandboxing on your production server, you must turn it off.

Deployment usually means that certain parameters are different from those on the development machine. Debug mode for your web application should be turned off; A cron job must be configured; The port number is no longer the default 8080.

Solution: Place deploy.cfg next to your build. It should extend your buildout.cfg and only change some settings. The rest of the settings are the same as in buildout.cfg. Something like this:

[buildout]
  extends = buildout.cfg
  parts += 
      startup-cronjob

[instance]
  # Some changes, like port number.
  http-address = 13080
  debug-mode = off
  verbose-security = off

[startup-cronjob]
  # Example part that's new to the deploy.cfg, it wasn't in buildout.cfg.
  recipe = z3c.recipe.usercrontab
  times = @reboot
  command = ${buildout:directory}/bin/supervisord

Something like that!

Related Problems and Solutions