Enable SSL in the Postgres.app on Mac OS X

Enabling SSL in Postgres usually requires reading around 3 different blog posts (I’ve probably written a couple, myself). So, to make things easier for myself in the future, here are the very specific instructions on how to do it for the Postgres.app in Mac OS X.

  1. Install the Postgres.app (duh) http://postgresapp.com and make sure to follow all the instructions for properly setting up your path.
  2. As can be seen from their docs (http://postgresapp.com/documentation#toc_21), the data directory is by default in ~/Library/Application\ Support/Postgres/var. This is a lie. It’s actually Postgres93/var and it could change in the future.  Open a Terminal (I recommend iTerm) and navigate to that directory.
    cd ~/Library/Application\ Support/Postgres93/var
  3. Follow the basic instructions on how to set up a self-signed cert. By doing this process in the data directory, the files are already in the right place. The caveat is getting the permissions right so Postgres doesn’t complain. (source: http://www.postgresql.org/docs/9.1/static/ssl-tcp.html)
    openssl req -new -text -out server.req
    openssl rsa -in privkey.pem -out server.key
    rm privkey.pem
    openssl req -x509 -in server.req -text -key server.key -out server.crt
    chmod og-rwx server.key
  4. Turn on SSL in the Postgres config by uncommenting the line #ssl = on using your favorite editor
    vim postgresql.conf
    # change this:
    # ssl = on
    # to this:
    ssl = on
  5. Restart the Postgres.app. This will restart the Postgresql server automatically
  6. Check that the server came up
    ps aux | grep -i postgres
    # this line means the server is up properly. If you don't see it, try a couple more executions of the ps aux | grep command just to make sure
    awesomeuser  85581   0.0  0.0  2617708   2396   ??  S     5:55PM   0:01.75 /Applications/Postgres93.app/Contents/MacOS/bin/postgres -D /Users/awesomeuser/Library/Application Support/Postgres93/var -p5432

    If you still don’t see that line after a couple executions of the ps aux command, then you likely didn’t get the certificate correct. Make sure you followed those instructions exactly.

  7. Check connection with SSL
    psql "sslmode=require"

    If a psql console opens, you’re all set.

From your friends at Workherder.com

Introducing Workherder

Obviously, if you’ve read our other posts, this isn’t really an introduction to Workherder. However, we’ve just recently presented the Workherder concept to about 100 Orland(oan/ite/an) techies at the November Orlando Tech Meetup and we thought we’d share it with the world. To view our Prezi — they’d yell at me for calling it a slide deck, so… — frame series (?), click here.

Review: Reinventing Discovery

Reinventing Discovery by Michael Nielsen is an excellent book that talks about how humanity is restructuring interaction to change how science is done.  The Internet and sophisticated support software are helping scientists and engineers work more efficiently, by reducing the difficulty in matching experts to those who most need their talents.  While Nielsen is speaking specifically about scientific discovery, many of his ideas are important to why Workherder can make having software built substantially more efficient.  According to Nielsen, “the attention of the right expert at the right time is often the single most valuable resource one can have in creative problem solving.”  In Workherder, developers post packages of software services they are willing to perform called work bundles.  Because Workherder encourages developers to post work bundles for which they have extensive expertise, those trying to build new applications (herders) can always get the right expertise at the right time.

Nielsen goes on to describe the work done by a future scientist, which sounds a lot like the day of a typical developer on Workherder.  “Each morning you begin your work by sitting down at your computer, which presents to you a list of ten requests for your assistance, a list that’s been distilled especially for you from millions of such requests…Out of all those requests, these are the problems where you are likely to have maximal comparative advantage.”

In the end, Nielsen says, everybody wins because of comparative advantage.  Comparative advantage is an old idea in economics stating that certain actions cost less for one party to do than another.  For example, somebody who has already implemented a site search solution in Ruby on Rails, would take far less time than somebody who is doing it for the first time.  When we perform a task over and over again, we keep tweaking our comparative advantage, working out the kinks and bringing down the cost of doing it next time.  By maximizing everybody’s comparative advantage, Workherder makes life better for both developers and herders.

The Workherder Manifesto

All substantial periods of economic growth have come from fundamental changes in the way people work. The assembly line became a powerful tool because it allowed workers to become incredibly efficient at a specific task. As the assembly line came to prominence in the early 20th century, it slashed production costs and ushered in an new era of inexpensive consumer goods. Here at Workherder.com, we believe we are standing at the threshold of a similar revolution, this time in software production.

Workherder.com is a low-friction marketplace for software skill, designed to make building your vision as easy as adding items to a shopping cart. So, for instance, say you are building an application and need to add authentication. You know there are gems and packages that do it, and that with a couple of days of effort, you could learn the ins and outs of a particular gem, and finally get it to do everything you need it to do in your application. But, somewhere out there, there is another engineer who has been there before. In fact, he has been there many times before. What would have taken you a couple days to learn, would take somebody familiar with the gem a couple of hours to do. Workherder.com brings you both together for mutual benefit.

Now imagine performing this feat over and over again, across all of the pieces of your application. You could build with the strength of 10 regular developers. You could do this all at a fraction of the cost of having a full time dedicated team. Instead, you have a team with just-in-time expertise. Suddenly, you crush the learning curve. Suddenly, you are conducting a symphony of software. Suddenly, you are like Neo at the end of The Matrix, and 1’s and 0’s obey your mastery. Ok, perhaps the Neo thing is a bit much, but workherder.com will let you build better software, faster.

Being a workherder is an entirely different philosophy of software creation. It means thinking, not in terms of libraries and code, but instead in systems and services. It involves knowing a little bit about everything in the system, but also knowing when to augment your expertise with external help. It is about delegating the details to focus on integrating the whole.

And working on workherder.com combines the best parts of freelancing with assembly line efficiency. You can get paid great money to help a few people a day get your favorite library integrated into their applications. When you are bored of the library, move on to helping out with another. You become the foreman of your own software assembly line, and you get to profit from your efficiency.

With your help, we can forever change the way that software is built.