Month: July 2015

Upgrading dokku to 0.3.22: some gotchas

but than I write about it

but then I write about it

I’ve upgraded dokku to the latest master release, to make sure I was running the latest version.

The reason for the upgrade was that I wanted to install supervisord plugin, so when I have to reboot my server due to an upgrade, all my application will come back to life automatically.

After the upgrade of dokku, all my container where down, so I’ve launched the command to rebuild all of them:

dokku ps:rebuildall

Unfortunately this didn’t work as expected.

My web containers (running three apps: django/python, flask/python, wordpress/php) got deployed as expected, instead my databases did not come back to life.

The two plugins I am using to run my databases are: dokku-pg-plugin and dokku-md-plugin.

While both plugins do not offer a clear way to restart the databases containers, I think I found out a way that worked for me as a workaround. It’s different for each plugin.

For the mariadb you have to fake to re-create the database, which will use your old database container and just re-attach to it.

 
dokku mariadb:create <olddbname>

For the postgresql instead, you have to re-link the old database:

dokku postgresql:link <myapp> <mydb>

Each of this command should trigger an instant redeploy, and your application should be back online.

One thing to know: if you stop a command execution with a Control-C, you may leave your application in a blocked state. If you run a rebuild or any other command, you may found out saying “Error your application is locked”. To get rid of that go on your server and blow away the /home/dokku/app_name/.build.lock file.

Watch out: the name of the file and/or error could be different, I just recall from memory.

Switch private repo from github to gitlab

Hello gitlab

Hello gitlab

Github: the good part

Github is awesome for opensource software. The collaboration, the audience, and the integration offered right now (July 2015) is very good.

You want your opensource projects to be on github, because of SEO and the ability to have them found. The several features offered, like the documentation integration, the Pull Request and so forth are just too good. I have got several projects there, and you can browse them here.

Github: the expensive part

However, if you are looking to host there also your private repo, it’s when github is not any more what you are looking for.

The major problem they have is their price structure. The micro plan, is 7$ for 5 repos, and than it’s 12$ for 10. It gets expensive very quickly.

Until today I used to pay for a micro plan. However yesterday I’ve started another project, I have created a repo for it, and than I wanted to push it online in private mode. But it was my six repos. Either I was going to opensource it, or I had to increase my plan from 7$ to 12$.

All these repos are from personal project, that I may not develop anymore, which however I don’t want to opensource and I cannot archive either. The number of collaborators on these repo is either 0 or 1 at most. I think if they were offering unlimited private repository, with small number of collaborators I could have considered to stick with them for my private repo.

Not an option, so I had a look around.

Looking for alternative: Bitbucket or Gitlab?

The big competitor of github is of course bitbucket. Back in the days bitbucket was supporting only mercurial, but than they also integrated the support for git. So you could put your project there, and than be happy. Their pricing structure just count the number of collaborators in a project, so in my case I can have all my repos with the free account.

However, it’s a bit of time that we use at work a self-hosted gitlab , which it served me pretty well so far, and I love the slick integration with the GitlabCI.

GitLab is very similar to github, and offers similar features: once you know that Pull Request are called Merge request, you’re golden.

The cool thing is there is an hosted version, where you have as many as you want private and public repos.

At the end I decided to got for gitlab, due to the integration with the Gitlab CI, which will give me the ability to run tests for all my private repositories, given the fact I provide a runner.

Of course all my opensource repo swill stay on github, and in case I will opensource some project I will just migrate them on github.

As I said, If there was an Indie developer price point, (unlimited private repos with small number of collaborators for 7$), I was going to stay on github and be happy with that, however given the circumstances and the automatic integration with the CI, Gitlab is my choice for now.

Handpicked wordpress plugins for your self-hosted wordpress blog

A nice pic of a boat on a lake. Not really relevant with the post

A nice pic of a boat on a lake. Not really relevant with the post, but still pleasing

Intro

With the recent move from wordpress.com to a self hosted wordpress.org blog, I had the possibilities to pick some plugins that really have helped me to set-up and make the blog a tad bit more customized and close to my needs.

I’m gonna list them here, with a small description so it may be handy for someone else that is researching the subject as well

The handpicked Plugins

  • Worpress Importer This plugins lets you import your old wordpress.com blog in the new wordpress installation. Make sure you have `import everything` selected when you do the import, so all the images and attachments are happily downloaded and imported as well.You have to make sure you have increased the max upload file on you server, if you are importing a very big file. This is done changing you php configuration and the limit of max upload either in nginx or apache, depending what you are using. More info how to do this here.
  • Next plugin you want to get is JetPack from wordpress. This plugin has a lot of feautures that you can activate as you see fit. My favourite onese are: publicize (automatic sharing on G+, Facebook and Twitter), Moitor, that keeps an eye if your site goes offline and Photon, to serve images quicker from their CDN.
  • Spam is always a bad thing, and BruteProtect is a way to pretect yourself from it. You just activate it, and it is going to do is job.
  • Once you move to self-hosted blog, you have to manage also the backup for your site.
    A very handy plugin is UpdraftPlus – Backup/Restore, which gives you the ability to:

    1. Make automatic backup of your blog, including database, images, themes and plugins
    2. Upload you backup to a third party service, like for example DropBox
    3. Configure a schedule for your backup, with also a number of old backups you want to keep. My pick was 10 backups, with a weekly schedule.
    4. Restore your old backups with a single click.

    It’s very well designed and it works like a charm. Totally recommended

  • To make sure you write to the point, and keep your post interesting also for search engines, Worpress SEO is a good candidate. Although the title parser looks only for one keyword, so there will be always a disagreement between the plugin and a sane title, it’s extremely handy to keep sitemap up to date and automatically signal google when a new post pop up. Handy tool.
  • Due to the amount of code I tend to post, a nice way to present it, with proper highlighting it’s useful to have. For this I’ve picked Enlighter – Customizable Syntax Highlighter, which does a very good work, comes with themes to nicely integrate with the current palette of your site.
  • Last but not least, the Disqus Comment System is a nice and, according to me, superior way to enable comments on your post. It offers an import function to transfer all your old wordpress.com comments on the disqus system, and it’s pretty nice thing to have.

So there it is, some of the plugins I’m using on this website, which you may, or may not, find useful for your own site.