Re: code deployment through php

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, May 5, 2012 at 5:13 AM, tamouse mailing lists <
tamouse.lists@xxxxxxxxx> wrote:

> On Wed, May 2, 2012 at 5:23 AM, rene7705 <rene7705@xxxxxxxxx> wrote:
> > On Wed, May 2, 2012 at 11:47 AM, rene7705 <rene7705@xxxxxxxxx> wrote:
> >
> >> I can't use anything like git on my shared hoster. But I suppose I could
> >> use something like git at home, and use a sync script like I posted in
> my
> >> OP on the shared hoster.
> >>
> >>
> >>
> > Maybe you git gurus can help me along a bit further.
> >
> > I've managed to install msysgit and get it to work on my windows dev box,
> > so far so good.
> >
> > Now, I'm wondering how to set up my repositories. The last cvs I used was
> > Microsoft's visual source control back in the 90's, so I'm very rusty. At
> > the same time, I'd prefer not to experiment too much..
> >
> > I've got a tree structure in a folder called simply "code", that I have
> in
> > several locations on my windows box.
> >
> > Each site that I develop for has a folder in .../htdocs/sites/
> somedomain.com,
> > and many of these sites will need a copy of the common "code" folder in
> > them. I can restrict myself to developing in one domain's subdir only.
> > The non-common code for each domain is designed to run from any
> > $_SERVER['SERVER_NAME'] and any sub-directory it happens to be in. In
> other
> > words, http://my-dev-box.biz/sites/somedomain.com/ will show the same
> thing
> > from windowze as http://somedomain.com will from shared hosted linux.
> >
> > I would also like to version control the non-common code for each domain.
> >
> > And I would like to store the entire repository on my windows box at home
> > in 2 or 3 specific locations (on seperate disks encrypted with
> truecrypt.org,
> > and also a truecrypted usb disk, if and when that's plugged in).
> >
> > For distributing the common code to the shared hosted live server (my
> > workflow is to check finalized changes on my win box against all my sites
> > that used the common code base, before deploying to the shared hoster
> live
> > server), I can simply FTP one finalized copy and use the simplest of rm
> -rf
> > and cp -r commands in a short script to distribute the changes. I could
> > even do without the PHP filesync code I posted earlier (altho it was fun
> to
> > build! :)
> >
> > That darn hoster of mine won't support git on shared hosting, only on
> much
> > more expensive virtual dedicated and dedicated plans :(
> > But I've also found
> >
> http://serverfault.com/questions/26836/setting-up-a-git-repo-on-my-godaddy-hosting-plan
> >  and
> >
> http://www.lyraphase.com/wp/uncategorized/how-to-build-git-for-a-host-with-no-compiler/
> > that
> > show me how I might get git running on my (kinda lame now) shared hosting
> > account.
> >
> > Maybe a stupid question, but would perhaps copying the common code around
> > with a simple script be faster than multiple pushes by git?
>
>
> Using git, you can set up either publicly hosted repositories on
> github.com or gitorious.org or perhaps other public repo places. If
> you don't want you code to be publicly available, you can set up
> private repositories as well.
>
> Not being familiar with Windows implementations much at all, I can't
> tell you specifically what to do with msysgit, so these will be more
> generic instructions.
>
> I'm going to assume you don't have a host somewhere with ssh access.
> In this case you'll most likely want/need to set up your repository on
> your local system. (Note that it isn't *strictly* necessary to have a
> repository -- you can clone a new tree from the existing code tree,
> however having a repository can ensure a clean code set in case your
> working tree gets out of sync somehow.)
>
> (These instructions are modified from
>
> http://tumblr.intranation.com/post/766290565/how-set-up-your-own-private-git-server-linux
> )
>
> First, create a directory you want to hold all of your local
> repositories (such as C:\User\rene\MyRepositories). Then create a
> subdirectory off that to hold your server/application common code
> (C:\Users\rene\MyRepositories\commoncode).
>
> Make that directory (..\commoncode) a *bare* repository. (Not sure how
> that's done with msysgit, but the basic git command is: "git init
> --bare C:\Users\rene\MyRepositories\commoncode")
>
> Then you add the repository as a remote to the working tree: git
> remote add origin C:\Users\rene\MyRepositories\commoncode
>
> Now you can push commits to your repository with the following sequence:
>
> git add <files you want to commit>
> git commit
> git push origin master
>
> Now, to *deploy*, you can do the following:
>
> Somewhere outside your working tree, create a directory called "deploy":
>
> mkdir C:\Users\rene\deploy
>
> Then clone your the repository of your commond code:
>
> git clone C:\Users\rene\MyRepositories\commoncode cleancode-20120404
>
> Then you can ftp the contents of cleancode-20120404 to your server as
> needed.
>
> Sorry to be unable to tell you the exact steps with msysgit, but I
> hope you can interpolate from the commands above.
>

Thanks for that useful info, tamouse..

I didn't check this list for a few days thinking the thread had gone dead,
but I did manage to figure git on windows out.

I do need a bare repo for my common code, which I've put on a crypted disk
somewhere.
The command on msysgit is btw the same as a linux git command..

In each .../htdocs/sites/someDomain.com, under which I have the common code
in the folder "code", I have a file called .gitignore, which contains;

/cache
/code
*~

this ensures that my cache and common code folders, plus vim backup files,
are not put into the domain repo ("git init" in each
/sites/someDomain.com/).

then, to ease cloning and pushing of the common code, I have 2 .bat scripts
in my %PATH%;

code-c.bat: (fetch from master bare repo) (only to be executed in
.../sites/someDomain.com)
echo Y | rmdir /s code
git clone X:\path\to\myCommonCode.git HEAD

code-p.bat: (push local changes back into master bare repo) (only to be
executed in .../sites/someDomain.com/code)
git push X:\path\to\myCommonCode.git HEAD

to initialize the master bare repo X:\path\to\myCommonCode.git with my
code, I enter the latest code dir; .../htdocs/sites/someSite.com/code, and
do the following there;

git init
git add .
git commit -m "Initial commit"
code-p

Now, if I understand it correctly, I can backup all the relevant
directories and (hopefuly safely?!) backup the git repos all with simple
xcopy /s commands (cp -r on linux).
So that's what I'm doing now, I have a batch script to copy everything with
xcopy to another permanently attached large crypted usb drive in
.../backups/[date-time] category/, and another batch script like it to do
the same to a crypted usb drive (against breakins and such).

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux