Cogini Blog
Articles by phoenix
Featured articles
Deploying an Elixir app to Digital Ocean with mix_deploy
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…

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…

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…

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…

Serving Phoenix static assets from a CDN
Phoenix is fast, but you can improve performance by serving requests for static files like images, CSS and JS from Nginx or a content delivery network (CDN). This allows your app to focus on dynamic content. Serving static assets from Nginx If you are running your app behind Nginx, configure … Read more…

Incrementally migrating large Rails apps to Phoenix
Here are the slides for the presentation on incrementally migrating large Rails apps to Phoenix I gave at Ruby Elixir Conf Taiwan 2018. Read more…

Is Elixir/Phoenix ready for production?
How I evaluated Elixir in 2014 when we were deciding whether it was mature enough Read more…

Incrementally migrating a legacy app to Phoenix
Over the years we have done lots of projects where we migrated an application from one platform to another. We might do this to solve performance issues or to switch to a better technology stack. This can be a challenge when you have a big app that is in production … Read more…