RutgersGRID / hubs

Duck-themed multi-user virtual spaces in WebVR. Built with A-Frame.
https://hubs.mozilla.com
Mozilla Public License 2.0
0 stars 0 forks source link

Formal procedure to install Reticulum. #37

Open yalegria opened 2 years ago

Voxelghiest commented 2 years ago

Mozilla Hubs Installation Procedure

1. Reticulum

Reticulum is the core service that coordinates all of the other Hubs modules (PostgREST, Dialog, etc.). To compile the Reticulum source code successfully, we will first install a number of necessary dependencies (sect. 1.1-1.3) before downloading Reticulum itself (sect. 1.4).

1.1. Configure PostgreSQL

PostgreSQL is a database management service used by Hubs. To begin, install PostgreSQL and start it:

$ sudo apt install postgresql
$ sudo systemctl start postgresql.service

In order for the Reticulum server to properly hook into the database locally, you must change some of the configurations for the postgres user. Switch to the postgres user and enter the psql command line:

<yourUsername>@<yourServer>$ sudo -i -u postgres
postgres@<yourServer>$ psql

You will be entered into the psql command line. Run the following psql commands (the semicolons are important). You will see ALTER ROLE display if you did it correctly.

postgres=# ALTER USER postgres WITH PASSWORD 'postgres';
ALTER ROLE
postgres=# ALTER USER postgres WITH SUPERUSER;
ALTER ROLE
postgres=# \q

postgres@<yourServer>$ exit

1.2. Install Erlang and Elixir

Reticulum is dependent on specific versions of Erlang and Elixir. In order to install the correct versions, we will use a software management tool called ASDF, because the usual package management software on Ubuntu (apt-get) lacks access to the versions we need. The following instructions are adapted from the ASDF website and this tutorial.

To get started, install ASDF by downloading the repo from GitHub:

$ git clone https://github.com/asdf-vm/asdf.git ~/.asdf

This will place ASDF into the .asdf directory in your home folder.

Then, to give your shell access to the ASDF commands, add the following lines to the file ~/.bashrc (the periods are important):

. $HOME/.asdf/asdf.sh
. $HOME/.asdf/completions/asdf.bash

Before continuing, log out of your user with the exit command and log back in to refresh your shell.

Once you've logged in again, you can use ASDF to install Erlang and Elixir as plugins. (Be sure to pay careful attention to the specified versions!) Start by installing Erlang:

$ asdf plugin add erlang
$ asdf install erlang 23.3

The installation will take a while, during which Erlang will skip installing certain modules if you do not have the relevant services on your system. If you see warning messages about omitted modules, do not worry; it won't affect this tutorial.

After that finishes, install Elixir similarly:

$ asdf plugin add elixir
$ asdf install elixir 1.12.3-otp-23

The version of Elixir being installed is designed for maximum compatibility with Erlang 23.

Finally, you have to setup Erlang and Elixir for global access. Run the following:

$ asdf global erlang 23.3
$ asdf global elixir 1.12.3-otp-23

1.3. Install Coturn

One last dependency needs to be installed: Coturn. Thankfully, this one is straightforward:

$ sudo apt install coturn

With that, we are finally ready to download the Reticulum source code.

1.4. Setup Reticulum

Before beginning, create a folder in your home directory to work out of. The files for the different Hubs modules will end up here. Inside that folder, clone Reticulum from the Mozilla GitHub:

$ git clone https://github.com/mozilla/reticulum.git
$ cd reticulum

Inside the Reticulum directory you cloned from GitHub earlier, run the following:

$ mix deps.get

This installs a number of Reticulum-specific dependencies. As part of the process, it may prompt you to install one or more packages:

pic3

Respond yes to all of them. This should be the final output:

pic4

Then run the command to compile the Reticulum scripts:

$ mix ecto.create

The compilation process will take a long time, and you may see a number of warning messages about deprecated or incorrect code. You should be fine as long as you see this message at the end:

pic5

Finally, create a storage folder in the Reticulum directory:

$ mkdir -p storage/dev

Now Reticulum should be able to operate on its own! To test it, run iex -S mix phx.server from the Reticulum folder. If everything worked, you'll see output like this (you can exit by hitting Ctrl+C twice in a row):

pic6

With that done, you can proceed to part 2 of this tutorial, setting up Dialog, which can be found in #24.