Skip to content
Mikaël Mayer edited this page May 19, 2016 · 2 revisions

How to deploy on a new server using tmux

On a custom server, on a repository of your choice, do the following commands.

tmux new -s leon
git clone --recursive https://github.com/EPFL-LARA/leon-web
cd leon-web
./start.sh

The script ./start.sh takes care also of recompiling the documentation.
It runs leon-web on the port 9900 of the server. You can specify the port as an argument of ./start.sh
To detach the session but letting leon-web to run, use the shortcut CTRL+a,d.
To reattach, enter the following command.

tmux att -dt leon

How to change the temporary directory

For that, open the file start.sh, and change the line:

 activator "start $PORT"

to

 activator -Djava.io.tmpdir=YOUR_TEMPORARY_DIRECTORY "start $PORT"

It will be used to create github repositories, etc.

How to update an existing running leon-web session

Easiest way This will make leon unavailable for a few minutes. If using tmux, make sure you are in the session that started leon-web.

  • CTRL+d to stop the server
  • git pull origin master
  • git submodule update --recursive
  • ./start.sh

Nicer way. This is a way to recompile in the background.

On another terminal not running leon-web:

  • git pull origin master
  • git submodule update --recursive
  • activator stage to recompile

On the terminal running leon-web

  • CTRL+C to exit the current running application. If it starts to recompile, no need to do the next step.
  • ./start.sh

Useful tmux commands

  • CTRL+a,d to detach
  • CTRL+a,c Create another session
  • CTRL+a,n Switch from one session to the other.
  • CTRL+a,- New splitted terminal
  • CTRL+a,o Switch from one splitted terminal to the other in the same window.
  • CTRL+a and PAGUP, PAGEDOWN to view the history. q to exit this mode.
  • Enter exit and press <enter> to exit this new terminal

In the shell

  • tmux ls to list sessions

[EPFL only] How to deploy to leon.epfl.ch

Note that Leon-web listens to the port 9900 (see script start.sh), whereas Leon-web-dev listens to 9876, the only two ports opened to the external world. After providing your public key to the server, log in using the following command:

ssh leonweb@laraserver2.epfl.ch

Now make sure you are inside

  1. ~/git/leon-web if you want to update leon.epfl.ch
  2. ~/git/leon-web-dev if you want to update leon.epfl.ch:9876

Note the following:

  1. leon-web contains two windows:
  2. The first window checks the logs for errors
  3. The second one runs the script start.sh
  4. leon-web-dev is configured to automatically update every time there is a push to master.
    It is separated into three windows.
  5. The first window is running the script start.sh
  6. The second window is running the script updater_bot.sh, which checks modifications from github every 10 seconds, and if modified, performs update steps and restart the first window.
    Make sure you always have these two windows in this order at the beginning if you use the script updater_bot.sh.
  7. The third window is an empty command line.