author Jake Morrison

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 …

author Jake Morrison

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 …

author Jake Morrison

When your app is running behind a proxy like Nginx, then the request will look like it's coming from Nginx, i.e. the IP will be 127.0.0.1. Similarly, If Nginx is behind a CDN, then all the requests will come from the IP of the CDN.

In …

author Jake Morrison

Normally, in order to listen on a port less than 1024, an app needs to be running as root or have elevated capabilities. That's a security problem waiting to happen, though. We run the app on a normal port, e.g. 4000, and redirect traffic in the firewall from port …

author Jake Morrison

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 …

author Jake Morrison

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 …

author Jake Morrison

When running your app in production, you can improve performance by serving static assets such as images, CSS and JS from a content delivery network (CDN). The CDN caches your content in servers close to your customers, improving network latency.

Phoenix is fast, but the more requests handled by the …

author Jake Morrison

A prospect recently asked me what the advantages are of Elixir over Golang.

The simple answer is productivity. You get the best of both worlds: the productivity of a high level language with the scaling power of the mature Erlang platform. For financial and health care applications, there is also …

author Jake Morrison

Whenever we try to squeeze the last bit of utilization out of a system, there is a danger that it will have a big negative impact on the user experience. A great example of this is overbooking in the airline industry. Usually a bad customer experience does not involve getting …