2014-05-16 02:04


I have a symfony 2 project I am trying to launch on OpenShift online. I created the directory as required and running symfony locally works perfect.

However, when I deploy to my OpenShift application the deploy and post_deploy action_hooks do not run. I do not even see the output on git push like they mention in the documentation.

I should also note that I can ssh into the app and create a that will run the exact same code and work as intended.

Any help would be greatly appreciated, I've placed multiple tickets with the support staff and no luck.

Here is a link to a screenshot of the directory structure:

Below is my post_deploy hook:

# This deploy hook gets executed after dependencies are resolved and the
# build hook has been run but before the application has been started back
# up again.  This script gets executed directly, so it could be python, php,
# ruby, etc.

# set the location for composer home to the data dir

# check if composer exists in data dir
if [ ! -f "$OPENSHIFT_DATA_DIR/composer.phar" ]; then
    curl -s | /opt/rh/php54/root/usr/bin/php -- --install-dir=$OPENSHIFT_DATA_DIR
    /opt/rh/php54/root/usr/bin/php $OPENSHIFT_DATA_DIR/composer.phar self-update

# check and set the symlink for vendor dir
if [ ! -d "$OPENSHIFT_DATA_DIR/vendor" ]; then
    echo !!! vendor directory does NOT exist - creating symlink...
    mkdir $OPENSHIFT_DATA_DIR/vendor
    echo !!! created vendor directory - creating symlink...
    echo !!! created symlink - setting permissions on directory...
    chmod -R 0777 $OPENSHIFT_DATA_DIR/vendor
    echo !!! permissions have been set on vendor directory!
    echo !!! vendor directory already exists - skipping symlink...

// shortened for brevity, but the rest is the same.

# use composer install
( unset GIT_DIR ; cd $OPENSHIFT_REPO_DIR ; /opt/rh/php54/root/usr/bin/php $OPENSHIFT_DATA_DIR/composer.phar install )
  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答


  • donglan8999 donglan8999 7年前

    Make sure that you are making your action_hooks executable (chmod +x) and then adding that information to git, and do a git push. On Windows, you'll need to run:

    git update-index --chmod=+x .openshift/action_hooks/*
    点赞 评论 复制链接分享
  • duandan5471 duandan5471 7年前

    (This is not an answer but I do not have enough reputation to make a comment on your post)
    To improve your hook you should check on $OPENSHIFT_REPO_DIR/vendor presence. If the $OPENSHIFT_DATA_DIR/vendor dir already exists your symlink won't be created.

    # check vendor dir
    if [ ! -d "$OPENSHIFT_DATA_DIR/vendor" ]; then
        mkdir $OPENSHIFT_DATA_DIR/vendor
        chmod -R 0777 $OPENSHIFT_DATA_DIR/vendor
    # check symlink
    if [ ! -d "$OPENSHIFT_REPO_DIR/vendor" ]; then
        ln -s $OPENSHIFT_DATA_DIR/vendor $OPENSHIFT_REPO_DIR/vendor
    点赞 评论 复制链接分享