{"id":379,"date":"2020-09-18T12:16:53","date_gmt":"2020-09-18T12:16:53","guid":{"rendered":"http:\/\/blogs.aalto.fi\/fire\/?page_id=379"},"modified":"2021-10-11T06:07:43","modified_gmt":"2021-10-11T06:07:43","slug":"installing-aamks","status":"publish","type":"page","link":"https:\/\/blogs.aalto.fi\/fire\/aamks\/installing-aamks\/","title":{"rendered":"Installing Aamks"},"content":{"rendered":"<h1><strong>Introduction<\/strong><\/h1>\n<p>This is a document of steps for installing Aamks on an Ubuntu Linux-based host network.<\/p>\n<p>About Aamks (from https:\/\/aamks.szach.in\/?node=about):<\/p>\n<p>&#8220;Aamks is an open source, web-based platform for assessing the fire safety of humans in buildings. Aamks runs hundreds of fire simulations (CFAST) and evacuation simulations (Aamks.Evac) and then evaluates the results. In each simulation humans are moving across the building and are affected by fire and smoke.&#8221;<\/p>\n<p>Aamks is still under development and updates may result in the procedures described in this document to no longer produce a functioning Aamks installation.<\/p>\n<h1><strong>Prerequisites<\/strong><\/h1>\n<p>Before beginning the Aamks installation, there are some prerequisites.<\/p>\n<h2><em>Linux hosts<\/em><\/h2>\n<p>Aamks requires at minimum two Ubuntu Server -based hosts: one host running the web-based GUI (henceforth referred to as server) and one host running the simulation (henceforth referred to as worker node). The worker node must be running Ubuntu 18.04 or newer. A fresh installation of Ubuntu on both the server and workers is preferable; make sure to install OpenSSH on all.<\/p>\n<p>The hosts should be connected to the same local network.<\/p>\n<p>Aamks uses the Python bindings for the RVO2 framework; the rvo2.so library which is packaged with the GitHub repository of Aamks works <span style=\"text-decoration: underline\">only<\/span> with Python 3.6. A surefire way of having Python 3.6 is to make a fresh installation of Ubuntu Server 18.04 on your hosts. If your Python version is newer than 3.6, you will either have to rebuild the rvo2.so library and replace the one that comes with the repository (for more information on that, see <a href=\"https:\/\/github.com\/sybrenstuvel\/Python-RVO2\">https:\/\/github.com\/sybrenstuvel\/Python-RVO2<\/a>), or you can install Python 3.6 alongside the newer version (see Troubleshooting section for installation instructions).<\/p>\n<p>Aamks requires a number of environment variables and aliases for successful operation on both the server and the worker node. To add these, use your preferred text editor:<\/p>\n<blockquote><p>$ vim ~\/.bashrc<\/p><\/blockquote>\n<p>and add the following:<\/p>\n<blockquote><p>#Aamks exports and env variables<br \/>\n# aamks {{{<br \/>\nexport AAMKS_PATH=&#8217;\/usr\/local\/aamks&#8217;<br \/>\nexport AAMKS_PG_PASS=&#8217;hulakula&#8217;<br \/>\nexport AAMKS_SERVER=&lt;Your server&#8217;s internal IP&gt;<br \/>\nexport PYTHONPATH=&#8221;${PYTHONPATH}:$AAMKS_PATH&#8221;<br \/>\nexport AAMKS_PROJECT=&#8217;\/home\/aamks_users\/demo@aamks\/demo\/simple&#8217;<br \/>\nexport AAMKS_WORKER=&#8217;gearman&#8217;<br \/>\nexport AAMKS_USER_ID=1<br \/>\nexport AAMKS_USE_GEARMAN=1<\/p>\n<p># If you are an Aamks worker your server sets up aamks.manager -U<br \/>\n[ -f &#8220;\/etc\/aamks_server.conf&#8221; ] &amp;&amp; {<br \/>\nsource \/etc\/aamks_server.conf<br \/>\n}<\/p>\n<p>alias aamks=&#8221;cd \/usr\/local\/aamks\/&#8221;<br \/>\nalias aamks.manager=&#8221;cd \/usr\/local\/aamks\/manager; python3 manager.py&#8221;<br \/>\nalias AA=&#8221;cd \/usr\/local\/aamks\/; python3 aamks.py; cd $AAMKS_PROJECT\/workers;&#8221;<br \/>\nalias AP=&#8221;cd $AAMKS_PROJECT&#8221;<\/p>\n<p>#}}}<br \/>\n[ -f ~\/.bashrc_ ] &amp;&amp; { source ~\/.bashrc_; }<br \/>\n[ -f ~\/.bashrc.$USER ] &amp;&amp; { source ~\/.bashrc.$USER; }<\/p>\n<p>umask 0002<br \/>\nexport USER=`id -un`<br \/>\nexport USERNAME=$USER<br \/>\nexport LOGNAME=$USER<br \/>\nexport PYTHONIOENCODING=&#8217;UTF-8&#8242;<br \/>\nexport PATH=&#8221;$PATH:\/usr\/local\/bin\/cfast\/bin&#8221;<br \/>\nexport PATH=&#8221;$PATH:\/usr\/lib\/go-1.10\/bin&#8221;<br \/>\nexport HOSTNAME=$HOSTNAME<\/p><\/blockquote>\n<p>Additionally, the server and the workers need to be able to communicate with each other via SSH without the use of passwords. To achieve this, run<\/p>\n<blockquote><p>$ ssh-keygen<\/p><\/blockquote>\n<p>on the server and all the workers. Keep the default key file name by pressing Enter. Hit Enter two more times to skip giving a passphrase.\u00a0\u00a0Then, on the server run<\/p>\n<blockquote><p>$ ssh-copy-id &lt;worker IP&gt;<\/p><\/blockquote>\n<p>and repeat the process for each worker IP. On each worker run<\/p>\n<blockquote><p>$ ssh-copy-id &lt;server IP&gt;<\/p><\/blockquote>\n<p>Finally, the server needs to be able to communicate with itself via SSH. To achieve this, run<\/p>\n<blockquote><p>$ ssh-copy-id localhost<\/p><\/blockquote>\n<p>on the server.<\/p>\n<h2><em>SSH-key authentication (optional)<\/em><\/h2>\n<p>To enable SSH-key authentication from a Windows machine to the server, download PuTTYgen and generate a public\/private key pair (default setting is 2048-bit RSA):<\/p>\n<p><a href=\"http:\/\/blogs.aalto.fi\/fire\/files\/2020\/09\/1_puttygen.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-357\" src=\"http:\/\/blogs.aalto.fi\/fire\/files\/2020\/09\/1_puttygen-300x294.png\" alt=\"\" width=\"300\" height=\"294\" srcset=\"https:\/\/blogs.aalto.fi\/fire\/files\/2020\/09\/1_puttygen-300x294.png 300w, https:\/\/blogs.aalto.fi\/fire\/files\/2020\/09\/1_puttygen.png 477w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Give a passphrase for the private key. Save the private key to C:\\Users\\YourUsername\\.ssh, the default file name is &#8220;id_rsa.ppk&#8221;. Copy the public key by right-clicking the public key text box, click &#8220;Select all&#8221;, then &#8220;Copy&#8221;:<\/p>\n<p><a href=\"http:\/\/blogs.aalto.fi\/fire\/files\/2020\/09\/2_puttygen-\u2013-save.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-359\" src=\"http:\/\/blogs.aalto.fi\/fire\/files\/2020\/09\/2_puttygen-\u2013-save-300x292.png\" alt=\"\" width=\"300\" height=\"292\" srcset=\"https:\/\/blogs.aalto.fi\/fire\/files\/2020\/09\/2_puttygen-\u2013-save-300x292.png 300w, https:\/\/blogs.aalto.fi\/fire\/files\/2020\/09\/2_puttygen-\u2013-save.png 481w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Connect to the server via PuTTY using your normal username\/password combination:<\/p>\n<p><a href=\"http:\/\/blogs.aalto.fi\/fire\/files\/2020\/09\/4_putty.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-361\" src=\"http:\/\/blogs.aalto.fi\/fire\/files\/2020\/09\/4_putty-300x189.png\" alt=\"\" width=\"300\" height=\"189\" srcset=\"https:\/\/blogs.aalto.fi\/fire\/files\/2020\/09\/4_putty-300x189.png 300w, https:\/\/blogs.aalto.fi\/fire\/files\/2020\/09\/4_putty.png 665w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Check whether the directory ~\/.ssh\/ and the file authorized_keys exist; if not, create the directory with<\/p>\n<blockquote><p>$ mkdir ~\/.ssh\/<\/p><\/blockquote>\n<p>Edit or create the file authorized_keys with<\/p>\n<blockquote><p>$ nano ~\/.ssh\/authorized_keys<\/p><\/blockquote>\n<p>Paste the public key in the file by right-clicking in the PuTTY terminal. Make sure the public key is in a single row, save and exit the file. To enable the login, the permissions of the directory and file need to be adjusted by the following commands:<\/p>\n<blockquote><p>$ chmod 600 ~\/.ssh\/authorized_keys<\/p>\n<p>$ chmod 700 ~\/.ssh<\/p>\n<p>$ chown $USER:$USER ~\/.ssh -R<\/p><\/blockquote>\n<p>Log out of the session. Restart PuTTY, go to Connection-&gt; SSH-&gt;Auth and browse and select the private key saved earlier:<\/p>\n<p><a href=\"http:\/\/blogs.aalto.fi\/fire\/files\/2020\/09\/3_putty.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-362\" src=\"http:\/\/blogs.aalto.fi\/fire\/files\/2020\/09\/3_putty-300x291.png\" alt=\"\" width=\"300\" height=\"291\" srcset=\"https:\/\/blogs.aalto.fi\/fire\/files\/2020\/09\/3_putty-300x291.png 300w, https:\/\/blogs.aalto.fi\/fire\/files\/2020\/09\/3_putty.png 453w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>In Connection-&gt;Data, insert your username to be used for login:<\/p>\n<p><a href=\"http:\/\/blogs.aalto.fi\/fire\/files\/2020\/09\/2_putty.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-363\" src=\"http:\/\/blogs.aalto.fi\/fire\/files\/2020\/09\/2_putty-300x291.png\" alt=\"\" width=\"300\" height=\"291\" srcset=\"https:\/\/blogs.aalto.fi\/fire\/files\/2020\/09\/2_putty-300x291.png 300w, https:\/\/blogs.aalto.fi\/fire\/files\/2020\/09\/2_putty.png 455w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Save the settings to the session profile:<\/p>\n<p><a href=\"http:\/\/blogs.aalto.fi\/fire\/files\/2020\/09\/6_putty.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-368\" src=\"http:\/\/blogs.aalto.fi\/fire\/files\/2020\/09\/6_putty-300x291.png\" alt=\"\" width=\"300\" height=\"291\" srcset=\"https:\/\/blogs.aalto.fi\/fire\/files\/2020\/09\/6_putty-300x291.png 300w, https:\/\/blogs.aalto.fi\/fire\/files\/2020\/09\/6_putty.png 451w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>The login should now work with SSH-key authentication:<\/p>\n<p><a href=\"http:\/\/blogs.aalto.fi\/fire\/files\/2020\/09\/5_putty.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-365\" src=\"http:\/\/blogs.aalto.fi\/fire\/files\/2020\/09\/5_putty-300x189.png\" alt=\"\" width=\"300\" height=\"189\" srcset=\"https:\/\/blogs.aalto.fi\/fire\/files\/2020\/09\/5_putty-300x189.png 300w, https:\/\/blogs.aalto.fi\/fire\/files\/2020\/09\/5_putty.png 663w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<h1><strong>Installing Aamks<\/strong><\/h1>\n<p>The installation process for the server and workers is slightly different; install the server first. You need to login as a non-root sudo user for the installation; create one if necessary.<\/p>\n<h2><em>Server installation<\/em><\/h2>\n<p>Login to the server and go to \/usr\/local<\/p>\n<blockquote><p>$ cd \/usr\/local<\/p><\/blockquote>\n<p>Copy the repository from Github using<\/p>\n<blockquote><p>$ git clone https:\/\/github.com\/aamks\/aamks.git<\/p><\/blockquote>\n<p>Navigate to \/usr\/local\/aamks\/installer<\/p>\n<blockquote><p>$ cd \/usr\/local\/aamks\/installer<\/p><\/blockquote>\n<p>There are two shell scripts for installation, server_install.sh and worker_install.sh. The former is installed on the server running the web-based GUI of Aamks, and the latter is installed on worker nodes responsible for the simulation. Before running either script, some modifications are necessary. Run a text editor of your choice<\/p>\n<blockquote><p>$ vim server_install.sh<\/p><\/blockquote>\n<p>and change the default parameter AAMKS_SERVER = 192.168.0.10 to match your server&#8217;s internal IP address:<\/p>\n<p><a href=\"http:\/\/blogs.aalto.fi\/fire\/files\/2020\/09\/server_install_1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-370\" src=\"http:\/\/blogs.aalto.fi\/fire\/files\/2020\/09\/server_install_1-300x100.png\" alt=\"\" width=\"300\" height=\"100\" srcset=\"https:\/\/blogs.aalto.fi\/fire\/files\/2020\/09\/server_install_1-300x100.png 300w, https:\/\/blogs.aalto.fi\/fire\/files\/2020\/09\/server_install_1.png 1021w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Save and exit the file.<\/p>\n<p>The server-worker network configuration must be made before running the server installation script. Modify the file aamksconf.json located in \/usr\/local\/aamks\/installer:<\/p>\n<blockquote><p>$ vim aamksconf.json<\/p><\/blockquote>\n<p>Under AAMKS_NETCONF, to enable your worker nodes, add your network under &#8220;enabled_networks&#8221;, e.g. &#8220;my_network&#8221;: X, where X is the number of processor cores on your workers. Add the network &#8220;my_network&#8221; under &#8220;networks&#8221; as well; you&#8217;ll need to enter the MAC address, the local IP of the worker(s) and the directed broadcast address, respectively:<\/p>\n<p><a href=\"http:\/\/blogs.aalto.fi\/fire\/files\/2020\/09\/aamks_conf_1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-374\" src=\"http:\/\/blogs.aalto.fi\/fire\/files\/2020\/09\/aamks_conf_1-300x113.png\" alt=\"\" width=\"300\" height=\"113\" srcset=\"https:\/\/blogs.aalto.fi\/fire\/files\/2020\/09\/aamks_conf_1-300x113.png 300w, https:\/\/blogs.aalto.fi\/fire\/files\/2020\/09\/aamks_conf_1.png 1018w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Save and exit the file.<\/p>\n<p>You can now install the server. Run the server_install.sh using<\/p>\n<blockquote><p>$ bash server_install.sh<\/p><\/blockquote>\n<p>To make a quick SSL setup, use the commands suggested by the server_install.sh script:<\/p>\n<blockquote><p>$ sudo a2enmod ssl<\/p>\n<p>$ sudo a2ensite default-ssl.conf<\/p>\n<p>$ sudo systemctl restart apache2<\/p><\/blockquote>\n<p><em>NOTE: the SSL should be configured to suit your needs, this is just a quick and basic setup.<\/em><\/p>\n<p>The Aamks GUI files must be pointed to Apache. Navigate to \/var\/www using<\/p>\n<blockquote><p>$ cd \/var\/www<\/p><\/blockquote>\n<p>This directory contains two subdirectories, \/html and \/ssl. Create a symbolic link from \/ssl to \/html using<\/p>\n<blockquote><p>$ sudo ln -s -f \/var\/www\/html \/var\/www\/ssl<\/p><\/blockquote>\n<p><span style=\"text-decoration: underline\">NOTE: this will remove the existing \/ssl directory!<\/span><\/p>\n<p>Next, navigate to \/html using<\/p>\n<blockquote><p>$ cd \/var\/www\/html<\/p><\/blockquote>\n<p>and create symbolic links for the Aamks GUI directory and the Aamks users directory using<\/p>\n<blockquote><p>$ ln -s -f \/usr\/local\/aamks\/gui \/var\/www\/html\/aamks<\/p><\/blockquote>\n<p>and<\/p>\n<blockquote><p>$ ln -s -f \/home\/aamks_users \/var\/www\/html\/aamks_users<\/p><\/blockquote>\n<p>The \/html directory contains the default index.html file. Remove or rename it and create a new file with<\/p>\n<blockquote><p>$ vim index.php<\/p><\/blockquote>\n<p>and add the following lines to it:<\/p>\n<blockquote><p>&lt;?php<br \/>\n2 header(&#8220;Location: \/aamks&#8221;);<br \/>\n3 ?&gt;<\/p><\/blockquote>\n<p>Save and exit. The Aamks GUI should now be accessible; check by going to your preferred web browser (if your server host configuration allows it) and enter localhost\/aamks (you might need to restart apache2 for changes to take place).<\/p>\n<h2><em>Worker installation<\/em><\/h2>\n<p>Login to your worker node,\u00a0go to \/usr\/local<\/p>\n<blockquote><p>$ cd \/usr\/local<\/p><\/blockquote>\n<p>Copy the repository from git:<\/p>\n<blockquote><p>$ git clone https:\/\/github.com\/aamks\/aamks.git<\/p><\/blockquote>\n<p>Navigate to \/usr\/local\/aamks\/installer:<\/p>\n<blockquote><p>$ cd \/usr\/local\/aamks\/installer<\/p><\/blockquote>\n<p>and modify worker_install.sh using your preferred text editor:<\/p>\n<blockquote><p>$ vim worker_install.sh<\/p><\/blockquote>\n<p>Change the parameter\u00a0_AAMKS_SERVER=&#8221;192.168.0.10&#8243;; to match your server&#8217;s internal IP address (i.e. the same IP used in server_install.sh):<\/p>\n<p><a href=\"http:\/\/blogs.aalto.fi\/fire\/files\/2020\/09\/worker_install_1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-371\" src=\"http:\/\/blogs.aalto.fi\/fire\/files\/2020\/09\/worker_install_1-300x88.png\" alt=\"\" width=\"300\" height=\"88\" srcset=\"https:\/\/blogs.aalto.fi\/fire\/files\/2020\/09\/worker_install_1-300x88.png 300w, https:\/\/blogs.aalto.fi\/fire\/files\/2020\/09\/worker_install_1.png 940w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Save and exit the file.<\/p>\n<p>Run the worker shell script using<\/p>\n<blockquote><p>$ bash worker_install.sh -i<\/p><\/blockquote>\n<p><em>Possible error during installation: Aamks uses the Boost library libboost_python3.so, which has a new naming convention following the Python 3.X release numbering. In my case, I used<\/em><\/p>\n<blockquote><p>$ cd \/usr\/lib\/x86_64-linux-gnu<\/p><\/blockquote>\n<p><em>and\u00a0<\/em><\/p>\n<blockquote><p>$ ls | less<\/p><\/blockquote>\n<p><em>to check whether libboost_python3.so was there.\u00a0<\/em><em>In my case, I had the newer libboost_python38.so which caused the worker_install.sh shell script to fail. To rectify this, I used<\/em><\/p>\n<blockquote><p>$ sudo ln -s libboost_python38.so libboost_python3.so<\/p><\/blockquote>\n<p><em>to make a symbolic link to libboost_python3.so from the new\u00a0libboost_python38.so name.<\/em><\/p>\n<h1><strong>Starting Aamks<\/strong><\/h1>\n<p>Following installation, use your preferred web browser to check whether the website of the server is working by accessing<\/p>\n<blockquote><p>&lt;your server&#8217;s public IP or DNS name&gt;\/aamks<\/p><\/blockquote>\n<p>You should see the login page for Aamks (see\u00a0<a href=\"https:\/\/blogs.aalto.fi\/fire\/using-aamks\/\">https:\/\/blogs.aalto.fi\/fire\/using-aamks\/<\/a>\u00a0for more details on the Aamks web GUI).<\/p>\n<p>Next, the server and workers need to be added to the network. Run the command<\/p>\n<blockquote><p>$ aamks.manager -a<\/p><\/blockquote>\n<p>to add the server and workers specified in the aamksconf.json file to the network.<\/p>\n<p>Try making a simulation and running it (see\u00a0<a href=\"https:\/\/blogs.aalto.fi\/fire\/using-aamks\/\">https:\/\/blogs.aalto.fi\/fire\/using-aamks\/<\/a>\u00a0); if all goes well there should be no error messages.<\/p>\n<h1><strong>Managing Aamks<\/strong><\/h1>\n<p>Log in to the server. The main management tool for the server and workers is manager.py; by running<\/p>\n<blockquote><p>$ aamks.manager -h<\/p><\/blockquote>\n<p>the command line options for the manager are shown:<\/p>\n<p><a href=\"http:\/\/blogs.aalto.fi\/fire\/files\/2020\/09\/manager_1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-385\" src=\"http:\/\/blogs.aalto.fi\/fire\/files\/2020\/09\/manager_1-300x152.png\" alt=\"\" width=\"300\" height=\"152\" srcset=\"https:\/\/blogs.aalto.fi\/fire\/files\/2020\/09\/manager_1-300x152.png 300w, https:\/\/blogs.aalto.fi\/fire\/files\/2020\/09\/manager_1.png 644w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Running with option -l<\/p>\n<blockquote><p>$ aamks.manager -l<\/p><\/blockquote>\n<p>the active worker nodes and server are listed as well as currently queued and running simulation jobs:<\/p>\n<p><a href=\"http:\/\/blogs.aalto.fi\/fire\/files\/2020\/09\/manager_workers.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-453\" src=\"http:\/\/blogs.aalto.fi\/fire\/files\/2020\/09\/manager_workers-240x300.png\" alt=\"\" width=\"240\" height=\"300\" srcset=\"https:\/\/blogs.aalto.fi\/fire\/files\/2020\/09\/manager_workers-240x300.png 240w, https:\/\/blogs.aalto.fi\/fire\/files\/2020\/09\/manager_workers.png 395w\" sizes=\"auto, (max-width: 240px) 100vw, 240px\" \/><\/a><\/p>\n<p>In a working Aamks configuration, the aOut worker is the server and the aRun workers are the worker nodes. There should be only one aOut worker and the number of aRun workers depends on the number of cores and worker nodes determined in the aamksconf.json file.<\/p>\n<p>Any simulation jobs queued are shown under the tasks column. Jobs currently being run is shown under the working column. If the aRun row shows a non-zero number of jobs on both the tasks and working columns for extended periods of time, the jobs might be stuck on the workers. To rectify this, there are three commands that need to be run to clear the queue. First, run<\/p>\n<blockquote><p>$ aamks.manager -r<\/p><\/blockquote>\n<p>this will kill and restart the Gearman job dispatcher on the server and clear the jobs server-side. Next, run<\/p>\n<blockquote><p>$ aamks.manager -k<\/p><\/blockquote>\n<p>this will kill all gearman\/cfast\/python processes on the worker nodes. Finally, run<\/p>\n<blockquote><p>$ aamks.manager -a<\/p><\/blockquote>\n<p>this will add the previously killed server and workers back to the network.<\/p>\n<p>Sometimes CFAST or Python processes will get stuck on the workers and option -k seemingly clears them but they are in fact still running. To check this, login to your worker(s) via SSH<\/p>\n<blockquote><p>$ ssh &lt;Your worker&gt;<\/p><\/blockquote>\n<p>and run the command<\/p>\n<blockquote><p>$ ps aux<\/p><\/blockquote>\n<p>this will list all processes running. Look for CFAST or Python processes with high CPU or memory usage (typically &gt;90%). The processes will be owned by the user under which Aamks was installed. Once you have identified these processes, note their process ID (PID) and kill them manually using<\/p>\n<blockquote><p>$ sudo kill -9 &lt;PID&gt;<\/p><\/blockquote>\n<p>You can kill multiple processes with a single command by adding all PIDs separated by a single space each. Another option is to run the command<\/p>\n<blockquote><p>$ aamks.manager -c &#8220;pkill -9 -f &#8216;cfast.in$'&#8221;<\/p><\/blockquote>\n<p>from the server.<\/p>\n<p>Looking at the processes running may also help diagnose other problems. In a normally functioning worker node not running any jobs, there should be a number of Gearman processes equal to the number of cores specified on the worker running, with the following format:<\/p>\n<blockquote><p>gearman -w -h &lt;Your server&#8217;s local IP&gt; -f aRun xargs python3 \/usr\/local\/aamks\/evac\/worker.py<\/p><\/blockquote>\n<p>To remove all users and their projects on the server run play.sh located in \/usr\/local\/aamks\/installer:<\/p>\n<blockquote><p>$ cd \/usr\/local\/aamks\/installer<\/p>\n<p>$ bash play.sh<\/p><\/blockquote>\n<p>This will remove all registered users and their projects.<\/p>\n<h2><em>Adding new workers after first installation<\/em><\/h2>\n<p>Depending on your needs you might want to add new workers to the Aamks network later. To do this, first configure the new workers following the prerequisites and worker installation instructions above. Then, login to the server and edit the aamksconf.json file located in \/etc\/ with your preferred text editor:<\/p>\n<blockquote><p>$ vim \/etc\/aamksconf.json<\/p><\/blockquote>\n<p>Add the new workers&#8217; MAC address, local IP, and directed broadcast address to the network you&#8217;re using:<\/p>\n<p><a href=\"http:\/\/blogs.aalto.fi\/fire\/files\/2020\/09\/aamks_conf_1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-374\" src=\"http:\/\/blogs.aalto.fi\/fire\/files\/2020\/09\/aamks_conf_1-300x113.png\" alt=\"\" width=\"300\" height=\"113\" srcset=\"https:\/\/blogs.aalto.fi\/fire\/files\/2020\/09\/aamks_conf_1-300x113.png 300w, https:\/\/blogs.aalto.fi\/fire\/files\/2020\/09\/aamks_conf_1.png 1018w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Then, restart Gearman on the server using<\/p>\n<blockquote><p>$ aamks.manager -r<\/p><\/blockquote>\n<p>and terminate Gearman on the workers with<\/p>\n<blockquote><p>$ aamks.manager -k<\/p><\/blockquote>\n<p>Finally, add workers using<\/p>\n<blockquote><p>$ aamks.manager -a<\/p><\/blockquote>\n<p>The reason for first terminating the existing workers is that if you run aamks.manager -a after modifying the aamksconf.json file the existing workers will be added again; Gearman will then think the workers have double the amount of cores they actually have, causing the computational load to exceed the capacity of the workers.<\/p>\n<h2><em>Updating Aamks<\/em><\/h2>\n<p>Aamks uses Git for version control. To update an existing installation, navigate to the aamks-directory<\/p>\n<blockquote><p>$ cd \/usr\/local\/aamks<\/p><\/blockquote>\n<p>and run<\/p>\n<blockquote><p>$ git pull<\/p><\/blockquote>\n<p>Depending on the changes, you might need to modify the server_install.sh, worker_install.sh and aamksconf.json files; it might also be necessary to run the shell scripts again.<\/p>\n<h1><strong>Troubleshooting<\/strong><\/h1>\n<h2><em>Jobs are not sent from the server to the worker<\/em><\/h2>\n<p>Check that the job was successfully created. Using your web browser, go to &lt;your server&#8217;s public IP or DNS name&gt;\/aamks_users and check whether there is a directory with the same name as the e-mail you used for registration. If it is there, access the directory in your web browser by clicking it. Inside the directory, there should be another directory with the name of the project you gave. Access the project by clicking it. Inside the project directory should be the scenario directories, access any of them by clicking it. Within a scenario directory, there should be a directory called &#8220;workers&#8221; containing directories numbered 1 &#8211; &lt;number of simulations you specified to be run&gt;. Click on any of the numbered directories; inside should be two files, cfast.in and evac.json:<\/p>\n<p><a href=\"http:\/\/blogs.aalto.fi\/fire\/files\/2020\/10\/aamks_users.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-471\" src=\"http:\/\/blogs.aalto.fi\/fire\/files\/2020\/10\/aamks_users-300x67.png\" alt=\"\" width=\"300\" height=\"67\" srcset=\"https:\/\/blogs.aalto.fi\/fire\/files\/2020\/10\/aamks_users-300x67.png 300w, https:\/\/blogs.aalto.fi\/fire\/files\/2020\/10\/aamks_users.png 903w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>These are the input files for the simulation created by Aamks in the web GUI. If these are present, move to the next step<\/p>\n<p>Check \/etc\/aamksconf.json on the server and verify that the MAC addresses, local IP addresses and directed broadcast addresses of both the server and the workers are all correct. Then, check your $AAMKS_SERVER environment variable on the server and the worker and see that it matches the server&#8217;s local IP address using<\/p>\n<blockquote><p>$ echo $AAMKS_SERVER<\/p><\/blockquote>\n<p>Check that passwordless, passphraseless SSH login works from server to worker, and from server to server by running the commands<\/p>\n<blockquote><p>$ ssh &lt;worker IP&gt;<\/p><\/blockquote>\n<p>and<\/p>\n<blockquote><p>$ ssh localhost<\/p><\/blockquote>\n<p>on the server.<\/p>\n<h2><em>Finished job results are not sent from the worker to the server<\/em><\/h2>\n<p>Similar to the above, check the $AAMKS_SERVER environment variable, and check that passwordless, passphraseless SSH login works from worker to server.<\/p>\n<p>If the jobs were successfully created on the server after launching the simulation from the web GUI, you can try running the jobs manually on the worker. To do this, login to the worker and navigate to \/usr\/local\/aamks\/evac:<\/p>\n<blockquote><p>$ cd \/usr\/local\/aamks\/evac<\/p><\/blockquote>\n<p>Then, go to your web browser and copy (or note) the address of the simulation you want to run. This is of the format &lt;your server IP or DNS name&gt;\/aamks_users\/&lt;your username&gt;\/&lt;your project name&gt;\/&lt;your scenario name&gt;\/workers\/&lt;number of the simulation&gt;<\/p>\n<p>To run a job manually, run the command<\/p>\n<blockquote><p>$ python3 worker.py\u00a0&lt;your server IP or DNS name&gt;\/aamks_users\/&lt;your username&gt;\/&lt;your project name&gt;\/&lt;your scenario name&gt;\/workers\/&lt;number of the simulation&gt;<\/p><\/blockquote>\n<p>For example, to manually run the demo scenario &#8220;simple&#8221; on your worker, run<\/p>\n<blockquote><p>$ python3 worker.py\u00a0&lt;your server IP or DNS name&gt;\/aamks_users\/demo@aamks\/demo\/simple\/workers\/1<\/p><\/blockquote>\n<p>Note that you need to launch the jobs on the web GUI and they need to have been created on the server for this to work.<\/p>\n<p>If there are no error messages and the job didn&#8217;t get stuck, the results should now be located on the worker in \/home\/aamks_users\/demo@aamks\/demo\/simple\/workers\/1<\/p>\n<p>The results still need to be sent to the server. To transfer the results manually, login to the server, navigate to \/usr\/local\/aamks\/manager and run<\/p>\n<blockquote><p>$ python3 results_collector.py &lt;your worker IP&gt; \/home\/aamks_users\/&lt;your username&gt;\/&lt;your project name&gt;\/&lt;your scenario name&gt;\/workers\/&lt;number of the simulation&gt;\/meta_&lt;number of the simulation&gt;.json &lt;number of the simulation&gt;<\/p><\/blockquote>\n<p>For example, to get the results of the aforementioned demo, run<\/p>\n<blockquote><p>$ python3 results_collector.py &lt;your worker IP&gt; \/home\/aamks_users\/demo@aamks\/demo\/simple\/workers\/1\/meta_1.json 1<\/p><\/blockquote>\n<p>This command will instruct the server to fetch the results from the worker specified; the results are contained in the meta-file of the path provided; the results should be deposited in the number 1 directory of the same path on the server.<\/p>\n<p>The animation should now be available in the web GUI<\/p>\n<h2><em>Manually running a job gives an error or crashes<\/em><\/h2>\n<p>There are a\u00a0 couple of common errors:<\/p>\n<p><a href=\"http:\/\/blogs.aalto.fi\/fire\/files\/2020\/10\/evac_error.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-472\" src=\"http:\/\/blogs.aalto.fi\/fire\/files\/2020\/10\/evac_error-300x69.png\" alt=\"\" width=\"300\" height=\"69\" srcset=\"https:\/\/blogs.aalto.fi\/fire\/files\/2020\/10\/evac_error-300x69.png 300w, https:\/\/blogs.aalto.fi\/fire\/files\/2020\/10\/evac_error.png 643w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>ModuleNotFoundError: the $PYTHONPATH environment variable does not contain the \/usr\/local\/aamks directory and subdirectories, hence Python can&#8217;t find the evac.py file within the same directory as worker.py. Check your .bashrc file and make sure the line<\/p>\n<blockquote><p>export PYTHONPATH=&#8221;${PYTHONPATH}:$AAMKS_PATH&#8221;<\/p><\/blockquote>\n<p>is there.<\/p>\n<p><a href=\"http:\/\/blogs.aalto.fi\/fire\/files\/2020\/10\/pythread_error.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-473\" src=\"http:\/\/blogs.aalto.fi\/fire\/files\/2020\/10\/pythread_error-300x76.png\" alt=\"\" width=\"300\" height=\"76\" srcset=\"https:\/\/blogs.aalto.fi\/fire\/files\/2020\/10\/pythread_error-300x76.png 300w, https:\/\/blogs.aalto.fi\/fire\/files\/2020\/10\/pythread_error.png 663w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>ImportError: undefined symbol _PyThreadState_Current: this error is caused by trying to run the worker.py module with an incompatible Python 3 version. The rvo2.so library was built with a system using Python 3.6, so it will not work with later versions. Either rebuild the rvo2.so library or switch to Python 3.6 (see &#8220;Installing Python 3.6&#8221; below).<\/p>\n<p><a href=\"http:\/\/blogs.aalto.fi\/fire\/files\/2020\/10\/sim3_error.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-474\" src=\"http:\/\/blogs.aalto.fi\/fire\/files\/2020\/10\/sim3_error-300x180.png\" alt=\"\" width=\"300\" height=\"180\" srcset=\"https:\/\/blogs.aalto.fi\/fire\/files\/2020\/10\/sim3_error-300x180.png 300w, https:\/\/blogs.aalto.fi\/fire\/files\/2020\/10\/sim3_error.png 642w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Fortran runtime error: this error is caused by CFAST opening more files\/file descriptors than the system allows. To check the maximum amount of open files, use<\/p>\n<blockquote><p>$ ulimit -n<\/p><\/blockquote>\n<p>The default limit is 1024. CFAST is written in Fortran and may need more than this depending on the simulation parameters. To increase the limits, first check the hardware limit using<\/p>\n<blockquote><p>$\u00a0cat \/proc\/sys\/fs\/file-max<\/p><\/blockquote>\n<p>and note the amount. This is the maximum limit allowed by the hardware of the host which cannot be exceeded. To set the limit for the user running Aamks on the worker, use your preferred text editor to edit the\u00a0\/etc\/security\/limits.conf file<\/p>\n<blockquote><p>$ sudo vim \/etc\/security\/limits.conf<\/p><\/blockquote>\n<p>and add the following lines to the file:<\/p>\n<blockquote><p>&lt;Your Aamks-running username&gt; hard nofile &lt;Your limit&gt;<br \/>\n&lt;Your Aamks-running username&gt; soft nofile &lt;Your limit&gt;<\/p><\/blockquote>\n<p>The changes will be active the next time you login as the user.<\/p>\n<p><a href=\"http:\/\/blogs.aalto.fi\/fire\/files\/2020\/10\/AssertionError.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-475\" src=\"http:\/\/blogs.aalto.fi\/fire\/files\/2020\/10\/AssertionError-300x157.png\" alt=\"\" width=\"300\" height=\"157\" srcset=\"https:\/\/blogs.aalto.fi\/fire\/files\/2020\/10\/AssertionError-300x157.png 300w, https:\/\/blogs.aalto.fi\/fire\/files\/2020\/10\/AssertionError.png 663w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>AssertionError: this is a problem associated with the rebuilding of rvo2.so using a newer version of Python 3. The cause of the problem is currently unknown. Suggested fix is to use an earlier version of Python 3.<\/p>\n<p><a href=\"http:\/\/blogs.aalto.fi\/fire\/files\/2020\/10\/error_14-\u2013-kopio.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-492\" src=\"http:\/\/blogs.aalto.fi\/fire\/files\/2020\/10\/error_14-\u2013-kopio-300x42.png\" alt=\"\" width=\"300\" height=\"42\" srcset=\"https:\/\/blogs.aalto.fi\/fire\/files\/2020\/10\/error_14-\u2013-kopio-300x42.png 300w, https:\/\/blogs.aalto.fi\/fire\/files\/2020\/10\/error_14-\u2013-kopio-1024x143.png 1024w, https:\/\/blogs.aalto.fi\/fire\/files\/2020\/10\/error_14-\u2013-kopio.png 1250w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>IEEE_UNDERFLOW_FLAG IEEE_DENORMAL exceptions: these exceptions are from CFAST, written in Fortran and compiled using the GNU compiler. The IEEE_UNDERFLOW_FLAG exception is triggered when the result of an expression in the CFAST simulation exceeds the precision of the variable being assigned the value i.e. a number smaller than a certain threshold. This exception will also trigger IEEE_DENORMAL. These exceptions are typically inconsequential, should have no impact on the results of the simulation, and can be ignored.<\/p>\n<p><a href=\"http:\/\/blogs.aalto.fi\/fire\/files\/2020\/10\/IndexError.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-512\" src=\"http:\/\/blogs.aalto.fi\/fire\/files\/2020\/10\/IndexError-300x104.png\" alt=\"\" width=\"300\" height=\"104\" srcset=\"https:\/\/blogs.aalto.fi\/fire\/files\/2020\/10\/IndexError-300x104.png 300w, https:\/\/blogs.aalto.fi\/fire\/files\/2020\/10\/IndexError-1024x356.png 1024w, https:\/\/blogs.aalto.fi\/fire\/files\/2020\/10\/IndexError.png 1227w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>IndexError: this is an error with the Python portion of the simulation. Specifically, a path out of the simulation couldn&#8217;t be calculated, therefore simulating the evacuation was not possible. There are a couple of reasons why this could be the case, the most obvious being that there is no exit from the building, or a way out of a room. See the &#8220;Troubleshooting&#8221; section of\u00a0<a href=\"https:\/\/blogs.aalto.fi\/fire\/using-aamks\/\">https:\/\/blogs.aalto.fi\/fire\/using-aamks\/<\/a>\u00a0for more tips on common modelling mistakes.<\/p>\n<h2><em>Installing Python 3.6 alongside a newer version<\/em><\/h2>\n<p><span style=\"text-decoration: underline\">NOTE: Additional problems may occur. Easiest way to ensure Python 3.6 on your system is to make a fresh installation of Ubuntu Server 18.04 on your worker hosts.<\/span><\/p>\n<p>Because packages (e.g. NumPy, SciPy) are version-specific for Python , you should first install Python 3.6, assign it as the default Python version and only then install Aamks.<\/p>\n<p>To install Python 3.6 alongside a newer version, first run<\/p>\n<blockquote><p>$ sudo add-apt-repository ppa:deadsnakes\/ppa<\/p>\n<p>$ sudo apt-get update<\/p>\n<p>$ sudo apt-get install python3.6<\/p><\/blockquote>\n<p>Next, to set up alternatives, run<\/p>\n<blockquote><p>$ sudo update-alternatives &#8211;install \/usr\/bin\/python python \/usr\/bin\/python3.6 1<\/p>\n<p>$ sudo update-alternatives &#8211;install \/usr\/bin\/python python \/usr\/bin\/python3.8 2<\/p><\/blockquote>\n<p>Now, to configure Python 3.6 as the default Python version, run<\/p>\n<blockquote><p>$ sudo update-alternatives &#8211;config python<\/p><\/blockquote>\n<p>press 1, then Enter on keyboard. Now check that the Python version you are using is 3.6 by running<\/p>\n<blockquote><p>$ python &#8211;version<\/p><\/blockquote>\n<p>The Python version should be 3.6.X<\/p>\n<p>You can use the described procedure to set up multiple different Python versions.<\/p>\n<h1><strong>Setting up Aamks on Microsoft Azure cloud service<\/strong><\/h1>\n<p>Aalto University uses the Microsoft Azure cloud service for hosting Aamks. This part of the guide gives instructions for setting up and maintaining Aamks in an Azure environment.<\/p>\n<h2><em>Setting up the virtual machines using Azure Portal<\/em><\/h2>\n<p>Go to Azure at\u00a0<a href=\"https:\/\/portal.azure.com\">https:\/\/portal.azure.com<\/a> and login or create an account if you don&#8217;t have on already.<\/p>\n<p>Type &#8220;virtual machines&#8221; (without quotations) in the Azure search bar or click &#8220;Virtual machines&#8221; under Azure services:<\/p>\n<p><a href=\"http:\/\/blogs.aalto.fi\/fire\/files\/2020\/10\/0.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-483\" src=\"http:\/\/blogs.aalto.fi\/fire\/files\/2020\/10\/0-300x48.png\" alt=\"\" width=\"300\" height=\"48\" srcset=\"https:\/\/blogs.aalto.fi\/fire\/files\/2020\/10\/0-300x48.png 300w, https:\/\/blogs.aalto.fi\/fire\/files\/2020\/10\/0-1024x163.png 1024w, https:\/\/blogs.aalto.fi\/fire\/files\/2020\/10\/0.png 1704w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>In the Virtual machines page, select &#8220;Add&#8221;, this will open the &#8220;Create virtual machine&#8221; page:<\/p>\n<p><a href=\"http:\/\/blogs.aalto.fi\/fire\/files\/2020\/10\/0_1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-484\" src=\"http:\/\/blogs.aalto.fi\/fire\/files\/2020\/10\/0_1-300x53.png\" alt=\"\" width=\"300\" height=\"53\" srcset=\"https:\/\/blogs.aalto.fi\/fire\/files\/2020\/10\/0_1-300x53.png 300w, https:\/\/blogs.aalto.fi\/fire\/files\/2020\/10\/0_1-1024x179.png 1024w, https:\/\/blogs.aalto.fi\/fire\/files\/2020\/10\/0_1.png 1706w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>In the &#8220;Basics&#8221; tab, under &#8220;Project details&#8221;, select your subscription and then click &#8220;Create new&#8221; to create a new resource group. Give the resource group an appropriate name:<\/p>\n<p><a href=\"http:\/\/blogs.aalto.fi\/fire\/files\/2020\/10\/1_0.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-485\" src=\"http:\/\/blogs.aalto.fi\/fire\/files\/2020\/10\/1_0-300x274.png\" alt=\"\" width=\"300\" height=\"274\" srcset=\"https:\/\/blogs.aalto.fi\/fire\/files\/2020\/10\/1_0-300x274.png 300w, https:\/\/blogs.aalto.fi\/fire\/files\/2020\/10\/1_0.png 796w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Under &#8220;Instance details&#8221; give the virtual machine a name; for easy identification name the server host aamks-server and worker host(s) aamks-workerX, where X is a running number. Choose a suitable region for the location of your virtual machines. Choose Ubuntu 18.04 for your &#8220;Image&#8221;.\u00a0<em>Note: Ubuntu 20.04 will work for the server host, but for the worker hosts Ubuntu 18.04 is a better choice due to Python 3.6 as the default Python 3 interpreter.\u00a0<\/em>The size of the machine depends on whether this is a server host or a worker host; for server Standard B4ms is suitable, whereas for workers Standard F8s_v2 is suitable.<\/p>\n<p>Under &#8220;Administrator account&#8221; you can choose either &#8220;SSH public key&#8221; or &#8220;Password&#8221;:<\/p>\n<p><a href=\"http:\/\/blogs.aalto.fi\/fire\/files\/2020\/10\/3.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-486\" src=\"http:\/\/blogs.aalto.fi\/fire\/files\/2020\/10\/3-300x78.png\" alt=\"\" width=\"300\" height=\"78\" srcset=\"https:\/\/blogs.aalto.fi\/fire\/files\/2020\/10\/3-300x78.png 300w, https:\/\/blogs.aalto.fi\/fire\/files\/2020\/10\/3-1024x266.png 1024w, https:\/\/blogs.aalto.fi\/fire\/files\/2020\/10\/3.png 1050w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>You can change the login options of the machine later from the machine itself. For now, choose &#8220;SSH public key&#8221;. In &#8220;Username&#8221; type a suitable username. For the &#8220;SSH public key source&#8221; you can either generate a new key pair, or use an existing key pair. For now, generate a new key pair. Give the key pair a suitable name e.g. MyKey.<\/p>\n<p>Under &#8220;Inbound port rules&#8221; in &#8220;Public inbound ports&#8221;, choose &#8220;Allow selected ports&#8221; and then select SSH (22) and HTTP (80) from the drop-down menu:<\/p>\n<p><a href=\"http:\/\/blogs.aalto.fi\/fire\/files\/2020\/10\/4.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-487\" src=\"http:\/\/blogs.aalto.fi\/fire\/files\/2020\/10\/4-300x106.png\" alt=\"\" width=\"300\" height=\"106\" srcset=\"https:\/\/blogs.aalto.fi\/fire\/files\/2020\/10\/4-300x106.png 300w, https:\/\/blogs.aalto.fi\/fire\/files\/2020\/10\/4.png 796w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>In the &#8220;Disks&#8221; tab, under &#8220;Disk options&#8221;, select the Premium SSD for the OS disk. Leave the encryption as the default option. Under &#8220;Data disks&#8221;, create and attach a new data disk.\u00a0Select Premium SSD for it as well. The OS disk should have a capacity of at least 30 GB, the data disk size is up to the user:<\/p>\n<p><a href=\"http:\/\/blogs.aalto.fi\/fire\/files\/2020\/10\/5.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-488\" src=\"http:\/\/blogs.aalto.fi\/fire\/files\/2020\/10\/5-300x218.png\" alt=\"\" width=\"300\" height=\"218\" srcset=\"https:\/\/blogs.aalto.fi\/fire\/files\/2020\/10\/5-300x218.png 300w, https:\/\/blogs.aalto.fi\/fire\/files\/2020\/10\/5.png 874w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>In the &#8220;Networking tab&#8221;, create a new virtual network and a new public IP for your virtual machine. You can use these when you create the other virtual machines in the Aamks network. Leave other choices to default:<\/p>\n<p><a href=\"http:\/\/blogs.aalto.fi\/fire\/files\/2020\/10\/6.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-496\" src=\"http:\/\/blogs.aalto.fi\/fire\/files\/2020\/10\/6-300x289.png\" alt=\"\" width=\"300\" height=\"289\" srcset=\"https:\/\/blogs.aalto.fi\/fire\/files\/2020\/10\/6-300x289.png 300w, https:\/\/blogs.aalto.fi\/fire\/files\/2020\/10\/6.png 848w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Go to the &#8220;Review and create&#8221; tab and check that the information for the virtual machine to be created is correct, then select &#8220;Create&#8221;.<\/p>\n<p>When the &#8220;Generate new key pair&#8221; window opens, select &#8220;Download private key and create resource&#8221;. Your key file will be downloaded as &lt;your key pair name&gt;.pem, e.g. MyKey.pem. Make sure you know where the .pem file was downloaded, as the path will be needed later.<\/p>\n<p>When the deployment of the virtual machine is finished, select &#8220;Go to resource&#8221;. On the page of the virtual machine, select the public IP address of your machine and copy it to clipboard:<\/p>\n<p><a href=\"http:\/\/blogs.aalto.fi\/fire\/files\/2020\/10\/7_ip.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-495\" src=\"http:\/\/blogs.aalto.fi\/fire\/files\/2020\/10\/7_ip-300x68.png\" alt=\"\" width=\"300\" height=\"68\" srcset=\"https:\/\/blogs.aalto.fi\/fire\/files\/2020\/10\/7_ip-300x68.png 300w, https:\/\/blogs.aalto.fi\/fire\/files\/2020\/10\/7_ip.png 545w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Login to the virtual machine using SSH. You can do this from a Bash prompt (Linux, Mac) or PowerShell (Windows). In the prompt, run<\/p>\n<blockquote><p>$ ssh -i &lt;path to your key&gt;myKey1.pem &lt;your specified username&gt;@&lt;your virtual machine&#8217;s public IP&gt;<\/p><\/blockquote>\n<p>for example,<\/p>\n<blockquote><p>$\u00a0ssh -i .\\Downloads\\myKey1.pem azureuser@10.111.12.123<\/p><\/blockquote>\n<p>Once logged in, you can configure your virtual machine as needed.<\/p>\n<h2><em>Scaling Aamks in Azure<\/em><\/h2>\n<p>Depending on the amount of users it might be necessary to scale the amount of workers in the Aamks network. This is done by creating a scale set. The easiest way of configuring a scale set is by using the Azure CLI tool; it can be downloaded from\u00a0<a href=\"https:\/\/docs.microsoft.com\/en-us\/cli\/azure\/install-azure-cli-apt?view=azure-cli-latest\">https:\/\/docs.microsoft.com\/en-us\/cli\/azure\/install-azure-cli-apt?view=azure-cli-latest<\/a>.<\/p>\n<p>First step is to configure a worker as the basis for the scale set; configure one virtual machine as an Aamks worker node with all the appropriate settings. Make sure the worker configuration is valid by running some simulations from the web GUI.<\/p>\n<p>After verifying that the worker configuration works, shut down the worker either from Azure Portal or from the command line.<\/p>\n<p>Next, using the Azure CLI, login to Azure by running<\/p>\n<blockquote><p>$ az login<\/p><\/blockquote>\n<p>Check that the subscription is the correct one by running<\/p>\n<blockquote><p>$\u00a0az account show -o table<\/p><\/blockquote>\n<p>The virtual machine that forms the basis for the scale set will be copied using Azure managed images. First, let&#8217;s check all the available disks for copying in &lt;your resource group&gt; with<\/p>\n<blockquote><p>$\u00a0az vm list -g &lt;your resource group&gt;\\<br \/>\n&#8211;query &#8216;[].{Name:name,DiskName:storageProfile.osDisk.name}&#8217; \\<br \/>\n&#8211;output table<\/p><\/blockquote>\n<p>Note the name of the disk that you want to to copy, then copy it using<\/p>\n<blockquote><p>$\u00a0<span class=\"hljs-keyword\">az disk create <\/span><span class=\"hljs-parameter\">&#8211;resource-group<\/span>\u00a0&lt;your resource group&gt; \\ <span class=\"hljs-parameter\">&#8211;name<\/span> &lt;your new disk&gt;\u00a0<span class=\"hljs-parameter\">&#8211;source<\/span> &lt;your source disk&gt;<\/p><\/blockquote>\n<p>This will copy the disk &lt;your source disk&gt; to a new disk called &lt;your new disk&gt;. Next, create a new virtual network interface card (NIC) with<\/p>\n<blockquote><p>$\u00a0az network nic create &#8211;resource-group &lt;your resource group&gt; \\<br \/>\n&#8211;location &lt;location of your resource group&gt; \\<br \/>\n&#8211;name &lt;name of your NIC&gt; \\<br \/>\n&#8211;vnet-name &lt;name of the virtual network&gt; &#8211;subnet default<\/p><\/blockquote>\n<p>This will create a new NIC in the same location as your other virtual machines (e.g. westeurope) with the name &lt;name of your NIC&gt; in the virtual network &lt;name of your virtual network&gt; specified earlier during creation of the other virtual machines.<\/p>\n<p>Create the worker copy with<\/p>\n<blockquote><p>$\u00a0az vm create &#8211;resource-group &lt;your resource group&gt; \\<br \/>\n&#8211;name &lt;name of the copy&gt; &#8211;nics &lt;name of your NIC&gt; \\<br \/>\n&#8211;size &lt;your worker size&gt; &#8211;os-type Linux \\<br \/>\n&#8211;attach-os-disk &lt;your new disk&gt;<\/p><\/blockquote>\n<p>This will create a new worker in &lt;your resource group&gt; with the name &lt;name of your copy&gt;, using the &lt;name of your NIC&gt; interface. Its size is &lt;your worker size&gt; and its OS disk will be &lt;your new disk&gt; which was created earlier.<\/p>\n<p>The newly-created worker copy needs to be deallocated and generalized so that a custom image can be created for the Azure scale set basis.<\/p>\n<p><em>NOTE: Generalizing a virtual machine prevents it from being used again, that is why we created a copy of an existing worker.<\/em><\/p>\n<p>To deallocate, run<\/p>\n<blockquote><p>$\u00a0az vm deallocate &#8211;resource-group &lt;your resource group&gt; &#8211;name &lt;name of the copy&gt;<\/p><\/blockquote>\n<p>To generalize, run<\/p>\n<blockquote><p>$\u00a0az vm generalize &#8211;resource-group &lt;your resource group&gt; &#8211;name &lt;name of the copy&gt;<\/p><\/blockquote>\n<p>To create a custom image, run<\/p>\n<blockquote><p>$\u00a0az image create \\<br \/>\n&#8211;subscription &lt;your subscription&gt; \\<br \/>\n&#8211;resource-group &lt;your resource group&gt; \\<br \/>\n&#8211;name &lt;name of the custom image&gt; \\<br \/>\n&#8211;source &lt;name of the copy&gt; \\<br \/>\n&#8211;tags &lt;any tags you might have applied&gt;<\/p><\/blockquote>\n<p>Next, a new scale set will be created. To do this, run<\/p>\n<blockquote><p>az vmss create \\<br \/>\n&#8211;subscription &lt;your subscription&gt; \\<br \/>\n&#8211;resource-group &lt;your resource group&gt; \\<br \/>\n&#8211;image &lt;name of the custom image&gt; \\<br \/>\n&#8211;name &lt;name of the scale set&gt; \\<br \/>\n&#8211;admin-username &lt;admin username&gt; \\<br \/>\n&#8211;vnet-name &lt;name of the virtual network&gt; \\<br \/>\n&#8211;subnet &lt;name of the subnet&gt; \\<br \/>\n&#8211;nsg &lt;name of the worker security group&gt; \\<br \/>\n&#8211;tags &lt;any tags you might have applied&gt; \\<br \/>\n&#8211;ssh-key-value &lt;SSH public key used by the Aamks server&gt;<\/p><\/blockquote>\n<p>This will create a new scale set named &lt;name of the scale set&gt;, it will be created under the &lt;your subscription&gt; subscription in the resource group &lt;your resource group&gt;. The scale set will use the &lt;name of the custom image&gt; image as the basis for new virtual machines created by the scaling.\u00a0 The virtual machines created by the scaling will belong to the &lt;name of the virtual network&gt; virtual network, and the rules of the &lt;name of the worker security group&gt; network security group will be used to determine what traffic is and isn&#8217;t allowed. The virtual machines created by scaling will belong to the &lt;name of the subnet&gt; subnet, and they will allow SSH login corresponding to the specified public key.<\/p>\n<p>After the scale set has been created, you can manage it from Azure Portal. The scale set can be used in manual mode or automatic mode. In manual mode, you set the number of additional worker instances using the slider in &#8220;Scaling&#8221;:<\/p>\n<p><a href=\"http:\/\/blogs.aalto.fi\/fire\/files\/2020\/10\/scaling.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-502\" src=\"http:\/\/blogs.aalto.fi\/fire\/files\/2020\/10\/scaling-300x118.png\" alt=\"\" width=\"300\" height=\"118\" srcset=\"https:\/\/blogs.aalto.fi\/fire\/files\/2020\/10\/scaling-300x118.png 300w, https:\/\/blogs.aalto.fi\/fire\/files\/2020\/10\/scaling-1024x404.png 1024w, https:\/\/blogs.aalto.fi\/fire\/files\/2020\/10\/scaling.png 1296w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>In automatic mode, you set a rule for autoscaling the number of worker instances, e.g. if the CPU use percentage rises above a certain threshold.<\/p>\n<p><strong>Currently, Aamks cannot benefit from autoscaling<\/strong>, as the Aamks server doesn&#8217;t automatically recognize new workers and the new workers cannot automatically inform the server of their presence. <strong>The remaining part of scaling must therefore be done by hand<\/strong>, whether scaling manually or with an autoscaling rule; check the MAC address, internal IP address and directed broadcast mask on each new worker by logging in via SSH and using e.g.<\/p>\n<blockquote><p>$ ifconfig<\/p><\/blockquote>\n<p>Then, add the worker&#8217;s information to the \/etc\/aamksconf.json file on the server and follow the procedure for adding new workers as described earlier in this guide.<\/p>\n<p>If you need to update the image used for the scale set (e.g. by creating a new custom image from a different machine), first obtain the new reference image ID using<\/p>\n<blockquote><p>$\u00a0az image list &#8211;query &#8216;[].id&#8217;<\/p><\/blockquote>\n<p>Then, update the image for the scale set using<\/p>\n<blockquote><p>$\u00a0az vmss update \\<br \/>\n&#8211;resource-group &lt;your resource group&gt;\\<br \/>\n&#8211;name &lt;name of the scale set&gt; \\<br \/>\n&#8211;set virtualMachineProfile.storageProfile.imageReference.id=&lt;name of the new image&gt;<\/p><\/blockquote>\n<p>This will update the scale set named &lt;name of the scale set&gt; located under resource group &lt;your resource group&gt; to use the custom image &lt;name of the new image&gt;.<\/p>\n<p><span class=\"author vcard\">Posted by Christian Riitamaa<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction This is a document of steps for installing Aamks on an Ubuntu Linux-based host network. About Aamks (from https:\/\/aamks.szach.in\/?node=about): &#8220;Aamks is an open source, web-based platform for assessing the fire safety of humans in buildings. Aamks runs hundreds of &hellip; <a href=\"https:\/\/blogs.aalto.fi\/fire\/aamks\/installing-aamks\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":3523,"featured_media":0,"parent":559,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-379","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/blogs.aalto.fi\/fire\/wp-json\/wp\/v2\/pages\/379","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.aalto.fi\/fire\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/blogs.aalto.fi\/fire\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.aalto.fi\/fire\/wp-json\/wp\/v2\/users\/3523"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.aalto.fi\/fire\/wp-json\/wp\/v2\/comments?post=379"}],"version-history":[{"count":47,"href":"https:\/\/blogs.aalto.fi\/fire\/wp-json\/wp\/v2\/pages\/379\/revisions"}],"predecessor-version":[{"id":525,"href":"https:\/\/blogs.aalto.fi\/fire\/wp-json\/wp\/v2\/pages\/379\/revisions\/525"}],"up":[{"embeddable":true,"href":"https:\/\/blogs.aalto.fi\/fire\/wp-json\/wp\/v2\/pages\/559"}],"wp:attachment":[{"href":"https:\/\/blogs.aalto.fi\/fire\/wp-json\/wp\/v2\/media?parent=379"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}