Alternatively, see [SuperDeimos](https://git.ichec.ie/oilgas/ltfs/superdeimos) for instructions on how to create your own build environment.
It is recommended to run this Docker image by mounting your local branch of the Deimos project with `docker run -it -v /path/to/deimos:/destination [name]:[tag]`
To use the Phobos raid1 layout which is compatible with FIFOs, the following environment variables must be set;
```
export PHOBOS_STORE_layout=raid1
export PHOBOS_LAYOUT_RAID1_repl_count={1,2,3,...}
```
## Build Instructions
To configure and build Deimos, a C++14 compatible compiler is required, and CMake >= 3.0.
```
# Make a directory to hold the temporary build files
mkdir -p build
# Change directory to the build directory
cd build
# Configure the Deimos build using CMake
cmake \
-DCMAKE_PREFIX_PATH=/path/to/proxygen \
[more options below] \
/path/to/deimos/project
# Build the Deimos project
make
```
### Build instructions using the superbuild
When using the Docker image from [SuperDeimos](https://git.ichec.ie/oilgas/ltfs/superdeimos), some specific values make life a bit easier:
* docker image should be run with `/home/superdeimos/external/deimos` as `destination` for the mount option (example: `docker run -it -v ./deimos:/home/superdeimos/external/deimos phobos:debian`).
* the `CMAKE_PREFIX_PATH` need to be set to `/home/superdeimos/build/install`
* An example script to build this project can be found inside the container under `/home/superdeimos/tools/build_deimos.sh`.
### Useful Options
#### Setting Compile/Link Flags
Option | Effect
------ | ------
`-DCMAKE_CXX_COMPILER=...` | Set the C++ compiler.
`-DCMAKE_CXX_FLAGS=...` | Set the flags to pass to the C++ compiler. Overrides the default flags.
#### Enabling/Disabling Sections of Deimos
Option | Effect
------ | ------
`-DDEIMOS_BUILD_TESTS=...` | Set to `ON` to build Deimos tests and enable the `make test` target, or `OFF` to skip (Default `OFF`).
`-DDEIMOS_DISABLE_AUTHORISATION=...` | Set to `ON` to disable AWS V4 authorisation (= letting everything through), or `OFF` to authorise requests (Default `OFF`).
`-DDEIMOS_BUILD_DOCUMENTATION=...` | Set to `ON` to build Deimos Doxygen documentation, or `OFF` to skip (Default `OFF`).
`-DCUSTOM_DOCU_PATH=...` | Set to the path to the `src` folder in [DoxygenXMLParser](https://git.ichec.ie/sophie.wenzel-teuber/doxygen-xml-parser) to create the Markdown output from the Doxygen XML, that can also be found [here](doc/Markdown/deimos) or don't set to skip (Default `not set`).
## Testing
Units test can be run with `make -C build tests`, given `DEIMOS_BUILD_TESTS` was set to `ON` during the build process.
Integration tests can be run from the `test/integration_tests/` directory with `python -m unittest client`.
## Documentation
The Doxygen documentation can be found [here](doc/Markdown/deimos).
## Usage
The `deimos` executable requires exactly one subcommand.
#### Subcommands
Subcommand | Effect
---------- | ------
`start [hostname]` | Start the server daemon, listening to `hostname`.
`stop` | Stop the server daemon.
The `start` subcommand supports a number of optional flags and options.
#### Flags/Options
Flag/Option | Effect
----------- | ------
`--http INT` | Set the port to listen on with HTTP protocol (Default `11000`).
`--http2 INT` | Set the port to listen on with HTTP2 protocol (Default `11002`).
`-t,--threads INT` | Set the number of threads to listen on, <= 0 will use number of available cores (Default `0`).
`-w,--write-config TEXT` | Write the configuration to `TEXT`.
`-l,--logfile` | Set the filename to write logs to (Default `/tmp/deimos_log.txt").
Options can also be given to the `start` subcommand using `--config [config_filename]`. Note that if `hostname` is specified in the configuration file then the `--config` options must be suppied before the `start` subcommand;
```
deimos --config [config_filename] start
```
### Authentication
The server uses the [Amazon S3 Authentication](https://docs.aws.amazon.com/AmazonS3/latest/API/sig-v4-authenticating-requests.html) to ensure the requests that are reaching it are from legitimate users.
Since we do not have a proper database for users yet, they are currently stored along with their keys in [users.txt](test/users.txt). This file is copied into the `/tmp` folder by CMake and then read from there for authentication.
Since the authentication is checked for every request, you need to use one of the users and keys from that file for testing the server!
One possible way most SDKs use automatically is the file `~/.aws/credentials`. The tests for the server are done with a file like this: