Linux vs FreeBSD for Phoenix?

I’d like to add that I think FreeBSD is a more superior operating system, mostly because of stability and documentation. I’ve had a few production CentOS and Debian Linux systems break on me for no apparent reasons in the last 5 years. I’ve started using FreeBSD 4 years ago and have never had any major issues, servers all running stable.

However, if you’re used to Linux and good at managing Linux servers, just use that.

As long as you install Elixir it’s a win for our community anyway :smiley:

7 Likes

For those of you interested in promoting FreeBSD, you are welcome to start a Wiki with info (and reasons etc) about using it with Elixir here on the forum if you like :slight_smile:

If you’re up for it, go ahead and start the thread and I’ll make a wiki for you and add it to our list of stickies :slight_smile:

3 Likes

For myself, I think I’m going to keep it in this thread for now and in the “experimentation” realm, since a Wiki sounds more like a dependable information and I can’t provide that as a beginner.
It would be great if someone with professional experience is willing to share their know-how in a Wiki though :slight_smile:

1 Like

EDIT: Misread

Also, better kernel polling, DTrace, better schedulers, integrated OS, ZFS, Jails. Those are options you don’t find in the GNU/Linux world. The network stack is faster and more reliable (as others have pointed out).

I run FreeBSD on my laptop, on my workstation and on my deploy servers. We run FreeBSD at work in production and we deploy Elixir and Erlang applications with a breeze. We are now moving forward to containers using http://www.tredly.com/

7 Likes

For desktop/laptop use, would you suggest something like PC-BSD or just rolling your own?

1 Like

@thinkpadder1 PC-BSD is fine and it has a lot of 3rd-party software available for installation but there is nothing wrong with plain FreeBSD. You can install a desktop environment like KDE or GNOME using the FreeBSD package manager. PC-BSD is friendlier to the end user though.

3 Likes

Here is a link to deploying Phoenix on FreeBSD 11-0-RELEASE on Google’s Compute Engine. The setup uses nginx, Letsencrypt, Distillery and eDeliver.

8 Likes

I’d recommend using FreeBSD over any Linux distro for a production environment for several reasons:

  1. Better integration of OS apps/utilities/libs
  2. Security audits/alerts/updates are thus more holistic
  3. Configuration just feels more sane and thought out
  4. Improved stability, based on the above
  5. Excellent features - from jails to network stack
  6. Great cross-pollination between BSDs - easy to a lib from another BSD in your preferred one.
  7. Linux compatibility
  8. Supportive community
  9. Bonus is, if you are using OS X, much of the userland/dir system, libs, etc, should appear familiar.

It’s why the general trend appears for companies appears to migrate from Linux distros to FreeBSD for their server environment.

If you want a desktop environment, then Linux may be the best choice still, but PC-BSD (the last time I looked), has come a long way), but my preference would be for OS X unless you are doing scientific work that requires Linux.

Here’s a link with a few of the big name organisations/companies using FreeBSD - from Apache Foundation to Netflix to WhatsApp: Welcome to FreeBSD!

Oddly, I find people new to Linux are often more apprehensive of learning and using FreeBSD, as many developers are of postgresql - choosing mysql over it, when my experience of Postgresql and FreeBSD are less frustrating, and FreeBSD much easier to keep up-to-date with changes/improvements and discuss solutions with the community.

If you want to build the next big thing, I’d suggest choosing FreeBSD over any Linux distro for all the above reasons, but if there’s something cutting edge that a Linux distro has that FreeBSD or any of the other BSDs can’t (yet) do, then go with Linux. Otherwise, FreeBSD will often take you further in regards to scaling, stability, and security.

6 Likes

/me has been a big FreeBSD user for decades, but nowadays I’d recommend some Illumos derivative for all the same reasons, except Illumos containers are BSD Jails but done right. ^.^

4 Likes

Your post makes me want to try BSD :smile: the ‘bonus’ is pretty compelling to, especially if it means it would be easier to get into:

3 Likes

Illumos too, both Illumos and FreeBSD have the same root system type from the original BSD, thus the same filesystem and structure setup too, except Illumos has containers. ^.^

1 Like

Agree but sadly Illumos lack the documentation and tutorial that FreeBSD have.

I launched my own stuff to do more sysadmin stuff recently. I tried SmartOs/Illumos. Got stuck after 5 min. After 2 days of tryign to find answers, but only found dead link, switched to freeBSD. I will come back to Illumos/SmartOS for bigger things.

1 Like

Heh, most FreeBSD information works directly on Illumos as well, they have the same root system. The main difference in Illumos is that jails are baked into the kernel, into the very process struct itself, so everything is running in a ‘jail’, including the original login in the root jail. :slight_smile:

That design fixes issues that FreeBSD’s jails have, like non-segmented network, poor control of CPU and RAM usage, etc…

I know. But let be honest there is work to be done here. The system is really great but the community lack visibility. I would like to see the FreeBSD book equivalent for SmartOS.

I may do it in a couple year, but not right now.

3 Likes

I didn’t go through all of the thread, so excuse me.

I will focus on the main discussion of this thread: which OS is better for Phoenix / Elixir development.

I switch operating systems every two or three months by the simple fact that I enjoy testing other operating systems. I have tried about 80% of the mainstream Linux distros, but not very much of FreeBSD, after a couple of years using Linux I always come back to Arch Linux (or one of it’s distros) for two simple things: The Archwiki and AUR.

