News for hackers. Stuff that matters.
Re:GIT is the new FTP by rickmb on Wednesday July 18, 2012 @04:59AM (#4259974)
Every time someone comes up it with a "cool" way to deploy via Git, it turns out their definition of "deployment" is nothing more than dumping something on a server. It completely ignores every aspect of deployment other than putting the files somewhere else, which is 5% of the work and 1% of the complexity of deployment.

That's not even a sufficient professional scenario for anything but the simplest of non-essential website. Hell, this won't even do for the simplest of WordPress sites.

BTW, who on earth still uses FTP?

Re:GIT is the new FTP by StacyC on Wednesday July 18, 2012 @09:47AM (#4260671)
BTW, who on earth still uses FTP?

I use Transmit to FTP updated files to my web server. Then I send smoke signals to my colleagues to inform them of the changes, and document the updates on a papyrus using quill and ink. Should I be doing it differently?

Re:GIT is the new FTP by glesica on Wednesday July 18, 2012 @11:04AM (#4261055)
I actually assumed "smoke signals" was some sort of Mac app that I didn't know about (it actually sounds like it could be a 37 Signals product). I even wondered if "papyrus" was a team-management wiki or the like. Then I got to "quill and ink" and realized you were joking.
Re:GIT is the new FTP by numbsafari on Wednesday July 18, 2012 @12:56PM (#4261634)
He wasn't joking. "Quill and ink" was a Microsoft prototype tablet.
Re:GIT is the new FTP by astrodust on Wednesday July 18, 2012 @11:00AM (#4261032)
You'd get better results if you lit signal fires. Smoke signals don't work very well at night or on overcast days.

I've also found that using parchment makes updates more durable as they weather better.

Re:GIT is the new FTP by antman on Wednesday July 18, 2012 @02:37PM (#4262167)
Parchment only. Papyrus has a standing export restriction from the issuing superpower (Egypt circa 200BC), so if it becomes a superpower again you could be extradited for disobeying the law of a that foreign country that attempted to force an unfair business advantage to the rest of the world.
Re:GIT is the new FTP by masklinn on Wednesday July 18, 2012 @05:18AM (#4260011)
> BTW, who on earth still uses FTP?

Does sftp[0] count?

[0] http://tools.ietf.org/html/draft-ietf-secsh-filexfer-13

Re:GIT is the new FTP by archivator on Wednesday July 18, 2012 @06:30AM (#4260160)
The commonalities between SFTP and FTP end with the three letters in the acronyms. SFTP, unlike FTP with its passive mode and whatnot, is actually a decent protocol.
Re:GIT is the new FTP by masklinn on Wednesday July 18, 2012 @09:11AM (#4260531)
rickmb did not come even remotely close to specifying on which grounds he was asking his question. He might be a proponent of "if it's not automated [via capistrano/fabric/etc...] it's not deployed" for all I know.
Re:GIT is the new FTP by tlrobinson on Wednesday July 18, 2012 @01:14PM (#4261720)
More complex deployment processes can be kicked off in the post-receive hook.

I think it's useful to have deployment integrated with your SCM. You have a complete history of deployments. You can easily roll back to any version. You can deploy from any machine which has your SCM tool installed.

Re:GIT is the new FTP by mattacular on Wednesday July 18, 2012 @08:28AM (#4260400)
Uh what? People still use FTP all the time. Just not for deployments.
Re:GIT is the new FTP by Sunlis on Wednesday July 18, 2012 @09:24AM (#4260565)
I was an intern at a small start up last year that used FTP for deployment; it was horrific.
Re:GIT is the new FTP by recursive on Wednesday July 18, 2012 @11:22AM (#4261160)
People also use FTP all the time for deployment.
Re:GIT is the new FTP by ynniv on Wednesday July 18, 2012 @09:41AM (#4260641)
You can deploy Tomcat apps using a post-commit hook as well. Add your server as a non-origin remote, and it's a quick way to update a Clojure/ring site. For added predictabIlity, you can deploy a specific branch.
Re:GIT is the new FTP by ajross on Wednesday July 18, 2012 @11:30AM (#4261214)
This bit has completely lost me. Why on earth would you want to do non-trivial munging in a post-commit hook instead of just writing and running a "deploy" script like everyone else does. You can run that over ssh, even, preserving the "fire once" behavior of doing a git push from the build system.
Re:GIT is the new FTP by ynniv on Wednesday July 18, 2012 @11:39AM (#4261265)
Copying a .war to /var/lib/tomcat/webapps and restarting tomcat is non-trivial? Perhaps your deploy script is more complicated than it should be. I don't understand your distaste with deploying via git over ssh instead of bash over ssh.
Re:GIT is the new FTP by kbolino on Wednesday July 18, 2012 @02:04PM (#4261990)
You haven't needed to restart Tomcat since at least Tomcat 5.5, if not earlier. Tomcat automatically polls for changes to the WAR file and updates accordingly.
Re:GIT is the new FTP by emmelaich on Wednesday July 18, 2012 @03:22PM (#4262429)
That's the theory, but I've found many reasons to restart that I just do it automatically these days. The reasons are not limited to stupid webapps, jni, log4j stuff that outlives a deployment and ends up consuming all of PermGen.
Re:GIT is the new FTP by kbolino on Thursday July 19, 2012 @08:45AM (#4265685)
An interesting point. I get the part about "stupid webapps" (e.g. loading a configuration file once and never checking it again), but I find the PermGen part surprising. Would you care to provide more detail? I thought that PermGen was garbage collected in modern JVMs; furthermore, wouldn't the new version of the application still use (roughly) the same classes/methods and thus (roughly) the same space?
Re:GIT is the new FTP by gsarrica on Thursday July 19, 2012 @09:37AM (#4265890)
This happens because Tomcat is unable to release some classes from the classloader. So every time I load a new WAR lets say I am using Spring. Tomcat doesn't remove the old Spring Jar from the classloader and just loads a second one for my updated WAR. After doing this a few times (Depending on the size of your app, permgen size and how many 3rd party libraries you have) tomcat will throw a permgen error. There is nothing Tomcat can do about this. It is the classloaders problem. Also it is not recommended to "hot deploy" to a production environment.
Re:GIT is the new FTP by kbolino on Thursday July 19, 2012 @10:52AM (#4266233)
I've done some more reading on this issue, and I don't think what you are saying is correct.

First, class loading is more granular than JAR files. From what I can tell, the JARs are just repositories (if you will) for the actual class data. Once a class has been loaded from a JAR, it is distinct from it, and there is no need to keep the whole JAR in memory.

Second, there are many class loaders at play, not just one. At the least, there will be one class loader for Tomcat and one class loader for each web app. This is necessary to keep web apps from breaking each other (and Tomcat!) by loading incompatible versions of classes.

Third, once a class is no longer used (i.e. there exist no objects that are instances of it) it can be garbage collected, and will be if more PermGen space is needed.

Fourth, once a web app is unloaded, its class loader is no longer needed, and it too can be garbage collected (along with any memory it was using to store the aforementioned JAR files, although presumably that memory would be outside of PermGen).

Taking all of this into account, one might (like me) naively presume that once you unload a web app, all of its objects will no longer be referenced, and this will propagate up the tree of references (servlet -> object -> ... -> object -> class) until nothing from that app remains.

HOWEVER, this assumes that references exist in a tree. A singleton class would cause problems: it stores a reference to an object of its own type. This creates a circular reference pattern (class X -> object -> class X) and keeps both class and object in memory.

A possible solution might be to associate each class with the web app that loaded it, then when you unload a web app, you can walk through all of the classes it loaded and null out all of their static fields. This will allow the referenced objects to be garbage collected, and in turn, the classes of those objects.

But this is probably much easier said than done (it may even be impossible due to limitations on the JVM), and there are probably other issues I'm not even aware of and thus not considering. Never mind JNI, which just adds even more fun to the mix.

So ultimately I must agree with the recommendation to restart Tomcat when you're deploying web apps. From a developer perspective, I would also recommend eliminating static data in your libraries and web apps as much as possible.

Re:GIT is the new FTP by gsarrica on Friday July 20, 2012 @09:50AM (#4270762)
Thanks for the deeper explanation. I kind of high leveled it there, but you are totally correct.
Re:GIT is the new FTP by kbolino on Thursday July 19, 2012 @01:10PM (#4266986)
Comment on myself: that should be static references that I'm warning against. There's nothing wrong with static primitives like integer constants.
Re:GIT is the new FTP by valisystem on Wednesday July 18, 2012 @06:32AM (#4260171)
For both of your interrogation, old fashioned PHP devs used to (and I do not doubt that some still) deploy that way.
Re:GIT is the new FTP by damncabbage on Wednesday July 18, 2012 @10:31AM (#4260865)
A year and a half ago I worked at a place that had a Deployment Spreadsheet.

Each file was carefully FTP'd from the shared development area to the live site, and then marked off on the sheet with the date that it had been deployed, and with what feature.

Each new deployment meant either adding a new set of rows to the spreadsheet for a new feature, or for updates to existing features going back and finding an earlier instance of the file in the list and bumping the date on that.

Because of the shared nature of the CMS across different websites, we couldn't svn up in the CMS directory without destroying the current known state of the site. We also couldn't svn up outside of the subdirectory we were working on, as everyone else working on that site was working off the same network share. Everything was done very gingerly.

The day one of the developers came up with a method to take a list of files from the spreadsheet, tar them up and FTP them to the server for later extraction, he was overjoyed and very, very proud.

I got out of there, swore off PHP and its community entirely. I got tired of checking for a baseline of automated deployment, automated testing, version control, and individual dev systems at every single job I applied for; Ruby people don't look at you funny when you mention these things.

Addendum: I personally know a developer currently working for a famous local radio brand who directly works on the live website network via an FTP plugin. He has to contend with other developers dumping the contents of archives directly into his public folder.

(For context, this is all in Sydney, Australia.)

Re:GIT is the new FTP by acdha on Wednesday July 18, 2012 @11:25AM (#4261182)
FWIW, this is essentially how Oracle ships updates for their enterprise business systems: you get a tar file and a README telling you which files get copied to which spots on which servers.
Re:GIT is the new FTP by sauravc on Wednesday July 18, 2012 @01:40PM (#4261870)
That shitty deployment experience has nothing to do with PHP. There are plenty of valid reasons to move to Python or Ruby, but better deployment stories aren't one of them. Objectivity seems to be in short supply here on HN.
Re:GIT is the new FTP by AnswerAndForget on Wednesday July 18, 2012 @01:54PM (#4261948)
Isn't the ecosystem always trotted out while defending PHP, as well as its 'accessibility' to amateurs? Well, those amateurs are part of the PHP ecosystem, and you'll have to put up with that... or not.
Re:GIT is the new FTP by damncabbage on Wednesday July 18, 2012 @05:56PM (#4263198)
heretohelp made the point better than I did, but I explained my thoughts on that with this sentence:

I got tired of checking for a baseline of automated deployment, automated testing, version control, and individual dev systems at every single job I applied for; Ruby people don't look at you funny when you mention these things.

It's about expectations. I tried really hard to find a place that had all these in the PHP world. In the Ruby world (for example), it's a given.

(I have only ever encountered one PHP shop during my rounds interviews that did automated testing... But they used CVS for version control. The very first Ruby shop I interviewed had all of the above, and treated it like they were no big issue.)

Re:GIT is the new FTP by bandy on Thursday July 19, 2012 @05:56PM (#4268270)
>But they used CVS for version control.

Oh the horror! A proven source-code control system.

M-x My-lawn-remark$

Re:GIT is the new FTP by damncabbage on Friday July 20, 2012 @12:27AM (#4269401)
That's nice. Unless you, say, you want to:

* Track renames of files.

* Track changes to the repository as a whole, instead of per file. I care most about stepping through revisions of a project; inspection of the history of a particular file is a secondary concern for me, but is all that CVS can do. A "project" for me is usually a set of files that are interdependent to greater and lesser degrees.

The best you get with CVS for tracking the versions of all the files in a repository is manually creating tags all the time. With Git, Subversion, Mercurial, Bazaar, etc you get this for free; it's how these tools work.

(As an aside, DOS is also a proven operating system. For varying values of "proven".)

Re:GIT is the new FTP by heretohelp on Wednesday July 18, 2012 @01:54PM (#4261945)
It has to do with community standards. The community standards for deployments and dependency management for Python & Ruby are much higher than PHP.

virtualenv/rvm are the standard, using git is the standard, fabric/capistrano for pushing/provisioning is standard.

This is not the case for PHP, the vast majority are using graphical FTP clients to manually overwrite files.

Re:GIT is the new FTP by dredmorbius on Wednesday July 18, 2012 @11:47AM (#4261310)
If you can every track me down in real life, I'll buy you a misery beer.
Re:GIT is the new FTP by damncabbage on Wednesday July 18, 2012 @09:56PM (#4264033)
Haha, thanks. :-)
Re:GIT is the new FTP by risratorn on Wednesday July 18, 2012 @07:04AM (#4260213)
To be honest, most of them do so because it's the only option present on most shared hosting platforms. (S)FTP is for most of us the only option when deploying a simple site to the client's hosting.

Ofcourse it would be cool if all of our clients would host on a PAAS platform like Orchestra or PHPFog but that's not the case by a long shot i'm afraid.

Re:GIT is the new FTP by doc4t on Wednesday July 18, 2012 @06:25AM (#4260147)
Incidentally I just asked a related question yesterday: http://news.ycombinator.com/item?id=4256265

I am currently trying to figure out a more clever way to deploy my code. I would love if you would share some thoughts on some general strategy and possible tools. I am using jenkins and git.

Re:GIT is the new FTP by jabo on Wednesday July 18, 2012 @12:04PM (#4261384)
I use Capistrano to deploy PHP web apps and I love it. It basically checkouts stuff from the git repo, minifies and bundles the JS files, uploads the assets to the CDN and tags the repo with the version string. Though Capistrano has been traditionally a ruby deployment tool, it works well for any type of deployment. You just need to override or not use some of the Ruby-specific stuff. Deploying to multiple servers is ridiculously easy with Capistrano.
Re:GIT is the new FTP by davedx on Wednesday July 18, 2012 @08:27AM (#4260397)
We use Dreadnot with chef, it works pretty nicely.
Re:GIT is the new FTP by wilhil on Wednesday July 18, 2012 @05:02AM (#4259982)
I hope you just mean for source control... FTP is used all the time!
Re:GIT is the new FTP by astrodust on Wednesday July 18, 2012 @11:02AM (#4261044)
Like telnet, this protocol should be dead. It's an enormous liability.
Re:GIT is the new FTP by kingatomic on Wednesday July 18, 2012 @10:09AM (#4260756)
Unfortunately, some of my smaller clients have shared hosting packages which means FTP is still the only game in town.
Re:GIT is the new FTP by lukeschlather on Wednesday July 18, 2012 @11:08AM (#4261069)
Any shared host worth their salt has sftp and shell access for easy automated deployment.
Re:GIT is the new FTP by emmelaich on Wednesday July 18, 2012 @03:34PM (#4262488)
Just one problem besides metadata and dynamic changes is that git (and hg) don't version empty directories at all.

Sometimes this matters:

http://stackoverflow.com/questions/6554910/i-am-failing-to-r...

Re:GIT is the new FTP by damncabbage on Wednesday July 18, 2012 @05:59PM (#4263214)
This is usually "fixed" with a .gitkeep file in the deliberately-empty directory.

(Yes, it's a hack.)

Re:GIT is the new FTP by emmelaich on Wednesday July 18, 2012 @06:29PM (#4263337)
Yes, or a README.

But this doesn't work for Mule; for some directories it autodetects and attempts to run it (whatever that means for that directory).

Re:GIT is the new FTP by masto on Wednesday July 18, 2012 @09:18AM (#4260549)
I couldn't agree more. Deployment via SCM tool is a terrible idea. The first thing to do when starting a project, no matter how small, is to set up a continuous integration server with a clear build and deploy process.
Re:GIT is the new FTP by donavanm on Thursday July 19, 2012 @02:38AM (#4264753)
Joke if you like. I know of (literally) billions of dollars of revenue that are dependent on FTP. Legacy systems are crazy hard to kill off.
Re:GIT is the new FTP by stefantalpalaru on Wednesday July 18, 2012 @06:15AM (#4260123)
I deploy via git with a more complex post-update hook that runs tests before pushing into the production repo and all the other commands needed for my Django setup.