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 …
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 …
Figuring out how to deploy your Elixir app can be confusing, as it's a bit different from other languages. This post describes how we deploy apps with the reasons behind our decisions.
We have created a working example template which puts all the pieces together to get you started quickly …
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 …
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 …
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.
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 …
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 …
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
user nginx; worker_processes auto; error_log /var/log/nginx/error.log warn; pid …
- db migrations
- functional programming
- graphical design
- know your customer
- rate limiting
- static assets
- user experience
- user stories