1

I tryed to answer this my self, but all I can find is too complicated or far away what I need.

Is it possible to use Git/Bitbucket/Mercurial/… to maintain a lot of websites on my local machine (NAS) and keep track of changes and upload the right files when editing is done?

I don't need an online repository at github or something like that, don't I?

Why I want this?

I'm a web developer and have to maintain about 50 websites. In the past I edited my files either on my local machine and uploaded it via FTP or directly on the remote server.

Both are unsafe. In the first way I need to keep track what files are edited and upload all files. If I forget a file the page isn't up to date or worse the application/CMS wont work.

The second way isn't a good practice, because when something went wrong everybody on the web can see it ;-)

suntrop
  • 775
  • 3
  • 10
  • 24
  • Some maybe-helpful related links/questions, https://devcenter.heroku.com/articles/git http://stackoverflow.com/questions/9132144/how-can-i-automatically-deploy-my-app-after-a-git-push-github-and-node-js http://stackoverflow.com/questions/7303518/automatically-deploy-from-github-to-server-on-push – dbr Oct 04 '12 at 12:26

5 Answers5

2

I think what you really want is two things - a version control, like git, and a deploy mechanism. Git is a version control system. I don't see the need or benefit to involve git with the actual deployment.

What you could have is

  • git (hosting) to store your source code
  • Jenkins or similar to do CI + deployment

And possibly a binary artifact repo, too.

The way I see the process is that you do your changes and check them in. From thereon automated CI tool executes tests, does the analysis and possibly deploys a test build. You can then check that tests pass, what is the health of the code with analysis repots etc. If you feel like it, you could then push a button to deploy the changes to your sites.

The actual deployment tools to be used really depend on the details of your setup. Version control doesn't depend on that.

eis
  • 51,991
  • 13
  • 150
  • 199
  • question: what advantage does Jenkins do as opposed to simply deploying source that doesn't require to be built (compiled and bundled) from the source control, like SVN or git? if you don't wanna use anything more complex than the bare minimum that will do the job – amphibient Oct 04 '12 at 14:02
  • 1
    Well, if you just want to have the bare minimum and nothing more, then it will offer you the same thing with some more overall control and a more friendly user interface. however, even without compiling and bundling, there is lot of stuff that Jenkins or similar can help with - it can provide analysis on the code, run tests on it, compare the state of code to previous states, provide mechanisms for rollback (even automated), give you scheduled deployments etc. If you don't want that then that's fine too, but that is the way I would go. – eis Oct 04 '12 at 16:40
  • I would still emphasize that even without a full CI solution, *some* deployment mechanism would be warranted for. You can do it with git, but you can do it with tools that are made for it, too. Git isn't. – eis Oct 04 '12 at 16:49
  • ant / rake / maven ? to use the lowest common denominator – amphibient Oct 04 '12 at 16:53
  • Thanks all for your help! I feel like I am working like in 2003 :-( Is it possible to install it on my NAS (Synology)? I don't think it makes sense to buy 50 repositories on Github – suntrop Oct 04 '12 at 20:17
  • @suntrop which one? ant/rake/maven are command line tools, jenkins is a java application, usually deployed to a java servlet container. [more about jenkins here](https://wiki.jenkins-ci.org/display/JENKINS/Meet+Jenkins) - but you might want to first read about the principles of continuous integration, first. – eis Oct 07 '12 at 13:04
1

Yes, Git allows you to keep a local repository. Although your usage pattern sounds more like you'd want a central repository somewhere and a reliable deployment method for rolling out your sites once you're happy the changes are correct.

Jeff Watkins
  • 6,343
  • 16
  • 19
1

Git is great for your website development because each website can be a separate Git repository and you don't need any sort of server process. It's simple and clean. Plus, you can share your Git repository via FTP or even email. Imagine if on a particular website, you are working with another person. You can share your Git repo via patches passed through email.

Your real problem is keeping what you have in your Git repository in sync with the web server. What happens if someone edits a file on the server? Do you want that change?

In some sites the web server's directory is simply a checkout of the source repository. That allows you to make changes on the server, and commit them to your repository. It also gives you an easy mechanism to sync changes on your web server to your repository (Do an update). In fact, I've even seen it where a crontab job automatically sync's the web server to the repository on a nightly basis.

Of course, that means running an actual version control server process which is what you are trying to avoid.

David W.
  • 105,218
  • 39
  • 216
  • 337
0

Yes you can, there is no need to upload to internet and your app can read directly from one version or tree of one of some web versioned.

So if you have a code for web A, you can make a tree for "Web A with configs to run on local machine" and then point a virtual server on apache/iis poiting directly to the directory of the neww tree, the defaul tree is "master"

0

Yes, you can keep your projects in git repositories on, for example BitBucket, edit them on your local machine, check in when you're done (git commit; git push) and then login to the server when you host your websites and do git pull.

piokuc
  • 25,594
  • 11
  • 72
  • 102
  • Do I have to install something on my server? I've got a ManagedServer an no root access – suntrop Oct 04 '12 at 20:20
  • Check if you have git installed. But if you work with 50 projects simultanously then maybe you should setup a better deployment method, study the other answers and questions linked. Keep your projects in git but invest some time in setting up a robust deployment pipeline, it will pay off. – piokuc Oct 05 '12 at 07:43
  • Ok, I'll do that and have read some of them. I am quite struggling how this deplayment pipeline could like like. Just some rules for me and other team members are not really what I need you know :-) – suntrop Oct 05 '12 at 14:12