Topic: Retrieving archived file uploads from a Capistrano deployment
Topic type:
In some situations, uploaded audio recordings and videos can be inadvertently archived when upgrading to a new Kete version using Capistrano. This topic details how to restore them.
An error can occur in some versions of Kete which causes audio recordings and videos to be saved to a different folder than they were previously. A side effect of this is that audio recordings and video files saved before the change become inaccessible.
This issue is fixed in recent versions of Kete, and upgrade details that move the files to the correct locations can be found in the UPGRADE document inside the Kete application folder.
However, in the case that you have been using Capistrano to manage your Kete deployments, you may need to perform some extra steps to ensure all uploaded files remain available:
Warning: Kete and Capistrano setups vary per instance. We strongly recommend reading through and understanding what the commands outlined below do before running them. Katipo takes no responsibility for loss of data as a result of performing the steps outlined below.
-
IMPORTANT: Completely back up your Kete application, including full Capistrano deployment folder on your hosting server, all uploaded files in public/ and private/, and database (normally MySQL) dump.
-
Upgrade your Kete source code, and update your deployment using Capistrano.
The method by which you do this varies, depending on how your set up as been configured.
Using a recent, stock Kete and standard Capistrano deployment, the steps would be something like the following:# Change to your local Git repository checkout $ cd my/local/kete/git/checkout # Download the latest version of the code # This command will vary depending on how your Git repository is configured. # If you've simply checked out from the Kete Github.com repository 'master' branch, # it will be something like the following: $ git pull .. # Deploy to your staging or production server. If you're not using Capistrano multi-stage, # you can omit the environment option. $ cap [environment] deploy:update
-
Log into your Kete hosting server, and change to your application's directory.
This should contain foldersapp
,config
,private
,public
, etc.. -
Check if any uploaded files are unable to be located by Kete:
$ rake kete:repair:check_uploaded_files
If this reports that all files could be found, there is no need to continue.
Otherwise, you should proceed with the steps below. -
Relocate recently uploaded files to the correct locations:
$ rake kete:repair:correct_upload_locations
-
Check whether files are still affected:
$ rake kete:repair:check_uploaded_files
If this reports that all files could be found, there is no need to continue.
Otherwise, files have probably been archived earlier deployments, so you should proceed with the steps below. -
Move 'up' one directory to the main Capistrano deployment directory
$ cd .. $ ls
You should now see folders named
releases
,current
(which is really a symlink), andshared
. -
Run the following commands to copy archived files to the correct location:
$ cp -Rpi releases/*/public/audio_recordings/* shared/system/audio/ $ cp -Rpi releases/*/private/audio_recordings/* shared/system/private/audio/ $ cp -Rpi releases/*/public/videos/* shared/system/video/ $ cp -Rpi releases/*/private/videos/* shared/system/private/video/
-
Re-run the checker rake task to ensure the files are now accessible:
$ rake kete:repair:check_uploaded_files
It should now report that all files can be found.
If you find that after running through all the steps above, Kete is still not able to locate all files, please post a comment to this topic (see below), or report an issue in our Issue Tracker, here: http://kete.lighthouseapp.com/projects/14288-kete/tickets?q=state%3Aopen.