Live data from Hacker News

Ask HN: How do you push your code to your server?

news.ycombinator.com

11–20 of 22 posts

Re: Ask HN: How do you push your code to your server?

#16
say /var/www/html is where the code is served from.

Active symlink is maintained to the proper build which comes from (say hudson/jenkins)

Say the current symlink is /var/www/html -> build.v5

Below commands illustrate the sequence of the deployment via ssh for the next build number 6 (which can even be a no-op build)

tar jcf build.v6.tar.bz2 build.v6

scp build.v6.tar.bz2 prod-server:/var/www/

ssh prod-server 'VER=6; cd /var/www && tar jxf build.v$VER.tar.bz2 && ln -sf html build.v$VER && sudo service httpd reload'

Similar logic is followed with the help of git/etc. Idea is to 'keep versions' of your code. so that if things get messed up you can rollback quickly. Most people don't think of rollback, until it bites them really bad !

Re: Ask HN: How do you push your code to your server?

#17
I have built a custom tool Dploy(screenshots here[1]) for exactly this purpose. It's built using ASP.NET MVC.

To deploy a project (or a deployable, as I call it), you push to BitBucket. The latest changeset is then pulled using a post-commit hook.

Then it's just a matter of opening the Web GUI and press a button to do the actual deploy.

All manual steps are effectively removed. If the build/copy/whatever fails, nothing will break (hopefully).

Functions currently supported: * Real time output (using web sockets)

* Support for console applications, web applications (using IIS) and NServiceBus endpoints

* Run arbitrary post-deploy commands

* Show diffs so you know what you deploy

* Email notifications

* and more..

Planned functions: * Running tests

* Git support (currently Mercurial only)

* Arbitrary Windows services

* Special post-deploy commands depending on if you deploy up or down

* Deploy to other machines (local only at the moment)

It's not open source at the moment but i would love to do that. If someone want to help out, hit me up (nyquist [.] alexander @ gmail [.] com).

[1] http://imgur.com/a/tIRr9

Re: Ask HN: How do you push your code to your server?

#19
A similar question: how soon can you see results from a code change?

Another question: does pushing code interrupt the app?

I'm slightly embarrassed to say I hack on the server when I can, because it lets me have feedback quickly after a fix. It also helps stay focused; coding in a sandbox is boring by comparison.

Re: Ask HN: How do you push your code to your server?

#20

Here's what I do 1. Develop locally, use Github/Bitbucket for version control 2. ssh into my vps and use git pull 3. Configure things like api secrets (ssh + vim) If there is a bug that needs to be fixed, go back to local, fix, push, ssh, pull, deploy [update] Formatting changes

We did something like this earlier on (we use Chef for deployment now). I just wanted to point out that if you're using git pull as your deployment tool, make sure you use git pull --ff-only. You don't want to have to figure out merge conflicts in production.
Post reply on HN