Installing a free Let’s Encrypt SSL certificate on Server Pilot

I recently needed to create a live WooCommerce site for testing the API. But I needed SSL. And up until now, a proper SSL certificate cost money. Money I didn’t want to spend for a test site. But Let’s Encrypt recently entered public beta. And you know what’s cool about Let’s Encrypt? It’s a new certificate authority that is completely free – for anybody.

I couldn’t get the automated setup to run on my Server Pilot-powered Digital Ocean droplet (get $25 free credit with that link and I get $10 – win/win), so I had to do it manually. The good news is that it’s actually pretty easy. I’ll take you through it.

 

Screen Shot 2016-01-07 at 4.36.20 PM

Start by SSHing into your server. You may need to first ssh with the serverpilot user and then update the password for the root user, as at least in my case I needed to use root to create the certificate. So if you have any permission issues, try the root user.

Let’s say your server’s IP is 128.199.1.1.

ssh serverpilot@128.199.1.1

You then need to download Let’s Encrypt (instructions here updated in September 2016 based on this comment).

wget https://dl.eff.org/certbot-auto

If you’re using the serverpilot user, Let’s Encrypt will now be in the serverpilot user’s directory – /srv/users/serverpilot/.

You now need to stop nginx running.

sudo service nginx-sp stop

Time to create your free certificate!

./certbot-auto certonly

It’ll update itself and then ask you for the domain name(s).

 

Screen Shot 2016-01-07 at 4.48.23 PM

You could enter multiple domains, like if you wanted www and non-www certificates for your site, you’d enter: mysite.com, www.mysite.com.

It may also ask you some other info.

A moment later and you’ll be the proud owner of some new SSL certificates! Time to start nginx again:

sudo service nginx-sp start

You now need to modify your nginx configuration to use these certificates. First go to the folder that contains them.

cd /etc/nginx-sp/vhosts.d/

You then need to create a new file for it. If your app name is mysite for example, and when running ls in that folder you see a file called mysite.conf, you’ll want to type the following:

nano mysite.ssl.conf

Add the following to that file, changing mysite to your app name.

Save it, with ctrl + o and then exit with ctrl + x.

Restart nginx:

sudo service nginx-sp restart

And you’re done! Congratulations. You just beat the system. Sort of.

The one negative is that the SSL certificates expire every 3 months. I believe you’ll just need to follow the first couple steps and create a new SSL certificate with Let’s Encrypt. That should be all though, and I’m sure there will be auto-installation soon so it’s completely automated. You could also write a script and cron job to automate renewal. If you do, please let me know and I’ll share it here.

Renewing

Updated 21/03/2016 – Well, the original certificates that inspired this post were about to expire, and Let’s Encrypt kept emailing me to warn me, so I thought I better figure out how to renew them. Good news. It’s pretty easy and will take you just a moment.

Start by SSHing into your server. Go to where we installed Let’s Encrypt before, likely possibly by doing the following:

cd ~/srv/users/serverpilot/

You now need to stop nginx running.

sudo service nginx-sp stop

Then run through the certificate creation again. This will open up the Let’s Encrypt setup – just enter your domains like you did before.

./certbot-auto certonly

Once that’s done, your certificates are valid for another 3 months.

But wait! You need to restart nginx or nothing will work.

sudo service nginx-sp start

I still haven’t bothered to try write a script to auto renew it. There should be some floating around by now, so if you’re desperate / have a lot certificates, search around and you should find something.

Full Time Developer

Today’s a pretty exciting day for me.

Just under 9 months ago, I joined WooThemes as a WooCommerce support ninja. It was an exciting and nervous time. I’d never done full-time work for anyone but myself before, but I was ready for the challenge and excited to be a part of something (much) bigger than my own ideas and aspirations.

When I started, I was a mediocre developer at best. I’d released several plugins, all of which worked but none of which were amazing. The code I write today is still not the best it could be. I’m only as good as my last commit. But I’m getting better. And I can confidently say that I would not be where I was today if it wasn’t for the last 9 months doing support.

I was given a unique opportunity to help grow WooCommerce exponentially, at the ground floor, interacting with the users that matter the most, solving the problems that hurt us the most and learning things that would impact me the most. I proudly built 5 official extensions in that time, got the chance to do bug fixes and add features to pretty much all of the extensions I supported, and happily contributed to WooCommerce itself many times, even making it into the top contributors for 2.3.

But more importantly, I learnt. A lot. And now, thanks to Warren & Gerhard at Woo, I’ll get to keep learning and have the chance to push myself further in a new role as a developer on our WooThemes.com team.

I’ve always been interested in the product side of things, but I’m far more excited about the impact I will get to have in this position. Rather than my impact being measured in the thousands of users, it will measured in the hundreds of thousands, if not millions. I can’t wait to get started.

I’m Too Comfortable

When you first start developing, writing code or just creating your first product, it’s really hard. I don’t think people mention it enough. Mostly because no one listens to those just starting out and when you start to become a respected developer, it doesn’t make you sound too good when you admit it’s hard.

I want to be honest and transparent. And everyday, I get better. With almost everything in life, as you continue to do it day-by-day, you almost certainly get better. On a daily basis. Literally infinite exponential growth. So that means, I’m a better developer today than I was a year ago. I’m a better developer today than I was 3 months ago. I’m even a better developer today than I was yesterday.

Even on your worst day, you are a better developer than you have ever been.

But everyday, I get more comfortable. And as I start to feel more comfortable in my developer shoes, I get scared. Scared that I won’t learn anything new. Scared that I’ve hit my peak.

