Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Deployment using Git
  • As I'm used to with previous projects, I always deploy my apps using Git. On deployment I pull the newest version from my repo. However, as I understand, with deploying Fuel the strategy is to put the app outside of the public accessible files, put whatever is inside your public folder where your apps root should be and configure the paths inside the index.php to your apps path. With Git however, as you can't do partial checkouts, it will always keep the folder structure as in the repo. So moving your public folder will take it out of the repo. There are files in the public folder (javascript, css, images) I do want to pull from my Git repo as I deploy a new version of the app. How do you guys tackle this problem? One idea I've yet to try is add the public folder as a submodule so you can check it out in a seperate location. I would rather not do that though, if not necessary. How do you deploy your beautiful new Fuel apps with Git?
  • I just add the entire structure to my git repository, and then checkout. I then make 'public' my webroot.
  • Scott Luther wrote on Thursday 7th of July 2011:
    I just add the entire structure to my git repository, and then checkout. I then make 'public' my webroot.

    Thx for your reply. What do you mean exactly? Do you mean you configure your webserver to use Fuel's public folder as the webroot? Allthough the idea is good, we don't always have the freedom to do that. Especially with the servers from clients that are already hosting stuff and don't have a dedicated box for the app. Changing the your webserver's root doesn't seem flexible enough for me. Aren't you supposed to easily deploy your app on different machines without hours of configuring?
  • I don't see the problem, an application (any application) has exactly the same structure as Fuel. The Fuel repo (fuel/fuel) contains only your application folder structure, and uses submodules to link the other repo's in. For my applications I recreate the Fuel repo (as a fork of fuel/fuel), the different Fuel components stay as submodule directly linked to Fuel's repo's, so within my application I can update or switch branches on fuel/core without impact to the other submodules or my application. For deployment I pull the entire repo, inclusive of submodules. I don't see why you would need a 'partial pull'...
  • Harro Verton wrote on Thursday 7th of July 2011:
    I don't see the problem, an application (any application) has exactly the same structure as Fuel. For deployment I pull the entire repo, inclusive of submodules. I don't see why you would need a 'partial pull'...

    The problem is that you will have to move the public folder outside of your repo and into a publicly accessible part of your server, preferably where you want the root of your app want to be. Say I want to deploy my app on my server that is linked up to the example.com domain. I want the root of the app to be at the server's root, so that http:///www.example.com boots up my app. Now I have two options: pulling the repo into my "public_html" folder (or whatever your root folder might be) , but then the root is at http://www.example.com/public, or pulling it somewhere else and moving the contents of my public folder into "public_html", and update the paths in index.php. Problem with moving is that you're moving outside of your repo, so a pull won't do much. The first solution (whole repo in root) kinda defeats the purpose of the whole seperate public folder anyway, so handling that with a url rewrite in .htaccess and a set baseurl, is something I'm trying to avoid. Hopefully this explained the issue a little better, or am I just seeing ghosts?
  • Why? My webservers have a /data/web/virtual directory, in which I create a folder for every website that is hosted on that webserver. Say I want to host http://www.example.com. I create /data/web/virtual/www.example.com, I setup my deployment to deploy the repo to this folder, and create a virtualhost definition that contains a docroot /data/web/virtual/www.example.com/public. Problem solved. If you are on a shared host, you can use the same setup, since you only have one web application running, because only one public_html exists. This is because you'll get FTP access to the location above public_html. In this case the 'public' in Fuel becomes 'public_html'. If you are so unlucky that your hoster doesn't give you access to anything above public_html, you either keep the same structure in place, live with the fact that you'll have 'public' (or something else) in your URL's, and use a Rewritebase in your .htaccess to deal with this. Or you'll alter the structure so that your repo root becomes your public, in which case you'll have to take measures to make your code inaccessable since they are now in the docroot.
  • Thx for the suggestion, when you have access to these settings its a good way to set stuff up, works like a charm! When you (client, grr) have shared hosting, that uses virtual document root, you cant change your root folder, its no good. Especially because loads of them already have stuff on their servers. Your last suggestion, moving public to the root of your repo will work, but is exactly what we're trying to avoid. You shouldnt want to change your repo's structure for a single environment. Anybody with a suggestion on how to deal with such a situation?
  • You might be able to create something using a rewrite in the root, that rewrites to public/index.php/$1. Something along the lines of http://chanon-srithongsook.info/development-notes/change-main-domain-to-subfolder/ ?
  • Either way, on shared hosting, there doesnt seem so be a way to deploy with your app in non public space. You end up rewriting the url and setting your baseurl in order to let Fuel make links without the public in it in order to let the structure of your repo unaffected. then access to any other folder has to be denied. Or does somebody else have a better suggestion?
  • There are only two options:
    - keep the existing structure and deal with 'public' being in the path (accept it or rewrite it out)
    - modify the structure so everything is inside 'public' (make public the repo root) I don't see a problem with the second option, since fuel/fuel is a one-time checkout (it's your app structure), all the others (core, packages) are separate fuel repo's that you can place whereever you want, without loosing the ability to update them separate from your application.
  • The second option would work, but the idea of the fuel deployment strategy just really appeals. I guess you could make the public its own repo. Probably not semantically correct, but it would let your repo structered the way it is, not for a specific environment, but also move the public folder where you would like without it being unversioned. Downside is that public updates would have to be commited and pulled seperately, but a script could easily aid in that. Going to have a fiddle with different strategies, ill post back with my experiences.

Howdy, Stranger!

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

In this Discussion