Tag Archives: linux

Recompile NGINX with OpenSSL 1.0.2+ for HTTP/2

No matter how “stable” your “surroundings” are, eventually you will face HTTP/2 and all those requirements to run it on your server using Linux and some HTTP daemon. One of those requirements will be the OpenSSL version 1.0.2 (with ALPN support).

You might be lucky and you will find proper package of the OpenSSL for your Linux distribution. But then, you might be required to recompile your HTTP daemon from source. Yes, I’m in this situation now: Debian 8, OpenSSL 1.0.2 from “backports” and NGINX 1.10 (from DotDeb.org or NGINX.org).

Thanks to the Ramūnas (colleague of mine) for the link Recompile NGINX with OpenSSL 1.0.2+ for HTTP/2 via ALPN – Ubuntu 14.04 – this helps me to deal quicker with NGINX on Debian 8 at least for development environment.

New Oracle VirtualBox release – 5.1

Tool I use, VirtualBox, has a new version released 5.1. If you are new to this tool – Oracle has an announcement Oracle VM VirtualBox 5.1.0 is now available!, but for me it has two most important changes: Improved Performance and Improved Linux integration. I hope VirtualBox will be much faster now.

Release is out there in repository, just type sudo apt-get install virtualbox-5.1 and upgrade if you can. Because I can’t – another tool, Vagrant, that depends on VirtualBox, stops working. Issue Support Virtualbox 5.1 #7411 is already closed, but there is no stable version release with that patch. for now So I’ll wait until Vagrant 1.8.5 released.

A new Skype (Alpha) for Ubuntu…

So, finally after few years(?) Microsoft updated Skype for Linux. But be careful, as much as I see from different sources: A new Skype for Ubuntu… Alpha available now!, Skype Announce Brand New Linux Client, Now In Alpha it’s still in Alpha and incompatible with old Skype for Linux.

So, think twice before upgrade, note from Microsoft:

You will notice that with the Alpha version of Skype for Linux, which uses our next generation calling architecture, you will be able to call your friends and family on the latest versions of Skype on Windows, Mac, iOS and Android, but you won’t be able to make or receive calls to and from the previous versions of Skype for Linux (4.3.0.37).

Look at the FAQ of Skype for Linux Alpha – you might miss a vital feature or two.

By the way, don’t miss the comments under Microsoft press-release – priceless :)

Will I upgrade? Nope, not until it’s stable or Old good Skype for Linux works on my Ubuntu 16.04.

NGINX in Ubuntu

That small but fast, flexible and powerful HTTP server, NGINX, with HTTP/2 support, that help many high-load project to deal with traffic and load-balancing, looks like has some issues on Ubuntu – The Road Ahead for NGINX in Ubuntu.

By the way, OpenSSL and HTTP/2 gets more and more traction in different Linux distributions, for example Debian added OpenSSL version 1.0.2 to “testing” and “backports” of “stable”.

AWS CodeDeploy

If AWS CodeDeploy is something new for you (as it is for me), you can read very comprehensive blog post by Matthew Weier O’Phinney Push-to-Deploy with AWS CodeDeploy. One valuable part of it – how to setup AWS CodeDeploy on your selected Linux distribution (AWS CodeDeploy comes pre-installed only on Amazon Linux AMI). But most valuable part – example of PHP project deploy script with explanations and example. So, have fun and automate your deployments!

Debian Backports

If you are new to Debian, and you require some newer software than present in “stable” version, and ready to take the risks – you can use Debian Backports repository. To get a bit more familiar with this official Debian repository you can start from reading “What are Debian Backports?“. Just read carefully, understand the risks and test before going to production.

No space left on device: Small files and inodes

I’ve run out of “free space” on building, testing and staging servers few times in last year with relatively small projects based on Symfony 2 or Zend Framework 2.

Used frameworks are rather small:

  • Symfony (2.4): 6450 files, 1283 folders, 46788608 bytes (apparent size 29894665)
  • Zend Framework (2.2): 2421 files, 427 folders, 17498112 bytes (apparent size 10912260)

So, framework or project files are not the issue, even if you build, test and deploy many times per day without removing previous releases (deployment process issue, fixed first). I’m talking in file size context.

So when you run out of free space – you login into server and type:

df -h

and see that you have half of partition empty (sometimes more), but when you try to create a new file you get: “No space left on device”.

But why? But how?

In my case it was inode count. I’ve run out of inodes on my partition. To see inode usage type:

df -i

So, inode (index node) is a data structure used to represent a filesystem object. Read more on Wikipedia or try to use search engines to find more info about inode.

At trouble making servers I’ve used default settings for my filesystems.

For example: if you have Ubuntu 13.10 and 4GB partition formatted with ext3 filesystem you will have 262144 inodes.
I’ve tried to copy Zend Framework 2 on that partition: 92 good copies, 1 corrupted copy, 2.2 GB free and out of inodes – waste of disk space. With Symfony 2 I’ve got 33 copies and out of inodes.

How to solve this issue? Buy bigger drive or increase inode count when you create filesystem on partition.

I’ll try to calculate optimal inode count for 4Gb partition with ext3 filesystem for both frameworks with maximal copies count. It might be a synthetic example, but if you automate builds of many projects with similar file count and file size ratio – this might help.

Partition size is about 3781115904 bytes, so we can copy ~80 Symfony 2 copies or ~216 copies of Zend Framework 2. Symfony 2 will require about 618640 inodes and Zend Framework 2 about 615168 inodes (inode per file or directory). Lets create ext3 filesystem on 4GB partition with 620000 inodes. Command for example:

mkfs.ext3 -N 620000 /dev/sdb1

I’ve tried to copy Zend Framework 2 on that partition: 216 good copies, with Symfony 2 I’ve got 79 copies – more than twice bigger.

Another way to calculate inodes count for partition: average file size in your project. Zend framework 2 7227 bytes, Symfony 2 7254 bytes, so on 3781115904 bytes partition we might have up to 522254 files (with avg.: 7240 bytes per file).

Conclusion: default filesystem settings not always the best choice for build, testing or staging servers. Look at your project or projects you will place on your servers, do some calculations – you might get better disk space usage for same price. Don’t forget, that you might need to place Composer cache somewhere on your build server – PHP projects/frameworks/libraries have quite big amount of smaller files in our times (in development versions even more) – this knowledge might be handy.

This calculations might not be suitable for production servers – user uploaded content might change average file size and your inode count might be a penalty. I never tested is there any performance penalties (or other drawbacks) if you increase inodes count.

Don’t forget that this rules apply only for filesystems with inodes, like ext2, ext3. Ext4 might have other rules (depends on settings). There are filesystems without inodes too.