Cogini Blog

Jake Morrison

Choosing a Linux distribution

I have been using Linux since 1993, so I will give a bit of a history lesson to explain the motivation behind the popular distributions. There are two main families, RedHat and Debian. RedHat traditionally comes from the corporate world, and Debian from the free software community. Read more…

Jake Morrison

Benchmarking Phoenix on Digital Ocean

Just for fun, I decided to benchmark the performance of the elixir deploy template running on a $5/month Digital Ocean Droplet. Read more…

Jake Morrison

SaaS pricing: users are not all the same

It's popular these days to use hosted applications instead of running your own infrastructure. It's frustrating as a customer, though, when the pricing model is not sophisticated enough to match your actual usage. In a SaaS product, your pricing should scale with the value the customer gets from the product … Read more…

Jake Morrison

Avoiding GenServer bottlenecks

GenServers are the standard way to create services in Elixir. At it's heart, a GenServer is a separate process (thread) that receives messages, does some work, manages state, and sends responses back. If that's what you want, great. It's important to recognize, though, that a GenServer only handles one request … Read more…

Jake Morrison

Database migrations in the cloud

Database migrations are used to automatically keep the database in sync with the code that uses it. Elixir apps should be deployed as releases, supervised by systemd. Here is an example of how to run migrations when deploying Elixir releases. It's tempting to automatically run database migrations when the app … Read more…

Jake Morrison

Deploying Elixir apps without sudo

We normally deploy Elixir apps as releases, supervised by systemd. After we have deployed the new release, we restart the app to make it live: sudo /bin/systemctl restart foo The user account needs sufficient permissions to restart the app, though. Instead of giving the deploy account full sudo permissions … Read more…

Jake Morrison

Getting the client public IP address in Phoenix

When your app is running behind a proxy like Nginx or a CDN, then the requests will all look like they are coming from the proxy. Use the X-Forwarded-For header to set the remote_ip correctly. Read more…

Jake Morrison

Port forwarding with iptables

In order to listen on a TCP port less than 1024, an app traditionally needs to be started as root. Over the years this has resulted in many security problems. A better solution is to run the application on a normal port such as 4000, and redirect traffic in the … Read more…

Jake Morrison

Rate limiting Nginx requests

Any popular service may be the unfortunate recipient of a DDOS attack. We find that DDOS load ends up driving capacity planning, as it can easily be 10x the normal load. You can rate limit at multiple levels. You might use a service such as CloudFlare, filtering provided by your … Read more…

Jake Morrison

Serving your Phoenix app with Nginx

It's common to run web apps behind a proxy such as Nginx or HAProxy. Nginx listens on port 80, then forwards traffic to the app on another port, e.g. 4000. Following is an example nginx.conf config: user nginx; worker_processes auto; error_log /var/log/nginx/error.log warn; pid … Read more…


Development DevOps Products