Nginx + Jenkins Configuration

This is just a simple post about configuring Nginx to proxy Jenkins, with HTTPS. This example assumes Jenkins is hosted on the same machine as Nginx, and at the default port (e.g. 8080). It does not include how to obtain an SSL server certificate.

my.domain.com.conf:

server {
    listen 443;
    server_name my.domain.com;

    ## Remove this when the following issue is resolved:
    ## https://issues.jenkins-ci.org/browse/JENKINS-7518
    ignore_invalid_headers      off;

    ssl                         on;
    ssl_certificate             /full/path/to/my.domain.com/cert.pem;
    ssl_certificate_key         /full/path/to/my.domain.com/cert.key;
    ssl_session_timeout         5m;

    ssl_protocols               SSLv2 SSLv3 TLSv1;
    ssl_ciphers                 HIGH:!aNULL:!MD5;
    ssl_prefer_server_ciphers   on;

    ## Reference:
    ## https://wiki.jenkins-ci.org/display/JENKINS/Jenkins+behind+an+NGinX+reverse+proxy
    location / {
        ## Convert inbound WAN requests for https://domain.tld/ to
        ## local network requests for http://internal:port/
        proxy_pass http://127.0.0.1:8080;

        ## Rewrite HTTPS requests from WAN to HTTP requests on LAN
        proxy_redirect http:// https://;

        ## The following settings from:
        ## https://wiki.jenkins-ci.org/display/JENKINS/Running+Hudson+behind+Nginx
        sendfile off;

        proxy_set_header           Host $host;
        proxy_set_header           X-Real-IP $remote_addr;
        proxy_set_header           X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_max_temp_file_size   0;

        ## This is the maximum upload size
        client_max_body_size       10m;
        client_body_buffer_size    128k;

        proxy_connect_timeout      90;
        proxy_send_timeout         90;
        proxy_read_timeout         90;

        proxy_buffer_size          4k;
        proxy_buffers              4 32k;
        proxy_busy_buffers_size    64k;
        proxy_temp_file_write_size 64k;
    }

    ## Applicable only when Jenkins and Nginx are on the same machine.
    ## Allow Jenkins userContent to be served directly with Nginx.
    ## Also good idea to set "server_tokens off;" with this.
    location /userContent {
        autoindex  on;
        root       /var/lib/jenkins;
        ## Just in case
        index      index.html;
    }
}

References:

Development, and The Past Couple of Years

I haven’t really posted in a while, so I thought I’d throw up something mentioning what I’ve been up to the last couple of years regarding development.

  • I’ve been very deep in HTML(5), CSS(3), and especially (if not mostly) JavaScript. Working with JavaScript is a love/hate relationship. My experience with it includes the development of frameworks and platforms for game development, modern web application architecture, and basic to high performance browser-side rendering. Other specific development includes desktop and mobile application development and mobile advertising. Outside of the browser, I dove head first into Node.js development for web services, build tools, and data crunching workers. I even released a couple of npm modules. JavaScript is the language that I can teach, and give interviews for (which I have). Even though it’s always changing, I believe I have mastered it overall. The problem is that I don’t necessarily believe in JavaScript’s future as much as I think I should, or as much as I think my peers do. I don’t really even know if I like it that much. I do know that there’s no escaping it, and I can actually get things done pretty fast with it. There’s more and more languages and technologies trying to replace it, yet JavaScript just continues to grow in popularity, it’s quite impressive really.
  • I could not prevent the need to take some time and learn Objective-C, as well as a little C++, but specifically for iOS programming. One can’t really make iOS apps without a working knowledge of these languages. Though I have to say, Objective-C is pretty interesting. It has taken on a lot of characteristics of JavaScript in recent versions.
  • I still dabble a little in PHP, but mainly out of necessity, and to keep older websites running. It is definitely still plunging ahead as a language, and I try to keep up on the latest news surrounding it. Though it’s really not in my day-to-day, but rather month-to-month. PHP is also starting to look more and more like JavaScript with each new release, what is this mess?!
  • My first introduction to a particular hobby language was back in my Flash days, in or around 2007. After years of JavaScript, I was recently reintroduced to the Haxe language, which has grown much in popularity. Currently Haxe has taken a more important role in my personal endeavors of cross-platform app development. Another platform built on Haxe, called OpenFL, makes this kind of work much easier.

Anyway, that’s the 10,000 feet view of what I’ve been doing the past couple of years. I of course learned much more than just these high level bits, and created some interesting things by using them along the way, but that’s not what this post was supposed to be about ;)

I believe the biggest thing I’ve learned is my preference as a developer. I like both strict and dynamic languages, but to be honest, I don’t believe in abusing a dynamic language simply because you can. Software design patterns in JavaScript that are emerging in popularity and solidifying as standards are based on old patterns in old languages. There’s no real reason to follow these in dynamic languages, so why do we do it? Well… there’s something to be said for the sense of clarity those patterns offer.

The biggest problem I have with JavaScript is that many of its developers do not really meet eye to eye. The freedom JavaScript offers allows them to go off into their own direction. Then a couple of years later,  they have a change of heart, and join the ranks of CommonJS. I feel the JavaScript community, as large as it is, is really struggling with reinventing the wheel over and over again, and a lot of the time not reaching the best answers in doing so. Being someone with a background in Flash, I see this very much. This is probably why I am now enjoying Haxe, which isn’t just the reinvention of the wheel; it has taken a proprietary wheel design, made it better, faster, free, and full of standards I can follow optimistically.

All of this doesn’t mean JavaScript will stop having a place in my everyday, or that I will stop using it. That’s nearly impossible. What it means is that I know myself better as a developer, and will continue to bring that to whatever I do next.

Ride the Pony

I was researching SmartOS and realized something. I have Mac OSX, which is already a pretty “smart” os. One thing I never realized was that DTrace is pre-installed on OSX. So with that I looked around, and  found this little helping article. Abracadabra, now I can see all activity on all the files on my computer being accessed, and from which application. Google’s Chrome is a particularly naughty application. As a matter of fact, every Google application.

Plugin Concern

There is a concern about the functionality of the WordPress plugin I use for managing downloads. I am in the process of finding a solution, but in the mean time It has been temporarily disabled. Thank you for your patience, and I apologize for any inconvenience.

CSS3 Border Image Experiment

So, I was responsible for explaining the CSS style border-image during a presentation to coworkers. During research I came across this post. The article was informative but I needed a demo, and a nice one was linked to in that same article. Though I needed it to be a bit more extensive, so I revamped it to explain the complexities of border-image and 9-slice scaling in very visual, interactive, and complete way.

The demo can be found HERE.

Tested in Safari 5+, Chrome 10+, Firefox 4+
‘Should’ also work in Opera and Internet Explorer 10, but don’t be upset if it doesn’t.

WebP – Google’s Image Format

Well, it was bound to happen sooner or later. Google has created their own image format, which is dubbed WebP. I won’t go into too much detail since that link explains as much as necessary, FAQs and all. In summary, it uses the VP8 Codec, and the goal is to compress images further and more efficiently than ever before. Specifically photo type (lossy) images, which basically means the long-lived JPEG format.

All in all, it uses open source, to provide more open source, to improve the web ;)

Continue reading WebP – Google’s Image Format