If you are a programmer looking to switch to a new OS one of the things you have to look for is a good package management system. That is why I love and I keep using Arch, beside many other benefits. I have a lot of software at my disposal which is carefully tested and updated.

In the last 6 months I’ve switched 2 operating systems, I’ve went from an Arch based distro to Debian, openSUSE, and back to an Arch based distro.

I’ve returned from one simple reason: I wasn’t pleased with the number of packages I had on those distros.
I might be picky, but for me it’s a good reason.

DigitalOcean has a good series of articles Getting Started with FreeBSD on their servers.

Part 1, A Comparative Introduction to FreeBSD for Linux Users doesn’t do a bad job of explaining some of the main differences between FreeBSD and Linux. I think the following quote from the summary paragraph does sum a lot of what Linux users often fail to understand, and perhaps why they cling/return to one Linux distro - the need for a consistent OS philosophy:

Treating FreeBSD as its own operating system instead of insisting on viewing it through a Linux lens will help you avoid fighting with the OS and will generally result in a better experience.

Or as said from Comparing FreeBSD and Linux from the FreeBSD docs:

This arrangement differs from Linux in a number of ways:

No one person controls the content of the system. In practice, this difference is overrated, since the Principal Architect can require that code be backed out, and even in the Linux project several people are permitted to make changes.
On the other hand, there is a central repository, a single place where you can find the entire operating system sources, including all older versions.
BSD projects maintain the entire “Operating System”, not only the kernel. This distinction is only marginally useful: neither BSD nor Linux is useful without applications. The applications used under BSD are frequently the same as the applications used under Linux.
As a result of the formalized maintenance of a single SVN source tree, BSD development is clear, and it is possible to access any version of the system by release number or by date. SVN also allows incremental updates to the system: for example, the FreeBSD repository is updated about 100 times a day. Most of these changes are small.

This blog post should give you a good idea of the simplicity of Installing Phoenix, Elixir and PostgreSQL on FreeBSD

The FreeBSD Handbook is a great place to start and good reference to keep using as it’s kept up-to-date, although you’ll find more specific information about parts of FreeBSD and processes elsewhere from manpages to blogs, books, youtube vids, etc.

When stuck, The FreeBSD Forums and StackExchange’s serverfault are great places for quick answers.

If you want to easily browse or search through the thousands of packages and ports that FreeBSD has available for it, you can do so at FreshPorts or obviously within a FreeBSD install itself.

As an aside, I should also note that not only is much of the userland in OS X similar to FreeBSD’s, part of OS X’s kernel is from FreeBSD - Kernel Programming, BSD - as one of the co-founders of FreeBSD was at Apple from 2001 to 2013 (now at iXsystems who acquired PC-BSD in 2006, renaming it TrueOS, and in 2010 re-released FreeNAS rewritten using FreeBSD.)

Containers/jails certainly have their uses, but for working with Elixir and Phoenix Framework, especially in a production environment, my opinion would be to avoid them and focus on the OTP and how it natively scales, and look at use of containers/jails where security matters on the edge of your network, in firewalls, reverse proxies.

5 Likes

I agree with you DianaOlympos

It’s great to see SmartOS, Illumos etc develop, and not only because its engineers are responsible for some of the great recent additions to FreeBSD, but because alternatives that keep FreeBSD on its toes are always needed.

But at this time, when checking off the usual criteria for choosing a dev and production OS - from user base (WhatsApp to cloud/server providers like Digital Ocean that offer easy to create and configure cheap FreeBSD servers) to an active supportive community (including up-to-date docs to forums and howtos) to the availability of a huge number of packages and ports as well as the option for Linux Binary compatibility, I think FreeBSD is the obvious pick for a startup or company wanting to scale with stability and security that Linux distros rarely can match if they can at all.

For cutting edge stuff that hasn’t yet made it into FreeBSD, if you need it, then I suggest SmartOS/Illumos or a Linux distro alternative.

Uh, for note, Illumos can run native Linux code (at faster than linux speed). :wink:

I think it’s important to keep proper perspective just because dude X ported something from Illumos to FreeBSD it does not mean it is as stable, performant and well tested as the original. A lot of original SUN engineers are involved in the Illumos ecosystem and very few are involved in various ports to other systems.

Sure, but FreeBSD doesn’t rush to integrate the ‘latest and greatest’ like Linux distros often do to differentiate their distro from others - it only integrates features from other OSes with a view to improving the overall OS, whether for performance or security or feature set, which means lots of testing, better audits, and the ability for users to downgrade to a previous version easily if necessary.

The FreeBSD community certainly isn’t reliant on ex Sun engineers and SmartOS/Illumos to improve - it gets improved from a much larger range of people, including cross-pollination from the other BSDs.

That doesn’t mean FreeBSD is perfect, but its community makes sure it is steadily improved from release to release, which is why it was chosen by WhatsApp to Netflix etc - for feature set, stability, and security.

When SmartOS/Illumos etc have the track record of high production deployments that FreeBSD has, using comparable/same features, and as large a community of users/committers, and available docs etc, then more people will look at it.

But as it is now, with regular releases, great features, stability, security, and scalability, and a large supportive community, up-to-date docs, etc - FreeBSD is an easy pick for someone that may want to build just a website or the next WhatsApp on it compared to choosing a Linux distro or SmartOS/Illumos.

2 Likes