Skip to content

Project Local Path #34

Open
Open

Description

@will3m

Is it possible to set the project's local root path in the config file? It would be very useful for deploying multiple git projects at once using only one config file.

If not, what would be the easiest approach of implementing this feature? E.g. which functions are important...

Thanks for this awesome script!

PS: I know I'm trying my luck here. The neatly typed usage document, states that one should drop the deploy script within a project. It suggests that one should have git-deploy-php and a set of config file for each git project.

Activity

  1. pocketarc commented on Mar 28, 2014

    @pocketarc
    Owner

    @will3m This isn't possible at the moment, but it definitely sounds interesting, and your suggested implementation is actually quite simple, so I might add that.

    For now, though, let me share a bit about a workaround I have been doing, you may find that it suits you.

    I keep all my projects in a folder called "htdocs". All of them have a deploy.ini (they don't have the git-deploy file). I have a "deploy" command in my system path, that does the following:

    #!/bin/sh
    php /path/to/git-deploy-php/git-deploy --repo /path/to/htdocs/$1 "${@:2}" /path/to/htdocs/$1/deploy
    

    With that, I can write a command like "deploy project1 && deploy project2 && deploy project3", and they're all deployed at the same time. You could even save that as a "deploythreeprojects" command, and then you'd only need to type that.

  2. will3m commented on Mar 29, 2014

    @will3m
    Author

    @BrunoDEBARROS Thanks for the quick reply. Passing the arguments (with shifting) in bash is a nifty trick I learned yesterday. Your suggestion would be very useful if I was at liberty to use shell scripts. That said I'm sure others will benefit from this feature whether they are using bash scripts or not.

    In the main function where git is instantiated one can just move that line into the for each server loop and then replace the parameter with a variable from config file. I not gotten around to test though. I'm sure my quick hack will break your --repo option.

    The idea, for me, is to run php git-deploy-php staging here's a hypothetical example of what my deploy structure looks like.

    deploy-root
    |-- framework1
    |   |-- client-config1
    |   |-- client-config2
    |-- framework2
    |   |-- client-config3
    |   |-- client-config4
    |-- git-deploy-php
    |-- staging.ini
    `-- production.ini
    

    -- Personally I would automate it using a script like you suggested.

  3. pocketarc commented on Mar 30, 2014

    @pocketarc
    Owner

    What I was thinking about doing, actually, is have a "repository" option in the .ini files that you could use to override the repository to use for deploying. 

    What that'd mean is that you could have a folder with git-deploy and a deploy.ini that contained the deploy configs for your projects, along with their repo paths, so that when you did "git-deploy", it'd automatically deploy all of your projects. 

    That sounds clean and simple to me. Thoughts?

  4. will3m commented on Mar 31, 2014

    @will3m
    Author

    My thoughts exactly. The structure was mainly to illustrate that one repository may contain more than one deployment strategy. Essentially the repositories could be scattered all over and still be deployed from a single "git-deploy".

  5. pocketarc commented on Apr 4, 2014

    @pocketarc
    Owner

    It sounds like a great idea; I'll try to add this to git-deploy-php as soon as possible.

  6. will3m commented on Apr 4, 2014

    @will3m
    Author

    Here's how I got it working, sorry for not sending a push request.

    Main (added path var)

      foreach ($servers as $server) {
    
        # Sets the repo path config has priority over application argument
        if (is_array($server->server) && array_key_exists('repo_path', $server->server))
          $path = $server->server['repo_path'];
        else
          $path = $args['repo_path'];
    
        $git = new Git($path);
    

    Config (added repo_path)

    # Throw in some default values, in case they're not set.
    $options = array_merge(array(
      'skip' => false,
      'scheme' => 'ftp',
      'host' => '',
      'user' => '',
      'branch' => null,
      'pass' => '',
      'port' => 21,
      'path' => '/',
      'repo_path' => '',
      'passive' => true,
      'clean_directories' => array(),
      'ignore_files' => array(),
      'upload_untracked' => array()
    ), $options);
    

    Let me know if it makes sense.

  7. newelement commented on Feb 23, 2016

    @newelement

    I need a little assistance with this. I have deploy.ini and git-deploy in the same folder. My actual repo exists in a folder next to them called repo. How to I use the subdirectory repo ?

  8. pocketarc commented on Feb 24, 2016

    @pocketarc
    Owner

    You can use the --repo command line option to specify a path. I don't believe we've added this 'repo_path' .ini option yet. Alternatively, you can put the deploy.ini in your repo, and then just doing git-deploy /path/to/repo/deploy.ini.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions