Synchronize OpenShift application after update

By | November 6, 2013

Advertisement from Google

For this blog I am using OpenShift cloud (started plan).

 

After updating wordpress engine through admin panel, updated files are not available in application git repository because they were not commited to git on remote server. To synchronize your OpenShift application with git repository you should perform following steps:

Install and configure rhc command line tool as described here

Connect to your application through ssh

  1. Go to OpenShift application page.
  2. Copy ssh connection string (like this ssh 2ec34a5ef38343c4a1a37619cf4b51e5@druss-druss.rhcloud.com)
  3. Run command:

Advertisement from Google

ssh 2ec34a5ef38343c4a1a37619cf4b51e5@druss-druss.rhcloud.com

Synchronize application

In ssh console run:

cd `mktemp -d` \
  && git clone -ns ~/git/$OPENSHIFT_APP_NAME.git . \
  && mv .git $OPENSHIFT_REPO_DIR \
  && cd $OPENSHIFT_REPO_DIR \
  && git reset HEAD

git add . -A

git commit -a -m "synchronized" && git push

rm -r $OPENSHIFT_REPO_DIR/.git

Your application repository is now synchronized with runtime changes.

Possible errors:

If you have old version of your application you could have  “CARTRIDGE_VERSION_2: line 1: 2: command not found”  error. To fix this error read this article

One thought on “Synchronize OpenShift application after update

  1. Norsen

    Hello, I found this article when I was trying to upgrade my blog to wordpress 4.1.
    The rhc installation and configuration were done, but later when I run cd ‘mktemp -d’ \, the console showed that “bash : cd: mktemo -d: No such file or directory.”
    Is there anything I miss or worng?

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *