How do I setup a version control repository on a web hosting account? - version-control

I'd like to work on my own projects on different computers...on the road on a laptop, or at home on the desktop, or even at work. I'd like to keep the data relatively private, and I don't want to pay for private repositories on github.
Ideally, I'd host a git or svn repository on my web host, or something like that. Can I do that? Or is there a web services-based version control system out there that accomplishes the same thing?

I use beanstalk for my development (svn). You could also try github (git obviously).

I use beanstalk as well for about 2 months now, I'm very happy with it, it also has integration to lighthouse so I can close bugs/issues with commit to SVN.
I also have a local VPS server hosted and I installed the VisualSvn Server on it, it works great but it's a bit on the expensive side.

My hosting provider, Dreamhost, provides Subversion repositories (along with Trac). However, if you can install a repository depends mostly on your hosting provider and what features they allow. Some make it easy, others won't allow you to install what you need to even set one up.

Related

Easy Deployment with Github?

I searched the web now for several hours but couldn't get around this:
Is there an easy way to deploy a private repository from Github to a staging/development server on each push (or at least manually)? (Best would be if only FTP-data of development server would be needed for this).
I found this: How can I automatically deploy my app after a git push ( GitHub and node.js)? but this kind of "tutorial" in the best answer stops at the point of what exactly to insert into the build.sh. And what modules are needed for this on the development server? SSH, GIT, Ruby? Maybe this sounds stupid to you, or is a wrong thinking of mine, cause nowhere on the net I found any answer to this.
The problem is, that most time, the server on which the contents of the master branch should be deployed is on a shared hosting server, where you doesn't always have SSH, GIT, Python, Ruby, etc. on which most solutions for deploying from github seem to rely on... :/
http://beanstalkapp.com/ is really great at this, you can just enter FTP-Data and deploy automatically or manually for chosen repositories and branches. So I wondered why I couldn't find a similar easy way to deploy from Github?
Thank you very much in advance!
Jonas
It isn't really clear what type of project you have, but here are a couple of ideas.
If your code is written in a compiled language, then you could:
Have a Jenkins server as mentioned in the other comment
Write a simple script in bash that does a git pull and compile and add a cron job to it.
Use an automation framework like Chef or Puppet which would automatically keep the compiled binary up to date.
If your code is an interpreted language (like HTML & JavaScript), then you could:
Use vagrant for local testing. The biggest reason is that changes are live on your local system. It only takes a git push on your machine and a git pull on the production server to make your changes live globally.
Your best bet is probably going to be #2.

pros/cons of running own version control server

I do mostly small projects as a part of my research at the university, and have been using our SVN server, and also played around with Mercurial in connection with SourceForge.
I am wondering if running Mercurial or any other kind of version control on my home server would make sense. The SVN server I use at work is behind the university firewalls, and between the IT-department of the building and our IT-responsible in our department I think it's much of a hassle of starting new projects on the server and coding when I am at home. I have a Drobo FS (NAS) at home which I could imagine using for running a version control server, so that I can easily reach my code wherever I happen to be, without having to put my code on a 3rd party server.
What are the pros/cons of this approach compared to getting an account at a project hosting site with support for private projects? Is it feasible? If so, would it imply a significant maintenance workload?
The pros are that you are in full controll of your server:
you can set it up any way you want it
noone else has access to your source/project
The cons are that you are the only one that is responsible: you have to
ensure the proper setup
do maintenance
perform upgrades
ensure protection against power outages
ensure adequate security measures
ensure reguar back-up
etc.
Of course you should do it as soon as you have projects you don't want to open on servers like github.
Most small private teams have a source server, no reason not to have one. For example gitolite is easy to install and use (I don't know for Mercurial but I think there is an easy to install solution too, probably even easier).
A side effect would be you could use something a little more modern than svn, for example a decentralized vcs you could use at home and synchronize with your server (no need to use a server for every manipulation when using mercurial and git : just set up a local repository and push to your server from time to time).
Whenever you have distributed development (either because of a team across different geographical sites, or because you develop from different sites), a DVCS makes sense.
Don't forget that, on one site, if your team members have access to the git/mercurial repo filesystem (ie the shared path of the repo), you don't even need a server at all. Those DVCS supports filesystem protocol access (albeit without authentication or authorization), aka local protocol.
You can also share your project across sites with an external service like BitBucket (supporting both public and private projects, for Git or Mercurial)
If you have write access to university network (through an USB key for instance), you don't even need to access that external service (BitBucket could be blocked, it wouldn't matter).
A git bundle allows you to export a git repo as one file, from which you can pull from as it was a repo.
So you have various options in order to access/manage a repo from different site, without having to register yourself to a centralize server (like your SVN), which you couldn't access from any site (like from home).

Is there a way to publish a website from github or cloud9IDE directly to a web-host?

Is there a way deploy a website directly from github or cloud9 ide? using ftp or other way, right now it doesn't matter what hosting, just so it'll be fully functional and accessible online.
(I know github has a web-hosting of a kind but it seems very limited)
What webframework/language are you using? If you use RoR or Sinatra or any other rake-based framework you can use heroku.com. If your using asp.net you can use appharbor.com, finally if your using php you can use phpfog.com.
What these hostingproviders have in common is that you deploy the website by pushing your code with git, while you won't be deploying directly from github you can just add one of the above mentioned hosts to your remote-list (in addition to github) and then push to that remote when you wish to deploy.
Another solution would be to add a post-receive-hook to github which then triggers whenever you push to github, in that post-recieve-hook you could tell the webhost to pull from the repo. This does however require you to have git installed on the webserver aswell as some kind of webinterface for the post-recieve-hook to post to.

is there a deploy tool (or set of tools) that supports rollback of a deployment?

I'm learning FluentMigrator. The thing that I like about FM is that it supports the idea of Forward and Back for migrations (aka Up/Down). I'm finding that it's not ideal about this; there are some holes. Still, it's good.
This leads me to wonder if there are any deployment tools (nant, msbuild or other) that support this idea of rolling forward and back. The scenario that I'm using it in is the deployment of a web app with a related database.
Ideally I'd like to set up my deployment so that, should any part of it fail, it will revert to the previous known working configuration. With FM, this is pretty easy to do (but there are rough spots), so that covers the db. How about the files that make up the web app? Do any deploy tools have support for this?
Deploying to a Windows Server. Assume that I can't make any changes to the server.
I don't know of any Microsoft-centric, automated provisioning/deployment tools like Capistrano. Here are some tools I've heard of, but never used:
MSDeploy, for deploying web application.
Microsoft Deployment Services, for managing operating system configuration
Microsoft's System Center Configuration Manager
BladeLogic
HP's Operations Center
Up until about three months ago, we did our deployment/provisioning using custom MSBuild scripts. After a server is provisioned, deploys happen automatically using Robocopy to copy files to a share on the application server, updating changed application binaries and markup files. We've never had a need to rollback any of our deployments, but since our scripts are custom, we could write the logic if we needed to.
MSBuild is a terrible deployment/provisioning language. For the past three months, we've been writing all new scripts in, and porting existing ones to, PowerShell. It is wonderful. With version 2, there is support for running commands on remote servers, like SSH. We haven't used that functionality yet, but I'm looking forward to pushing setup scripts to remote server to provision and deploy at the same time.
We have been using Git to do our deploys for the last 6 months.
Here is the whole process:
CI server build the project
CI server checks it in to a local git repository
CI server pushes the changes to the centralised git repository
User creates an empty repository on the live server
User adds the central git repository to the remotes
User pulls the latest version over https (no need to open any ports)
It is a lot to setup in the beginning but once setup it works great. Deploys take seconds as only changed files get copied.
Another great thing about this method is that git keeps history of changes so rolling back is pretty simple. You can also roll back a few revisions and it's done straight on the live server. If something goes wrong reverting is super fast.
Also you can save some time if you use a hosted git service (github) for your central repository.
This is a very brief description but I can give you more info if you want.
Of course! My favorite is Capistrano. This was originally built for Ruby but I've found that it works just as well for other languages.
https://github.com/capistrano/capistrano

Organizing workflow with Mercurial and Netbeans (+ bitbucket.org?)

I've never worked with any version control systems before. Now I'm trying to learn Mercurial, but I'm confused (I've already read about 10-15 articles + hginit.com). I don't know how to organize the workflow.
I have a testing server and a production server. I work from my office computer and from my home laptop. I make changes directly on the testing server, and every week or so copy new code to my production server. I also need wiki/issues/etc. pretty much everything bitbucket.org has. I know that's a bad way of doing things.
Is there any tutorial or articles on how to organize the workflow? I'd also appreciate any schemes/sketches describing the process.
Thank you!
[Edit: Changed based on comments]
Using Bitbucket
Once you have created an account.
You should be able to create a repo with an appropriate url. Then you can clone it to create a local repository.
Check out getting started.
See the following to push the updates to BitBucket.
BitBucket comes with very extensive documentation.
Also there are, other useful tools to work with BitBucket:
BitbucketExtension that allows you to use command line for a number of operations.
Using Mercurial Queues and bitbucket.org
Organizing workflow
You will have to evolve a workflow that suits you. In your case, it looks like you have a testing server and production server.
So , you can setup two repositories, one for the testing server ad one for production. You can make push to testing server automatic so that you can test out the changes immediately. You can tag releases that are then pushed to production server.
Your local repo can be used to publish changes to testing server.
You can push the approved changes, tagged to BitBucket repository.