[99s-extend] Updating Cowboy applications

Loïc Hoguin essen at ninenines.eu
Thu Mar 13 14:22:03 CET 2014


Deploying is easy: releases.

The "getting started" chapter of the guide, and all the examples use 
that and it should be pretty easy to do.

You can reload Cowboy modules directly using l(module). You can reload 
most Ranch modules too but some of them will require using sys. Ranch 
will get support for upgrades as soon as I finish the upgrade test 
suite, but it's still low priority.

And upgrade of Cowboy processes can only be added after we make them 
special processes, which is still a way to go.

There is no plans for supporting unix sockets for the simple reason that 
it is not portable. On the other hand, if you use a separate library to 
open a socket and give it to Ranch (socket option), possibly writing a 
specific transport module for it, then it's very possible that you can 
use unix sockets (and if it works, please do send feedback).

On 03/13/2014 02:41 AM, Joshua McQuistan wrote:
> Hello all,
>
> I have written a Cowboy application that works fine over localhost. I'm
> now looking at ways of deploying and updating it i.e., moving from dev
> to prod in a nice manner.
>
> I have dug around the archives and have found that Cowboy does not
> support hot code reloading meaning either a restart of the vm or playing
> with code:reload_file is necessary.
>
> The latter suggests a possible rewriting of OTP's code loading mechanism
> and seems like it might be sensible to avoid.
>
> The other approach then is a restart. In previous (non-Cowboy) set ups
> I've used nginx on port 80 / 443 that talks to the web app via a unix
> socket (e.g., "web/socket"). When updating I'll start a new instance on
> a new socket (e.g., "web/socket.new") then rely on the file system's
> "mv" to switch it to "web/socket"; this works because the underlying
> file system guarantees mv to be atomic (or at least to never see a
> missing file). I can then ask the old process to shut down nicely in the
> background.
>
> For this to work it would require Cowby / Ranch to be able to listen on
> unix sockets. A glance at the documentation suggests that unix sockets
> aren't available, is this the case? What's the feasibility of it getting
> added?
>
> It might just be simpler to load-balance across multiple servers and
> safely take them out one at a time while updating.
>
> My other question is, how do others approach this problem? Did I miss
> something vitally obvious?
>
> Regards,
> Joshua
> _______________________________________________
> Extend mailing list
> Extend at lists.ninenines.eu
> https://lists.ninenines.eu/listinfo/extend
>

-- 
Loïc Hoguin
http://ninenines.eu



More information about the Extend mailing list