|
11 years ago | |
---|---|---|
.. | ||
frameworks | 11 years ago | |
languages | 11 years ago | |
systools | 11 years ago | |
webservers | 11 years ago | |
README.md | 11 years ago | |
__init__.py | 12 years ago | |
bash_functions.sh | 11 years ago | |
installer.py | 11 years ago | |
prerequisites.sh | 11 years ago | |
setup_util.py | 11 years ago | |
unbuffered.py | 12 years ago |
The installer.py
file calls into the shell to perform all
installation steps. It installs three different sets of software, the
server software we want to test, the database that we want to use with
the server software, and the client software that we want to use to
generate load for the server. This file gives an overview of how this
installation process works
To trigger a server installation, run toolset/run-tests.py --install server
(or --install all
). Note: Software is installed onto the current machine,
you should run the server installation on the machine you plan to run
servers on during benchmarking. This requires password-less sudo access
for the current user on the current system.
The software needed depends upon what tests are going to be performed--clearly
if you only wish to test the go
framework, there is no need to install
php
. To avoid installing all server software all the time, you can use
the --test
and --exclude
flags in conjunction with --install server
.
Here are some examples:
$ # Always run from the root directory of the project
$ cd ~/FrameworkBenchmarks
$ # Install server software to run go
$ toolset/run-tests.py --install server --test go
$ # Install server software for go, install client and database software too
$ toolset/run-tests.py --install all --test go
$ # Install server software for all tests
$ toolset/run-tests.py --install server
$ # Install all software for all tests
$ toolset/run-tests.py --install all
Some prerequisite software is needed regardless of what test is being
installed. This includes core tools such as build-essential
, curl
, etc.
To install just the prerequisites, set the --test
flag to empty, as so:
$ # Install just prerequisite server software
$ toolset/run-tests.py --install server --test ''
When possible, TFB installs all software into isolated folders underneath
the installs/
directory. This helps to prevent different frameworks from
interfering with each other. There are two strategies used to
determine which folder software will be installed into, pertest
or
unified
. With --install-strategy unified
, all software will be
installed into folders underneath installs/
. If multiple frameworks depend
on the same software, it will not be installed twice. This can have large
benefits for download and compile time, e.g. downloading and compiling
php
twice is substantially more work than once. However, it also means that
frameworks are not guaranteed complete isolation - if a framework somehow
modifies it's installation, then other frameworks using that same dependency
will be affected.
--install-strategy unified
results in a directory structure like this:
installs
├── go
├── nodejs
├── php
└── py2
With --install-strategy pertest
, each framework has an isolated installation
directory and is guaranteed to have it's own copy of installation. This takes
substantially more time for some tests, as large dependencies must be downloaded,
decompressed, and compiled multiple times.
--install-strategy pertest
results in a directory structure like this:
installs
└── pertest
├── aspnet
│ └── mono
├── aspnet-stripped
│ └── mono
├── dart
│ ├── go
│ ├── nodejs
│ ├── php
│ └── py2
└── go
├── go
├── nodejs
├── php
└── py2
Note that both installation strategies use the installs/
directory, so
you can always delete this directory to remove all software that was able
to be installed into folders. There is no simple uninstallation strategy for
software that is installed into standard system folders.
The function Installer#__install_server_software
is called to install
server software. Here are the steps it follows:
--test
and --exclude
flags to decide which frameworks need installation. For each test, do the following:bash_profile.sh
file, load the environment from itIROOT
TROOT
toolset/setup/linux/bash_functions.sh
install.sh
for this test. This normally uses functions
defined in bash_functions.sh
, such as fw_depends
Each framework directory has two files to customize how the installation is
run, install.sh
and bash_profile.sh
. To go over each:
The install.sh
file for each framework starts the bash process which will
install that framework. Typically, the first thing done is to call fw_depends
to run installations for any necessary software that TFB has already
created installation scripts for. TFB provides a reasonably wide range of
core software, so your install.sh
may only need to call fw_depends
and
exit. Note: fw_depends
does not guarantee dependency installation, so
list software in the proper order e.g. if foo
depends on bar
use fw_depends bar foo
Here are some example install.sh
files
#!/bin/bash
# My server only needs nodejs
fw_depends nodejs
#!/bin/bash
# My server is weird and needs nodejs and mono and go
fw_depends nodejs mono go
#!/bin/bash
# My server needs nodejs...
fw_depends nodejs mono go
# ...and some other software that there is no installer script for.
# Note: Use IROOT variable to put software in the right folder
# Please see guidelines on writing installation scripts
wget mystuff.tar.gz -O mystuff.tar.gz
untar mystuff.tar.gz
cd mystuff
make --prefix=$IROOT && sudo make install
The bash_profile.sh
file is sourced before installing software or before
running the framework test. This is mostly used when running your
framework, to perform actions such as updating PATH
or defining environment
variables your framework requires e.g. GOROOT
. It is unlikely you need to
reference these variables in your install.sh
, but they are
available. Only put variables in bash_profile.sh
if they are needed
for running your software. If you only need variables for installation, just
define them in install.sh
Example of bash_profile.sh
. All of these variables will be available for
use inside install.sh
, if they are needed.
# Set the root of our go installation
export GOROOT=${IROOT}/go
# Where to find the go executable
export PATH="$GOROOT/bin:$PATH"
export GOPATH=${FWROOT}/go
To see what TFB provides installations for, look in toolset/setup/linux
in the folders frameworks
, languages
, systools
, and webservers
.
You should pass the filename, without the ".sh" extension, to fw_depends.
Here is a listing as of July 2014:
$ ls frameworks
grails.sh nawak.sh play1.sh siena.sh vertx.sh yesod.sh
jester.sh onion.sh play2.sh treefrog.sh wt.sh
$ ls languages
composer.sh erlang.sh hhvm.sh mono.sh perl.sh pypy.sh racket.sh urweb.sh
dart.sh go.sh java.sh nimrod.sh phalcon.sh python2.sh ringojs.sh xsp.sh
elixir.sh haskell.sh jruby.sh nodejs.sh php.sh python3.sh ruby.sh yaf.sh
$ ls systools
leiningen.sh maven.sh
$ ls webservers
lapis.sh mongrel2.sh nginx.sh openresty.sh resin.sh weber.sh zeromq.sh
Whether you are writing new dependency files (e.g. a new language installation
script) or just appending custom code to your framework's install.sh
, here
are some guidelines for proper use.
bash_functions.sh
fw_exists
to avoid re-running
installations. Note: If you are in the process of writing a new installation,
you may wish to delete the file checked by fw_exists
to force an installation
to runfw_exists
on objects that exist if the entire installation completed, such as binaries.
If you use fw_exists
on a downloaded file, there is no guarantee that
installation completed. If you use fw_exists
on an installation directory,
there is no guarantee that compilation completed. Note: Another approach is
to run your entire compilation, and then move your completed installation to
a new directory and fw_exists
on this new directory.wget -O
and similar curl options
to avoid having "file.1","file.2", etc when you expect to always have "file"return 1
statements
except to indicate installation failure, no mv foo bar
if you're not
100% sure that foo exists and can be moved to bar, etc. Note that the bash
or operator (||) can be used to avoid errtrace from inspecting a command,
so you can use something like mv foo bar || true
to avoid having errtrace
inspect the exit code of the mv
command.$IROOT
variable available, use this to determine what folder your software should
be installed into e.g. ME=$IROOT/my-software
bash_functions.sh
has an ERR
trap inside it. It's fairly useful, but if you would like more information
you can uncomment some additional lines in the ERR trap to cause it to print
an entire bash stack trace e.g. what command in what function in what file on
what line caused my non-zero status. This is useful, but beware that dragons
are involved in reading bash stack traces...toolset/setup/linux
, so please examine themOnly one guideline really...don't output any information to stdout! This file
should only be used for declaring environment variables e.g. export FOO=bar
.
Anything you print to stdout or stderr we will ignore (or try to!), and
you won't see this output in your console.
The Installer#__install_database
function uses SFTP to copy a number of
files to the remote database system, and then uses SSH to log in and
execute the installation.
This requires password-less sudo access for the --database-user
on the
remote system --database-host
.
The Installer#__install_client_software
function uses SFTP to copy a number of
files to the remote system, and then uses SSH to log in and
execute the installation.
This requires password-less sudo access for the --client-user
on the
remote system --client-host
.