GitHub Actions for Build & Release

I like to write code, build, and release tooling, for my brain at 3 AM. No surprises, no clever bits to trip me up. Lately I’ve been playing with GitHub Actions to build and deploy some of my public projects. It took a little while to figure out something that I could copy and paste between them, and I’d like to share what I’ve managed to come up with. Build Actions Committed to your project as ....

Convert PEM to JKS

SSL/TLS in Java is a pain in the behind. Not only is the setup verbose, but the format for certificates and keys is unique. Nginx/Apache/Go/etc seem to be happy using certifiates and keys encoded as PEM files, but Java has its own special KeyStores, with the JKS format being the default. There are a number of questions on forums, and custom recipes that involve openssl, to convert PEM certificates and keys into formats that can be imported into a Java keystore....

Default HTML-escape using Freemarker

Most java developers have at least heard of Freemarker. FreeMarker is a “template engine”; a generic tool to generate text output (anything from HTML to autogenerated source code) based on templates. It’s a Java package, a class library for Java programmers. It’s not an application for end-users in itself, but something that programmers can embed into their products. It is the “generic” nature of Freemarker that trips up java web developers....

RubyGems in a JAR

On a few projects now I’ve used jruby with rake. I know that I can use rvm and just fetch the gems per project, but for developers stuck on windows that way is a little more than difficult. So here’s how I package up rubygems in a JAR. mkdir gemjar java -jar jruby-complete-1.6.3.jar -S gem install -i ./gemjar haml --version 3.1.2 --no-rdoc --no-ri java -jar jruby-complete-1.6.3.jar -S gem install -i ....

JRuby Rake and Ivy

Here’s a neat way of using ivy with jruby, rake & ant. task :ivy_retrieve do ant.taskdef :resource => "org/apache/ivy/ant/antlib.xml" do classpath :location => "ivy/ivy-2.2.0.jar" end ant.configure :file => "ivy/ivysettings.xml" ant.resolve :file => "ivy/ivy.xml" ant.retrieve :pattern => "lib/[conf]/[type]/[artifact]-[revision].[ext]", :sync => "true" puts end Still using ant, still angle bracket free (except for ivy, sigh). Read my previous post if you want to know more about jruby, rake and ant....

Zero-downtime deployments

For some time now I’ve been thinking about all the different approaches that I have seen and heard with the goal of zero-downtime deployment for a horizontally-scaled application that relies on a database or some form of persistent storage. On most of the projects that I have worked on this was not a requirement, although a speedy and automated deployment was preferred. However, other projects were for websites and applications that formed the backbone of a 24/7 company and as such the idea of even a couple of minutes downtime was unacceptable....

Spring-StringTemplate is now in Maven Central

For Ivy: <dependency org="com.tomczarniecki" name="spring-stringtemplate" rev="1.5.1" /> For Maven (yeech): <dependency> <groupId>com.tomczarniecki</groupId> <artifactId>spring-stringtemplate</artifactId> <version>1.5.1</version> </dependency> Thank you Sonatype....

S3DropBox is now on GitHub

I've released a new version of my S3DropBox on GitHub. I've moved the project to GitHub so that I can have all my current active projects in one place. Check it out in its new home at https://github.com/tomcz/s3dropbox. This release uses the AWS java libraries. They are finally good enough for me to stop creating my own wheels and vulcanising my own rubber. As a bonus the S3DropBox creates URLs in virtual hosted format (eg....

JRuby Rake Vs Ant

For the longest time I’ve been writing Java build files in XML and I’ve always felt a little dirty. Not too long ago I was re-introduced to rake by a colleague (thanks Fabio) and how nicely it integrates with ant. This means that you can now turn this: <project name="spring-conversations" default="build" basedir="."> <property name="src.dir" location="src/main" /> <property name="test.dir" location="src/test" /> <property name="build.dir" location="build" /> <property name="dist.dir" location="${build.dir}/dist" /> <property name="report.dir" location="${build....

Conversations with Spring

Not that long ago I gave a ThoughtWorks geek night presentation on Post-Redirect-Get and how to mess with the Spring Framework to make it happen. I've put up the presentation and the code that I used for it on GitHub. Feedback is always welcome....