Nginx Error Only From Mobile Devices

Recently I deployed a Phoenix application live on a Ubuntu 14.04 LTS and everything rendered fine until I tried on my mobile device. I instantly hit the “Welcome to Nginx” page.

Naturally I started looking at logs, both application logs and Nginx logs but no errors were being thrown.

Deploying Phoenix - Nginx

Deploying a Phoenix app is super simple. We are going to use an already existing application running the following:

1
2
Phoenix v1.1.4
Elixir 1.2.3

We will clone the application using git and our final setup will utilize nginx.

Nested Routes and Associations - Elixir and Phoenix

We are going to continue our todoapp by adding 2 models, Task and Comment. We will use generators (scaffolds) for both models. The Task will have many Comments and a Comment will belong to a Task. As a bonus, lets use a nested route.

To begin, let’s generate our full Task scaffold.

mix phoenix.gen.html Task tasks name:string body:text

The instructions following this command are important. Ensure you add the code

Elixir and Phoenix

When I first started using Rails I remember the emotions I experienced. Excitement over how fast I could now build a web application. Amazement at the magic that simply did hard work for me seamlessly. I’ve since watched Rails grow into an amazing framework and is still my goto web framework.

For the past year or more I’ve been mainly using Node.js, and I have to say I like it. But I found myself wanting to try something new. Something that got me as excited about programming as Rails once had. After some searching I stumbled across Elixir and the Phoenix framework.

Elixir is a dynamic, functional language designed for building scalable and maintainable applications. Elixir leverages the Erlang VM, known for running low-latency, distributed and fault-tolerant systems, while also being successfully used in web development and the embedded software domain.

Docker Usage

Recently I discovered Docker, which is an open platform for distrubuted applications for developers and sysadmins. Lets dive right in and start using it!

Loops: Each vs For

If you have spent some time around ruby, you probably have noticed that you do not see the for loop very often. Typically most rubyists use the each loop. And the for loop actually uses each. Yet there is one difference that can land you in trouble.

Setup Angular in a Rails 4 App

Use angular in a rails app

First we create the rails app

rails new awesome_app -d postgresql

Now some initial setup. Change directories to your app.

cd awesome_app

Gemfile

1
2
  gem 'bower-rails'
  gem 'angular-rails-templates'

Transitioning From a Regular Job to a Dream Job

For years I have written software for companies that push hard, don’t test and are only concerned with the bottom line. Now to be fair, a business is a business and as such needs to be profitable. But there is a trend to abuse a lot of people who are eager to do well in the software development arena.