What is Application CRUD? And how should I handle it in OpenShift?

Applies to: 

What is Application CRUD?
Application CRUD is defined by CReation/Updates/Deletion to Application files in the $OPENSHIFT_REPO_DIR on the gear itself. It bypasses our current git workflow where changes are made on a client machine (local git repo) and pushed to the gear (remote git repo). The problem it creates are:
1) Those changes are not versioned by Git
2) Those changes are not tracked by Git
3) Subsequent git pushes from the local repo will overwrite all files in $OPENSHIFT_REPO_DIR on the gear.


These are the current instructions of how to handle widespread CRUD that doesn't happen often (e.g., an application version upgrade initiated at runtime - Joomla 1.7 -> Joomla 2.5 for example):
0) Ensure that all your local changes are in synch
1) Make changes to your app at runtime (like the upgrading Joomla)
2) Take a snapshot of your app with "rhc app snapshot save -a {appName}"
3) Overwrite all your local repo files with the files in the snapshot.tar.gz (everything in app_root/repo/*). You'll need to extract the tar.gz first.
4) run "git add ." on your local repo
5) then run "git commit -a -m "upgrade Joomla to 2.5" and "git push"

The current best practice on how to handle CRUD that is more localized and happens very often (e.g., /uploads directory used when end-users upload files to the app/gear) is best shown with an example:

In this example, Wordpress has an /uploads directory that should be symlinked to $OPENSHIFT_DATA_DIR/uploads. The reason being, $OPENSHIFT_DATA_DIR is preserved across git pushes.