Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Managing a FuelPHP website with git
  • I'm looking for a way to maintain a website build with FuelPHP, with git. My starting point is this guide: http://toroid.org/ams/git-website-howto
    Combined with this tutorial: http://blip.tv/fuelphp/creating-a-fuelphp-application-repository-5688973 My dream workflow would be something like this:
    I develop my code on my local machine, when done, I push to my git remote named "testing".
    I then go to my testing url, ex: testing.example.com When I think it seems to be working I push to my git remote named "live".
    I then got to my live website at: example.com. In commands it would be something like this:
    *edit files*
    git add .
    git commit -m "Made changes bla bla bla"
    git push testing master
    *tests testing.example.com*
    *seems to be working*
    *makes a few changes so I can commit*
    git add .
    git commit -m "Go live bla bla"
    git push live master
    *goes to example.com*
    *whooaa!*
    

    By following the "Using Git to manage a web site"-guide, I have created a post-receive hook, which in someway works.
    The only thing missing in my website folder is all of the submodules:
    - fuel/core
    - fuel/packages/* I tried adding: git submodule update --init
    But then I end up with: "You need to run this command from the toplevel of the working tree". If anyone could help my make this dream workflow become a reality, I would be extremely grateful!
    Best regards,
    - Henning
  • If I understood well, your problem is to run git submodule update --init from the post-receive hook?
  • Yeah, I get: "You need to run this command from the toplevel of the working tree"
  • I don't know what you have in your post-receive hook, but maybe just changethe directory before updating the submodules. Like
    cd /path/to/you/project && git submodule update --init
    
  • I tried that and I got something like:
    - "You need to run this command from the toplevel of the working tree" I did however figure out a way to do it. I went in to /var/www/myFuelPHPApp
    And did a git clone and a git submodule init followed by git submodule update.
    And I also believe that I did git submodule foreach git checkout 1.1/develop && git submodule foreach git pull origin 1.1/develop My post-receive hook looks like this now:
    #!/bin/sh
    unset $(git rev-parse --local-env-vars)
    cd /var/www/myFuelPHPApp
    sudo -u www-data git reset --hard HEAD
    sudo -u www-data git pull
    sudo -u www-data git submodule foreach git pull origin 1.1/develop
    

    Notes
    I added this line to /etc/sudoers
    git ALL = (www-data) NOPASSWD: /usr/bin/git
    

    I did that because I had some problems with permissions and stuff.
    Furthermore I added www-data to the "git"-group, and now it all seems to work.
    I just need to deny access to the git files and folders, like .git etc.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion