The APEL project provides accounting for the Indigo DataCloud project. It is written in Python and uses MySQL.
APEL Cloud Accounting can account for the usage of OpenNebula and OpenStack instances. Accounting "collectors" need to be installed on machines with access to the underlying Cloud infrastructure. The collectors can be found here.
The collectors produce "Usage Records" in the APEL-Cloud v0.2 or v0.4 message formats. Information about these format can be found here.
These records need to be sent as POST requests to the REST endpoint
... is the machine hosting the docker image. A POST request requires an X.509 certificate to authenticate the request. The hostname, which should be the same as the common name (CN) contained in the X.509 certificate, must be listed as a provider here or be given special access via the
ALLOWED_TO_POST enviroment variable for the request to be authorized. For details of how to be added to the CMDB service list, please refer to the CMDB documentation.
Accepted records are summarised twice daily. These summaries can be accessed with a GET request to
.../api/v1/cloud/record/summary. Summaries can be filtered using
key=value pairs. See Supported key=value pairs for a list of valid supported
key=value pairs. A GET request requires an IAM access token be included in the request. This token is then sent to the IAM to authenticate the ID of the service requesting access to the summary. This ID needs to be in
yaml/apel_rest_interface.env for access to be authorized.
It is currently expected that only the QoS/SLA tool will interact with these summaries.
Accept APEL-Cloud v0.2 and v0.4 usage records via POST requests to the REST endpoint
Provide access to summaries via GET requests to REST endpoint
We recommend using the Docker image to run the Accounting server and REST interface. As such, having Docker installed is a prerequisite.
We also recommend using Docker Compose or Anisble to deploy the containers.
See the offical Docker Compose documentation for details of how to install docker-compose.
See the offical Ansible documentation for details of how to install Ansible.
The instructions below are for both Docker Compose and Ansibe.
Download the compressed source code from here, it does not matter where the source code is downloaded to. As the source code contains schemas and yaml files needed for deploying via docker-compose or ansible, you will need to unzip the source code and then
cd into the inflated directory.
Register the service as a protected resource with the Indigo Identity Access Management (IAM) service. See this section for instructions, before proceeding to step 3.
Populate the following variables in
DJANGO_SECRET_KEY: The Django server requires its own "secret". A typical secret keywill be a 50 character long random sequence of alphanumericand special characters. This secret will be used for JSON objectsigning and other cryptographic functions like creating CSRF keys.PROVIDERS_URL: Points to the JSON list of Resource ProvidersIAM_URL: The introspect URL for the IAM repsonsible for token based authN/authZSERVER_IAM_ID: An IAM ID corresponding to this instance, used to validate tokens.SERVER_IAM_SECRET: An IAM secret corresponding to this instance, used to validate tokens.ALLOWED_TO_POST: A (Python) list of X.509 HostDNs allowed to submit POST requests,in addition to those listed by the PROVIDERS_URL.(e.g. ['/C=XX/O=XX/OU=XX/L=XX/CN=special_host.test'])BANNED_FROM_POST: A (Python) list of X.509 HostDNs banned from submitting POST requests,even if they are listed by the PROVIDERS_URL.(e.g. ['/C=XX/O=XX/OU=XX/L=XX/CN=banned_host.test'])ALLOWED_FOR_GET: A (Python) list of IAM service IDs allowed to submit GET requests.(e.g. ['ac2f23e0-8103-4581-8014-e0e82c486e36'])
Populate the following variables in
MYSQL_ROOT_PASSWORD: The APEL server will use this to communicate with the database. If run_container.shis deploying the database (which by default it will be), the database root passwordis set to this.MYSQL_PASSWORD: The APEL server will use this to communicate with the database. If run_container.shis deploying the database (which by default it will be) the APEL user passwordis set to this.
MYSQL_PASSWORD will also need to be added to the password field
Before the REST interface will start, a certificate needs to be added to the container. This can be done by placing a certificate (
apache.crt) and key (
/etc/httpd/ssl/ on the host machine (be careful to preserve correct
.key file permissions).
/etc/httpd/ssl/ will be mounted into the container by docker-compose. Note: You may need to create the
If you are running Docker as a non-root user, you will need to make
docker/etc/cron.d owned by
root. This is because this directory gets mounted into the container and it needs to be owned by
root for cron jobs in the container to run.
sudo chown -R root docker/etc/cron.d
Launch the containers.
With Docker Compose:
It is recommeded to wait 1 minute after launching the database in order for it to configure fully before launching the APEL containers
docker-compose -f yaml/docker-compose.yaml up -d --force-recreate apel_mysql# Wait 1 minutedocker-compose -f yaml/docker-compose.yaml up -d --force-recreate apel_serverdocker-compose -f yaml/docker-compose.yaml up -d --force-recreate apel_rest_interface
<working directory> in
yaml/ansible.yaml with the absolute file path of the decompressed source code, then run the command below.
Navigate a web browser to