How to keep file sync'd in OpenShift?

For OpenShift:

I created a test directory in ~ app-root/repo/data.
I also have locally ‘myapp'/data directory. I can push up to OpenShift with git. My test files upload fine which I can check with ssh.

Now I create a file with nano or vim remotely –file named remoteFileVim The files exists in the repo/data directory. When I do git pull locally, I dont see that file remoteFileVim.

I created a second file in app-root/data called secondVimFile, How do I pull this file to local machine. Can I use git? I have python 2.6, cron, mysql loaded on Openshift, if that helps.

  • continuous integration with travis ci and openshift
  • Can't git clone openshift repository on Ubuntu machine
  • PHP MySQL 5.5 db connection in Openshift
  • Git - How to commit a local repository to a subfolder of another local repository?
  • Remove an Openshift server from RHC
  • OpenShift EGIT Eclipse
  • Deploy JSF App on Openshift DIY Tomcat not working
  • auto uploading from openshift rhc to github?
  • 3 Solutions collect form web for “How to keep file sync'd in OpenShift?”

    If you can ssh into the machine, you should be able to read or write files using scp.

    Simply placing new files within your Openshift gear’s ~/app-root/repo/ folder will not cause the files to be included (checked in to) your revision control system. Normally, you should be using git commit and git push to make the majority of the changes to your app locally, then follow up by pushing those changes to your OpenShift gear.

    If your app needs on-disk storage, or access to additional content such as secret tokens and keys that you would prefer to keep out of your source code – you can place this content in your ~/app-root/data folder. This directory is not effected by deployments, and has been set aside for your app’s local disk storage needs.

    Check this blog: https://community.jboss.org/people/ozizka/blog/2013/01/06/openshift–how-to-make-uploaded-files-public

    OpenShift applications code is uploaded using Git.
    Any changes in the repository directory is recreated after push.
    Therefore, storing uploaded files in there won’t work.

    The only persistent directory you can use is ../data. It’s full path is stored in environment variable $OPENSHIFT_DATA_DIR.
    However, this dir is not public – so no URL leads there.

    The solution is quite easy – just create a symlink. Here’s an example for PHP.
    Login to your machine via SSH, and run:

    mkdir app-root/data/photos
    cd app-root/repo/php    #  php/ is the only publicly accessible directory (by default, not sure if not changeable in .htaccess).
    ln -s ../../data/photos photos
    

    This makes the content in ../data/photos publicly accessible at http://myapp-myaccount.rhcloud.com/photos/ .
    The directory to manage the files in can be referred to using $_ENV['OPENSHIFT_DATA_DIR'].

    anything you do do remotely (including SSH) happen in app-root.
    GIT uses app-deployments.
    you need to copy the files from app-root to your computer, then push them with GIT. ALSO, NEITHER /data, nor app-root scale. only app-deployments>current gets scaled.

    Git Baby is a git and github fan, let's start git clone.