Configuring API - meridor/perspective-backend GitHub Wiki
All configuration files for API components reside in /etc/perspective. The following sections describe configuration files for each component in detail.
Main configuration file is /etc/perspective/storage/storage.properties. It's contains key-value pairs one by line:
perspective.storage.group.name=perspective
perspective.storage.group.password=perspective
perspective.storage.port=5801
Each storage property starts with perspective.storage prefix. The following table summarizes available configuration properties, their meaning and value examples. We omit perspective.storage prefix in the table for brevity but it's still required. Properties having no default value are required.
Name | Description | Default value | Example Value |
---|---|---|---|
group.name | Free-form storage identifier (like database name). Should be the same among storage replicas. | perspective | my-storage |
group.password | Password to access to storage | perspective | my-password |
port | Port to listen on | 5801 | 5801 |
interface | Interface to listen on | 127.0.0.1 | 192.168.0.1 |
members | Comma separated list of storage cluster hosts | 127.0.0.1:5801 | one.com:5801,two.com:5801 |
backup.count | Number of replicas that should store copy of the data | 1 | 2 |
ipv4only | Whether to listen only on IPv4 interface | true | true |
ttl.projects | Time to live for projects without update. When this time expires not updated projects are removed (evicted) from storage. | 7200 | 3600 |
ttl.instances | Time to live for instances | 300 | 120 |
ttl.images | Time to live for images | 1800 | 600 |
Main configuration file is /etc/perspective/rest/rest.properties. It has the same key-value structure as other components do. Each rest property also starts with perspective prefix.
Name | Description | Default value | Example Value |
---|---|---|---|
storage.group.name | Storage group name. | perspective | my-storage |
storage.group.password | Storage access password | perspective | my-password |
storage.hosts | Comma separated list of storage cluster hosts | 127.0.0.1:5801 | one.com:5801,two.com:5801 |
Worker properties configuration file is /etc/perspective/<cloud_name>/worker.properties, where <cloud_name> is a supported cloud name, e.g. openstack, docker and so on. This file has the same key-value structure as other components do. Each worker property starts with perspective prefix.
Name | Description | Default value | Example Value |
---|---|---|---|
storage.group.name | Storage group name. | perspective | my-storage |
storage.group.password | Storage access password | perspective | my-password |
storage.hosts | Comma separated list of storage cluster hosts | 127.0.0.1:5801 | one.com:5801,two.com:5801 |
messaging.read.consumers | Number of parallel threads to process data retrieval tasks, e.g. synchronizing lists of instances, images, projects and so on | 8 | 10 |
messaging.polling.delay | Message polling duration in milliseconds, mainly influences how fast worker will start to shut down | 1000 | 500 |
messaging.write.consumers | Number of parallel threads to process data modification tasks, e.g. rebooting instances or deleting images | 2 | 1 |
messaging.tolerable.queue.size | Maximum number of messages in the queue that are tolerable for this worker. When this number is reached worker starts to issue warnings about big queue size. | 1000 | 100 |
messaging.shutdown.timeout | Time in milliseconds to wait for consumed tasks to complete | 30000 | 10000 |
scheduler.pool.size | Size of the thread pool of periodic tasks scheduler (e.g. fetching lists of images or instances) | 10 | 5 |
fetch.delay.projects | Pause in milliseconds between subsequent projects data fetches | 30000 | 10000 |
fetch.delay.instances | Pause in milliseconds between subsequent instances data fetches | 5000 | 40000 |
fetch.delay.images | Pause in milliseconds between subsequent images data fetches | 30000 | 10000 |
The second important configuration file is /etc/perspective/<cloud_name>/clouds.xml. This file stores credentials to access cloud API.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<clouds xmlns="urn:config.perspective.meridor.org">
<cloud>
<id>one</id>
<name>first_cloud</name>
<endpoint>https://api.example.com/v2.0</endpoint>
<identity>username</identity>
<credential>password</credential>
<enabled>true</enabled>
</cloud>
<cloud>
<id>two</id>
<name>second_cloud</name>
<endpoint>https://api.test.com/api</endpoint>
<identity>login</identity>
<credential>pwd</credential>
<enabled>true</enabled>
</cloud>
</clouds>
The following table describes each value:
Name | Description |
---|---|
id | Unique cloud identifier |
name | Human-readable cloud name, can be equal to id |
endpoint | Cloud API URL or some other endpoint |
identity | API username or a combination of project name and username |
credential | API password |
enabled | Whether worker should process this cloud (allows to temporary disable clouds) |