How to properly deploy with Akka Cluster
<h1>Scenario</h1>

<p>Right now we only have a single node running the whole system. What we want is to make a distinction between "frontend" nodes, and a single "backend" node.</p>

<ul>
<li>"Frontend" nodes (N nodes): Maintains a persistent connection with the clients through a WebSocket connection</li>
<li>"Backend" node (1 node): Processes all the requests coming form all the frontend nodes querying to database, and handling the needed domain logic.</li>
</ul>

<p>This distinction is needed due to some reasons:</p>

<ul>
<li>Do not reach the <a href="https://stackoverflow.com/questions/651665/how-many-socket-connections-possible">limit of 70-100k persistent connections per frontend node</a></li>
<li>Avoid disconnecting the clients while deploying changes only affecting the backend</li>
</ul>

<h1>Work done</h1>

<p>We have connected the actors living on the frontend node with the ones living on the backend. We've done so instantiating the backend node <code>ActorRef</code>s from the frontend using the <code>akka.cluster.singleton.ClusterSingletonProxy</code>, and the <code>ClusterSingletonManager</code> while really instantiating them in the backend.</p>

<h1>Question</h1>

<p><strong>How we do the deploy taking into account the Akka cluster node downing notification?</strong></p>

<p>As far as I understood by <a href="http://www.google.com/url?q=http%3A%2F%2Fdoc.akka.io%2Fdocs%2Fakka%2Fcurrent%2Fscala%2Fcluster-usage.html%23Downing&amp;sa=D&amp;sntz=1&amp;usg=AFQjCNH5_RAsMAyXE4eoDRZTm_1cawT00Q" rel="nofollow noreferrer">the Akka Cluster documentation about downing</a>, and <a href="https://groups.google.com/forum/#!topic/akka-user/Sp_igF8QUZg" rel="nofollow noreferrer">some comments on the akka mailing list</a>, the recommended approach while dealing with that process would be something like:</p>

<ol>
<li>Download the akka distribution from <a href="http://akka.io/downloads/" rel="nofollow noreferrer">http://akka.io/downloads/</a></li>
<li>Copy and paste the <code>akka-cluster</code> bash script together with the <code>jmxsh-R5.jar</code> on a <code>resources/bin/</code> folder (for instance)</li>
<li>Include that folder on the distributed package (I've added the following lines on the <code>build.sbt</code>):
<code>
mappings in Universal ++=
(baseDirectory.value / "resources" / "bin" * "*" get) map
(bin =&gt; bin -&gt; ("bin/" + bin.getName))
</code></li>
<li>While deploying, set the node to be deployed as down manually calling the bash script like:

<ul>
<li>Execute <code>bin/akka-cluster %node_to_be_deployed:port% down</code></li>
<li>Deploy the new code version</li>
<li>Execute <code>bin/akka-cluster %deployed_node:port% join</code></li>
</ul></li>
</ol>

<p>Doubts:</p>

<ol>
<li>Is this step by step procedure correct?</li>
<li>If the node to be deployed will have the very same IP and port after the deploy, is it needed to make the <code>down</code> and <code>join</code>?</li>
<li>We're planning to set one frontend and the backend nodes as the seed ones. This way, all the cluster could be reconstructed while making a deploy only of the frontend nodes, or only to the backend one. Is it correct?</li>
</ol>

<p>Thanks!</p>