Search code examples
djangocloud-foundryappfog

On AppFog or CloudFoundry, how can app update be forced?


I am deploying an Django/Python app on AppFog (which is based on CloudFoundry). Until recently, updates could easily be deployed using the af updatecommand. Here's an example:

consider a local file settings.py with some changes, e.g.:

  ...
  # CHANGES
  MY_SETTING = 'TEST'
  ...

Previously, when I issued af update myapp, waited until the app restartd and then look at the settings.py on the app instance (af files myapp app/settings.py), I would get back exactly the above, changed file.

Now all of a sudden, when I do the same steps, the changes are not applied. The restarted app always uses the old version of settings.py (and any other files that changed in between). I have tried to issue af update myapp --no-resources to force upload of all files, or to af push to a different app -- same result.

How can I force AppFog or CloudFoundry in general to drop whatever package it stores for my app and accept a fresh update?


Solution

  • It turns out that specific files can be updated in one of two ways:

    a) by giving the file name one by one:

    af update myapp --path myfile.ext
    

    b) by creating a zip file

    zip /tmp/update.zip file1 file2 file3
    af update myapp --path /tmp/update.zip
    

    While the first approach will update the specific text file, the second will update all the files contained in the zip file.

    Note of caution: If your source path contains a .zip or .war file, the af command will always use this .zip or .war file as the source for its update. See the code for details.