Project

General

Profile

Setting Up Erlang » History » Version 7

Version 6 (Richard Neswold, 01/18/2019 09:56 AM) → Version 7/7 (Richard Neswold, 01/18/2019 09:58 AM)

p{margin-left: 4em; margin-right: 4em; background-color: #ee8; border-left: solid 3px gray; padding: 1em}. This page contains some out-of-date information. We are working on fixing it. Feel free to ask the front-end group for help if some of these instructions fail to work. Sorry for the inconvenience. [[camac:Configuring Raspbian]] describes how I configured a RaspberryPi in order to make it an ACSys front-end. Some of that information may be of interest.

We are
now (2019) (2018) using "Erlang version R21.1":http://www.erlang.org/download_release/21. There are several machines which have the latest Erlang runtime (OTP/21.1) installed:

* @ad116920@ (AcSys-in-a-Box)
* @lbmtev@ (Acqiris digitizer system at MI12 running linux)
* All the CLX nodes, @centra@, @centry@
* The Nova experiment's CLX nodes.

If you're working on one of the above computers and are just developing some new feature or driver, you can ignore most of the full deployment instructions here, and just clone from git the one project you are interested in. [[Erlang_running]] gives more instructions on that sort of development.

h2. Installing Erlang for Development

Download the "latest OTP source":http://www.erlang.org/download/otp_src_21.2.tar.gz and "untar" it.

<pre>
$ wget http://www.erlang.org/download/otp_src_21.2.tar.gz
$ tar xzf otp_src_21.2.tar.gz
$ cd otp_src_21.2
</pre>

Before you build the source, you need to configure the installation. Erlang has a fairly large footprint since it not only includes a VM and development toolset, but it has a large set of libraries. You need to decide how the environment is going to be used; if you're the only user, you might install everything in a directory in your home directory. If you're configuring for users on the local machine, you might install it in @/usr/local@, for instance. The typical configuration line looks like this (substitute the actual install directory for *INSTALL_DIR*):

<pre>
$ ./configure --prefix=INSTALL_DIR --enable-hipe --without-javac
</pre>

Then build and install it (depending on where the install directory is, you may have to install it as *@root@*.)

<pre>
$ make
$ make install
</pre>

Next, you'll have to set up environment variables. If this is a single-user installation, just modify your @~/.profile@ (or equivalent, if you use a different shell than *@sh@*.) For a multi-user installation, edit @/etc/profile@. You need to update @PATH@ so the shell can find the Erlang executables. @ERLANG_LIBDIR@ points to where the standard repository resides. @ERL_LIBS@ points to where you want to place the repository that holds Fermi's applications. As an example:

<pre>
export PATH=${PATH}:INSTALL_DIR/bin
export ERLANG_LIBDIR=INSTALL_DIR/lib/erlang
export ERL_LIBS=/usr/local/erlang-repo
</pre>

(replace INSTALL_DIR with the directory you specified in the *@configure@* command.)

h2. Installing locally developed applications

p{margin-left: 4em; margin-right: 4em; background-color: #ee8; border-left: solid 3px gray; padding: 1em}. Content after this point contains some out-of-date information. We are working on fixing it. Feel free to ask the front-end group for help if some of these instructions fail to work. Sorry for the inconvenience. [[camac:Configuring Raspbian]] describes how I configured a RaspberryPi in order to make it an ACSys front-end. Some of that information may be of interest.


To populate the locally developed Erlang applications, first check them all out:

<pre>
$ git clone ssh://p-erl-util@cdcvs.fnal.gov/cvs/projects/erl-util
$ git clone ssh://p-acnetd@cdcvs.fnal.gov/cvs/projects/acnetd-erlang erl-acnet
$ git clone ssh://p-acsys-dpm@cdcvs.fnal.gov/cvs/projects/acsys-dpm-erl-drf2 erl-drf2
$ git clone ssh://p-tclk@cdcvs.fnal.gov/cvs/projects/tclk-erl-client erl-sync
$ git clone ssh://p-dbnews@cdcvs.fnal.gov/cvs/projects/dbnews-erl erl-dbnews
$ git clone ssh://p-acsys-fe@cdcvs.fnal.gov/cvs/projects/acsys-fe erl-daq
</pre>

Drivers for the front-end framework are hosted on Redmine, too. You can see all the repositories here [https://cdcvs.fnal.gov/redmine/projects/acsys-fe/repository].

For each project, build and install in the order given above:

<pre>
$ ( cd PROJECT; make DEBUG=1 install )
</pre>

The ''install'' target in our Erlang environment builds an Erlang run-time application tree in the *@$ERL_LIBS@* directory. On nearly all of our machines, we have setup a @frontend@ user account and *@$ERL_LIBS@* lies under the @frontend@ user's home area.

h2. Packaging the Object Code

So far, what you have done is built all the executable code that you need. It's usable for development like this, but for deployment, you need to package it better. Check out and build the @erl-frontends@ project:

<pre>
$ git clone http://ACCOUNT@chablis.fnal.gov/git/erl-frontends.git
$ cd erl-frontends; make
</pre>

If you already had @erl-frontends@ checked out, run @make clean@ before running *@make@* to build a new package.

This results in the file @acsys_fe.tar.gz@. This file has everything you need for a run-time environment, including the Erlang binaries. If you just want to run your target system, you don't need to separately install Erlang as at the top of this page. Deploy @acsys_fe.tar.gz@ according to the below instructions.

h2. Directories and CLX auto-deployment

On the clx machines and others under our group's control, the run time code will run out of @/usr/local/frontend/sync@. On the clx machines, that directory will be auto-synched (updated) from the contents of @~frontend/clx_sync_master@.

If you want to test a particular new object file (or whatever) on one local machine, you put it into the tree starting at @/usr/local/frontend/sync@. If the file in @/usr/local/frontend/sync@ is newer than that in @~frontend/clx_sync_master@, it will not be automatically overwritten.

If you have new file or files that you want copied to all the Erlang clx frontends, then you put them in @~frontend/clx_sync_master@ and they will periodically be copied to @/usr/local/frontend/sync@ on all the clx Erlang machines.

h2. Installing on a non-clx node.

# Use *@scp@* to copy @acsys_fe.tar.gz@ to your target machine (you probably have to go through outland/outback).
# *@ssh@* to the target machine
# On that machine, @ksu frontend@ to become the frontend user.
# *@cd@* to the runtime installation directory, typically @/usr/local/frontend/sync@.

# Extract from the @.gz@ file with the command @tar xzvf acsys_fe.tar.gz@.
# Copy or create the file @/usr/local/frontend/sync/config/$SYS.config@ (where @$SYS@ is the machine's @hostname -s@ ) from other examples. That's the file that describes which devices to create at startup.
# Make the log file directory for the host if it doesn't exist: @mkdir /usr/local/frontend/sync/log/$SYS@
# Copy (if needed) the *@starterl@* script.
# If you're installing on a different machine than where you built, you have to beware of executables or libraries compiled from C. Even though they are both 32-bit linux, programs compiled on ooda00 will not run on ad116920, so you have to build them on the end-machine and copy them into the required location (e.g. priv dir) over the un-tar-ed files.

h2. Summary for release of something new to Nova Far Detector Acnet:

<pre>
#On a local clx machine
$ cd erl-sync # or whichever project you are wanting to update.
$ git pull
$ make install
$ cd ../erl-frontends
$ make clean
$ make
$ scp acsys_fe.tar.gz novadcs-far-master-01:/home/[yourname] # beware file permissions if copying to ~frontend

$ ssh novadcs-far-master-01 # Go to the Nova machine
$ ksu frontend
$ cd
$ cd /usr/local/frontend/sync/ # single machine Deployment directory
OR
$ cd ~/clx_sync_master # global deployment directory

$ gunzip -c ~[yourname]/acsys_fe.tar.gz | tar xvf -

(if you want to restart immediately, you have to put it in the /usr/local area, otherwise, wait for it to get auto-distributed).

$ cd /usr/local/frontend/sync/ # single machine Deployment/run directory
$ to_erl
(either use ''q()'' or ctrl-c to kill currently running erlang process).
$ rm log/novadcs-far-master-01/* # Optional!! clean up old logs if you really want a clean start:
$ ./starterl.clx
$ more log/novadcs-far-master-01/* # make sure it works.
</pre>