Deployment Guide - AxiomBenchmark/Axiom GitHub Wiki
To run Axiom in a production environment, the minimum requirements are:
- Node.js version 8.10+
- 1.5 GB of disk space
- 2 GB of memory
- A PostgreSQL database server
- An open port (port 3000 is the default, override with environment variables)
Download Axiom's source code from GitHub: https://github.com/AxiomBenchmark/Axiom. It is acceptable to pull from the source in a continuous integration environment or simply download the project as a zip file.
Axiom requires a bit of information before it can run. It will certainly need access to a PostgreSQL database and a couple misc settings, and optionally a port. See below for more details.
Many server applications use environment variables to define secrets and local settings, Axiom included. These can usually be defined when setting up a Platform as a Service or in the operating system itself. If this will be a headless instance for a production environment, this is probably the way to go. If additional details are needed, search online for "node define environment variable."
Alternatively, for developers or some other reason, we can also specify their environment variables in a .env file placed at Axiom's root directory, in the format of VARIABLE=VALUE
on each line.
The environment variables for database access are as follows:
PGHOST=<Your Host>
PGPORT=<Postgres Port Number>
PGDATABASE=<Postgress database name>
PGUSER=<postgres username>
PGPASSWORD=<postgres password>
By default, Axiom attempts to run on port 3000. This can be changed by specifying the port enviornment variable in either the environment variables or a .env file:
PORT=<Port Number>
Two other variables are required. USERAGENT_APIKEY
is an API key for a service that helps to interpret User Agent strings to determine the hardware, browser, and OS of the connected client - this API may be removed if used in a controlled test device environment and could be replaces with sole use of the Custom User Agent feature explained in its own guide:
USERAGENT_APIKEY = <API Key>
You can get an API key here: http://useragentapi.com/
The timezone must also be specified so that scheduled reporting jobs can run when they are supposed to. Use this list to determine the time zone: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
TIMEZONE = America/Los_Angeles
Axiom is based on Node.js, which makes the steps between source code download and starting the server extremely easy. For the sake of deployment, three steps need to happen in order for Axiom to start correctly: install, build, and start, in that order:
npm install
npm run build
npm start
We go into detail on each step below, with some options that may make life easier.
Axiom relies on a sizeable set of Node Package Manager (npm) packages to support underlying functionality, including the build process. These packages are defined in the package.json
file and must be installed before Axiom can be built or started. To download the packages automatically from npm, navigate to the root of the project directory and run the following command on the terminal (Mac OS/Linux) or command line (Windows):
npm install
All the required packages will be downloaded and installed into the node_modules folder.
Once the npm packages are installed, we can proceed with the build process. The build process is a series of scripts that compile the test applications in a public folder for clients to download them during test execution.
For deployment, the build process is handled by running npm run build.
Finally, if the install and build steps are completed successfully, Axiom can be started by running npm start
. This will run the app.js file, the main file in the application. The console will log various messages like HTTP requests and some test debug information.
If a clean testapp_bin
folder is desired, either to debug an issue or remove obsolete files, one can run npm run clean
to clean out the folder.
Once a test application is built and being added to Axiom, it may be useful to quickly build and start Axiom. One can run npm run bs
to build then start Axiom - not really a major deal, but may save some time.