I’ve spent the last couple years developing for WordPress. I still have a lot to learn. Really, I do. But I feel quite confident that when it comes to building something with or for WordPress, I either already know how to do it or can quickly figure out how to do it. And then I can execute. That’s the important part. Actually doing what needs to be done.

That’s it. When it comes to WordPress, I’m comfortable. But when it comes to newer technologies and frameworks like Node.js, Laravel & RoR, I’m gasping for air. And as I start to dip my feet into these different frameworks, some which use languages I’m comfortable with (Laravel), whilst others are completely new (Ruby / Python), I realise how little I truly know.

And I struggle. I start to question myself. I’m as far from comfortable as I’ve ever been. But it’s okay, I think.

WordPress will always be there. When something needs to get done quickly; when I need to step back into my comfort zone, I can always use WordPress. It may not be right for everything, but I can make it work, and I can make it work fast – and time is key.

What I find difficult in these new technologies will eventually make sense. Everything does. When I first wrote something in PHP, it was the hardest day of my ‘developer-life’. But it got easier. I can also take this newfound knowledge and put it back into the things I do on a daily basis with WordPress.

There’s nothing to lose. Learning new stuff is fun, because really, you don’t stand to lose much. I may never create an app using Laravel, but no one will ever discredit me for having taken the time and initiative to try.

Every day, I will get more comfortable. Every day, you get more comfortable.

Tomorrow will always be my best day.

Tomorrow will always be your best day.

Version Freedom

I was sitting in a bar the other night, listing to some live music and having a beer, when it hit me. We (software developers) are really quite lucky. In most cases, we have the luxury of sending out bug fixes and updates without much thought. Sure, there is often some inconvenience to the user that I touched on in my post about ‘the software update problem‘, but for the most part, you’re just improving an existing product so rarely people will complain.

But other ‘artists’ or ‘product creators’, don’t really have the same freedom. As I sat in that bar and heard this guy performing, it hit me – a musician only gets to publish a song once. Sure, they can perform it live differently, but really, when a song is published along with it’s music video, it’s stuck that way. The musician may later realise that a couple of the lyrics don’t really make sense or a specific chorus may sound better using a different chord, but by then it’s too late.

They don’t get a second chance.

It’s the same for most other artists. A painter only gets to finish their painting once. A writer or poet may get to publish multiple editions of their book but for the most part, not much will change.

This makes for quite a lot of pressure on the creator. Can you imagine only being allowed to publish your website just the once? Even if you had the same freedom as the writer and were allowed to push out a ‘revised edition’ once every couple years, it’d still be logistical nightmare.

Software is different. Software provides the freedom to iterate and improve everything we do. To take risks and later pivot in a completely different direction and reimagine our primary focus.

So remember that next time you’re listing to a song or admiring a painting. They managed to get it right the first time – while you get the chance to fix it, forever.

How I Built Nomad SMS in 3 Days

Jeju-island-in-korea-beauty

Everything good starts with a problem. Last Friday, I had one. I couldn’t receive an SMS from my bank in Australia, due to my choice to live, travel and work overseas.

It was infuriating. But then I thought: Surely I’m not the only person with this problem? There must be other poor nomads suffering like me.

I tweeted about it:

And I found out that most other nomads felt my pain.

When faced with an obvious problem shared by many, what should you do? Fix it.

Continue reading

The January Commit

December was tiring. Several of us WooThemes ninjas spent the month writing a blog post, every single day, just for the sake of it. But it was fun. It pushed us to hit the publish button, produce more content and improve our writing.

But that’s over. Now it’s time to really push ourselves. This isn’t a kids game anymore.

Welcome to The January Commit, a 31 day challenge demanding each participant makes at least 1 commit on GitHub daily throughout January.

Continue reading

You’re Welcome, Hippo

I’m not quite sure if I’m happy or sad, relieved or disappointed, but today, after 31 consecutive days of blogging, Blogging for Hippo, is finished. If you haven’t been following along, several of us WooThemes Ninjas committed to a full month of blogging, in honour of the upcoming WooCommerce 2.3 – Handsome Hippo release.

While I suppose the ‘purpose’ of the ‘competition’ was to cheer on and celebrate the almost-ready release, it probably did more harm than good, as it occupied quite a lot of core developer Barry Kooij’s time, along with a lot of my spare time that I’d usually commit to WooCommerce contributions / bug fixes.

But we had fun. I think. And I don’t regret it. That much.

Continue reading

The Software Update Problem

Regardless of how well you write code or develop products, updates are mandatory. When it comes to the software, the phrase ‘nothing is perfect’ is especially true.

So you’ll need to make updates. Probably a lot of them. Not just to cover bugs and improve compatibility, but also to add new features and enhancements to keep new and old customers happy (and coming back for more).

Continue reading

Simple is Supreme

Today I want to preach to you the power of simplicity. There is a discreet and utter beauty in the very concept of ‘less is more’. I feel like we often use the expression in hopes of justifying our lack of effort or enthusiasm, but actually, we should strive to do less – strive to work less and think less.

Simple is Supreme

Remember those words next time you dream up the ultimate settings panel or try and take the toughest route.

Continue reading

Keep Learning

When you get to the top of the mountain, with nothing but stunning views and steep edges surrounding you; the clouds so close, you can touch them, it’s easy to get comfortable. You deserve it. You climbed for weeks, months, years. You suffered through insufferable environments, trekked unknown terrain and conquered altitudes never thought possible.

Take a rest. Or keep going. That’s the next mountain to climb.

Continue reading