summaryrefslogtreecommitdiffstats
path: root/archives/extend/2014-March/000356.html
blob: a17422231e31eca315e5f56ffd21402596bd624a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
 <HEAD>
   <TITLE> [99s-extend] Updating Cowboy applications
   </TITLE>
   <LINK REL="Index" HREF="index.html" >
   <LINK REL="made" HREF="mailto:extend%40lists.ninenines.eu?Subject=Re%3A%20%5B99s-extend%5D%20Updating%20Cowboy%20applications&In-Reply-To=%3C53210CB8.5080109%40mcq.io%3E">
   <META NAME="robots" CONTENT="index,nofollow">
   <style type="text/css">
       pre {
           white-space: pre-wrap;       /* css-2.1, curent FF, Opera, Safari */
           }
   </style>
   <META http-equiv="Content-Type" content="text/html; charset=us-ascii">
   <LINK REL="Previous"  HREF="000355.html">
   <LINK REL="Next"  HREF="000357.html">
 </HEAD>
 <BODY BGCOLOR="#ffffff">
   <H1>[99s-extend] Updating Cowboy applications</H1>
    <B>Joshua McQuistan</B> 
    <A HREF="mailto:extend%40lists.ninenines.eu?Subject=Re%3A%20%5B99s-extend%5D%20Updating%20Cowboy%20applications&In-Reply-To=%3C53210CB8.5080109%40mcq.io%3E"
       TITLE="[99s-extend] Updating Cowboy applications">joshua.mcquistan at mcq.io
       </A><BR>
    <I>Thu Mar 13 02:41:12 CET 2014</I>
    <P><UL>
        <LI>Previous message: <A HREF="000355.html">[99s-extend] Getting started error: behaviour cowboy_http_handler undefined
</A></li>
        <LI>Next message: <A HREF="000357.html">[99s-extend] Updating Cowboy applications
</A></li>
         <LI> <B>Messages sorted by:</B> 
              <a href="date.html#356">[ date ]</a>
              <a href="thread.html#356">[ thread ]</a>
              <a href="subject.html#356">[ subject ]</a>
              <a href="author.html#356">[ author ]</a>
         </LI>
       </UL>
    <HR>  
<!--beginarticle-->
<PRE>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., &quot;web/socket&quot;). When updating I'll start a new instance on
a new socket (e.g., &quot;web/socket.new&quot;) then rely on the file system's
&quot;mv&quot; to switch it to &quot;web/socket&quot;; 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

</PRE>

<!--endarticle-->
    <HR>
    <P><UL>
        <!--threads-->
	<LI>Previous message: <A HREF="000355.html">[99s-extend] Getting started error: behaviour cowboy_http_handler undefined
</A></li>
	<LI>Next message: <A HREF="000357.html">[99s-extend] Updating Cowboy applications
</A></li>
         <LI> <B>Messages sorted by:</B> 
              <a href="date.html#356">[ date ]</a>
              <a href="thread.html#356">[ thread ]</a>
              <a href="subject.html#356">[ subject ]</a>
              <a href="author.html#356">[ author ]</a>
         </LI>
       </UL>

<hr>
<a href="https://lists.ninenines.eu/listinfo/extend">More information about the Extend
mailing list</a><br>
</body></html>