The Mixmesh top-level application
Give Erlang/OTP appropriate permissions
Make it possible for Erlang to bind to ports below 1024:
$ sudo setcap 'cap_net_bind_service=+ep' /usr/local/lib/erlang/erts-11.1/bin/beam.smp
(or whetver erts version you are using.)
Build Mixmesh
Install external dependencies
You need to install GMP (for arbitrary precision arithmetic support) and Simple2D (for the simulator). Also libsodium is used.
On Ubuntu:
$ sudo apt install libgmp-dev libsodium-dev
and
$ sudo apt install libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-ttf-dev
followed by
$ git clone https://github.com/simple2d/simple2d
$ cd simple2d
$ make
$ sudo make install
followed by ALSA and Opus:
$ sudo apt install libasound2-dev libopus-dev
To run player tests the program mpop and swaks must be installed
$ sudo apt install mpop swaks
To have the tor tests pass the test suite you need to install tor
$ sudo apt install tor
Clone repositories
Create a directory where you will build mixmesh
$ mkdir path-to-mixmesh
$ cd path-to-mixmesh
Then clone the mixmesh app
$ git clone [email protected]:mixmesh/mixmesh
If you want to clone one by one, or you must fix something else, then this is the app list
$ git clone [email protected]:mixmesh/afunix.git
$ git clone [email protected]:mixmesh/alsa.git
$ git clone [email protected]:mixmesh/apptools.git
$ git clone [email protected]:mixmesh/elgamal.git
$ git clone [email protected]:mixmesh/enacl.git
$ git clone [email protected]:mixmesh/flite.git
$ git clone [email protected]:mixmesh/gaia.git
$ git clone [email protected]:mixmesh/jsone.git
$ git clone [email protected]:mixmesh/mail.git
$ git clone [email protected]:mixmesh/mpa.git
$ git clone [email protected]:mixmesh/mixmesh.git
$ git clone [email protected]:mixmesh/keydir.git
$ git clone [email protected]:mixmesh/pgp.git
$ git clone [email protected]:mixmesh/player.git
$ git clone [email protected]:mixmesh/rester.git
$ git clone [email protected]:mixmesh/tor.git
$ git clone [email protected]:mixmesh/tree_db.git
$ git clone [email protected]:mixmesh/xbus.git
$ git clone [email protected]:mixmesh/rstar.git
$ git clone [email protected]:mixmesh/simulator.git
$ git clone [email protected]:mixmesh/vosk.git
$ git clone [email protected]:mixmesh/inpevt.git
Build repositories
Well, you could then enter mixmesh app and write
$ cd path-to-mixmesh/mixmesh
$ make -f Makefile.top-level
Or you may be want to make it easy and create a link at top level?
$ cd path-to-mixmesh
$ ln -s mixmesh/Makefile.top-level Makefile
From this step you can fetch all the needed applications
$ make clone
And if you (maybe later) want the simulator
$ make simclone
Or everything
$ make megaclone
To build all application and tests you type
$ make
When developing you may want to setup ERL_LIBS so it includes the mixmesh directory
$ export ERL_LIBS=$ERL_LIBS:path-to-mixmesh
Does it work? - run the tests
$ make runtests
Makefile.top-level has a number of other useful targets, e.g. clean, mrproper, megapull and dialyzer.
Prepare Mixmesh
Create a self-signed certificate to be used by the SMTP/POP3 SSL servers:
$ ./bin/mixmesh --self-signed-ssl-cert > cert.pem
and then create a mandatory file structure needed by Mixmesh:
$ ./bin/mkconfig /tmp/mixmesh cert.pem alice
mkconfig in this case created:
- /tmp/mixmesh/keydir/data
- /tmp/mixmesh/alice/player/temp/
- /tmp/mixmesh/alice/player/buffer/
- /tmp/mixmesh/alice/player/keydir/data/
- /tmp/mixmesh/alice/player/maildrop/spooler/
- /tmp/mixmesh/alice/player/ssl/
As it happens this is the file structure used by the configuration files under ./mixmesh/etc/*.conf.
Start Mixmesh
Start Mixmesh with an appropriate configuration file, e.g.
$ ./bin/mixmesh --config ./etc/mixmesh.conf
Start simulator
To start the simulator, use ./etc/simulator.conf, e.g.
"simulator": {
"enabled": true,
"renderer" : "sdl",
"data-set": "square"
}
The data set must be one of "circle", "square", "epfl", "roma" or "it", and the renderer must be one of "sdl" or "epx".
NOTE: In order to start the Roma simulation you must first follow the instructions in ../simulator/priv/roma_taxi/README.md.
Update /etc/systemd/user.conf and /etc/systemd/system.conf so that:
DefaultLimitNOFILE=65535
You must reboot in order for the systemd change to take effect.
Then proceed with:
$ ulimit -n 65535
$ ./bin/mixmesh --self-signed-ssl-cert > cert.pem
$ ./bin/mkconfig /tmp/mixmesh cert.pem alice
$ ../simulator/bin/mkconfig cert.pem square
$ ./bin/mixmesh --simulator --config ./etc/simulator.conf
Files
- ./bin/mkconfigdir
- Create the appropriate file structure needed to start Mixmesh. You call this command with a single root directory as input, e.g.
./bin/mkconfigdir /tmp/mixmesh/alice
. - ./bin/mixmesh
- Start Mixmesh, e.g.
./bin/mixmesh --config etc/mixmesh.conf
, but it can also reload the configuration file and stop Mixmesh - ./bin/simulator
- Start a simulation, e.g.
./bin/simulator --config ./etc/mixmesh.conf
- ./bin/run_test
- Run a test, e.g.
./bin/run_test --config ./etc/mixmesh-do-nothing.conf belgamal
- ./src/mixmesh_app.erl
- The top-level application module
- ./src/mixmesh_sup.erl
- The top-level supervisor module
- ./src/mixmesh_config_serv.erl
- Mixmesh configuration file handling
- ./src/mixmesh_log_serv.erl
- Mixmesh log handling
- ./src/mixmesh.erl
- Exports a single
start/0
which starts all other Mixmesh applications, i.e. themixmesh
command calls this function. We should use reltool to build releases with boot scripts and ez files etc instead.