Configuration
The iglu cache configuration is written in TOML. It follows a schema defined at shared/utils/zod/zod_config_schema.ts.
This is what the different paramaters actually do:
Values
[database]
Configuration values referring to the database only
| Key | Values | Description |
|---|---|---|
database_type | sqlite|postgres | Sets the type of the database to use. At the moment it only supports sqlite and postgres but we also plan to support surrealdb at some point before v1.0.0 |
database_file_location | <path> | Required if database_type = sqlite, sets the path of the database file |
user | username | Used for DB Authentication, Required if your database_type is not set to sqlite |
password | password | Used for DB Authentication, Required if your database_type is not set to sqlite |
host | hostname_of_db | Used for DB Authentication, Required if your database_type is not set to sqlite |
port | <number> | Used for DB Authentication, Required if your database_type is not set to sqlite |
database_name | string (default iglu) | Used for DB Authentication, Required if your database_type is not set to sqlite |
[logger]
Configuration values referring to the logger only
| Key | Values | Description |
|---|---|---|
logging_format | pretty|json | Sets the output format of the logger, pretty is probably better for developing while json may be preferred in production environments |
logging_prefix | <string> | Sets a prefix before the cache logging outputs, this may be preferrable to set depending on how many iglu products are running simultaneously |
logging_prefix_color | <string> | Respected only if logging_format = pretty, changes the color of the prefix tag set using logging_prefix |
log_level | debug|info|warn|error | Filters log output depending on what level you set, debug can get pretty chatty after a while so use with caution :) |
[server]
General Server configuration, anything that's not hyper specific can go here
| Key | Values | Description |
|---|---|---|
hostname | <url> | The base url of the cache |
hashing_secret | <a_string> | This is the secret used to hash api keys in the database |
hashing_secret_file | <a_string> | This the path to a file containing the secret used to hash api keys in the database |
interface | <a_string> | This the interface on which the server will listen on |
port | <a_number> | This the port on which teh server will listen on |
enable_rest | <boolean> | Wether to enable the Iglu Rest API |
enable_info | <boolean> | Wether to enable an info overview page for your tenants, you can access this page by going to <your_hostname>/<your_tenant_name> in your browser |
use_reverse_proxy | <boolean> (default false) | Instruct Iglu to use a reverse proxy, very important if you want to use Iglu's access rules as they won't work unless you set this to true AND enter your proxy's IP in the trusted_proxies value |
trusted_proxies | Array<string (ipv4)> (default []) | Enter which reverse proxies Iglu should trust |
[server.observability]
Advanced Settings: This section configures advanced settings in Iglu, that most users won't need to configure. Only configure these values if you know what you're doing!
This section configures various observability related settings. This is usually used in large enterprise deployments.
[server.observability.skywalking]
Caution: Apache skywalking support is experimental and not well tested. If you find any issues with Iglu, please report them to us!
| Key | Values | Description |
|---|---|---|
enabled | <boolean> | Wether to enable apache skywalking observability collector |
service_name | <string> (default iglu-cache) | Override the name of the Service the Iglu Cache registers itself with |
service_instance | <string> (default iglu-cache-1) | Override the name of the Instance the Iglu Cache registers itself with |
collector_address | <string> (default 127.0.0.1:11800) | Override the IP of the Instance that the Iglu Skywalking connector tries to connect to |
authorization | <string | null> (default null) | Add Authentication information (if needed to connect to the Skywalking Instance) |
secure | <boolean> (default false) | Wether or not the Apache Skywalking instance uses SSL |
[storage]
Config values referring to storage and how derivations are stored
| Key | Values | Description |
|---|---|---|
storage_type | fs | s3 | Sets the Storage type: fs for filesystem storage, s3 for S3 storage backends |
binary_storage_directory | <string> | The directory where iglu should store binaries, required if storage_type = fs |
[storage.s3]
Optional S3 config, required if storage_type = s3
| Key | Values | Description |
|---|---|---|
endpoint | <string> | Sets the Endpoint of your S3 storage solution. IMPORTANT: This needs to be accessible by both the cachix client and any nix clients trying to pull from your cache |
access_key_id | <string> | The ID of the access key you want to use |
secret_access_key | <string> | The access key secret you want to use |
bucket | <string> | The bucket you want to use |
region | <string (AWS Region String)> | The Region in which your bucket is located |
forcePathStyle | <boolean> | OPTIONAL, default true. Sets the forcePathStyle option while connecting to S3. If you are unsure what this does, do not set or change this value |
request_checksum_calculation | WHEN_SUPPORTED | WHEN_REQUIRED | OPTIONAL, default WHEN_REQUIRED. Sets the requestChecksumCalculation option while connecting to S3. If you are unsure what this does, do not set or change this value |
request_checksum_validation | WHEN_SUPPORTED | WHEN_REQUIRED | OPTIONAL, default WHEN_REQUIRED. Sets the responseChecksumValidation option while connecting to S3. If you are unsure what this does, do not set or change this value |
[tenants]
Configures the tenants which exist on the server. They are declarative, meaning any change you make in the config, applies them on the next reboot of the Cache in the database as well. You may configure inifite tenants, as long as they have distinct names.
[tenants.<name>]
The name of the tenant in the database and your cachix client is the key of the tenant in the configuration, i.e tenants.default would create a tenant named 'default'
| Key | Values | Description |
|---|---|---|
github_username | <string> | The github username of the owner of this tenant, may be empty an empty string but the key must exist and is here for cachix compatibility reasons |
is_public | <boolean> | Wether or not this cache is supposed to be publicly available or not (if this is set to false, a deny rule is added for all IPs and you must configure each allowed IP manually, if set to true the exact opposite happens and any IP has access until you disallow them) |
preferred_compression_method | xz | zstd | The preferred compression method of this tenant. Cachix client may still upload files that are compressed differntly, however a normal cachix client will follow this key |
priority | <number> | The priority of this tenant. Lower means the cache will get hit first for requets. For reference: cache.nixos.org has a priority of 40 |
ttl | A string in the format of 1s,1m, 1d, etc. | Sets how long a cached derivation will remain valid for (if not requested). We recommend a value of around 1 - 2w (weeks), depending on how frequently your cache is hit or how much storage space you have |
signing_method | client|server | Sets which signing method you want. We recommend the server signing method as this will result in you having to trust only one public key. The client signing method means that each configured API Key must upload a cachix public key before pushing and every client that pulls from the cache needs to trust each public key |
If signing_method is set to server then you must also define a keypair at keypairs
[api_keys]
Api Key definition has the same rules as tenants
[api_keys.<name>]
If iglu detects a changed key (from the in_file or plaintext_key options) at startup, it will enter that key into the database, meaning you can update a key afterwards.
A key that is marked as generated = true will not be updated on cache reboot and failing to provide in_file for an already generated key will not touch the values defined in the database.
In an API Key definition you must provide one of the three api key "generation" methods:
generated(Iglu generates a key and writes it to the file atout_filein TOML format)in_file(Iglu reads the key from this file)plaintext_key(Iglu uses this plaintext key)
| Key | Values | Description |
|---|---|---|
tenant | <string>(References a tenant defined at tenants) | The tenant this api key should have access to. At the moment an API Key can only ever be declartively connected to one other Tenant |
generated | <string> (default null) | Wether or not this API Key should be generated by Iglu. If you set this to true you'll also have to set the out_file option |
out_file | <string> (default .share/iglu/keyoutput.toml) | The location of a file (if it doesn't exist iglu creates it) that Iglu will write generated plaintext keys to |
in_file | <string> (default null) | The location of a file that iglu should read a plaintext key from. In this scenario, no key will be written to the key configured in out_file and the whole input file will be used as the API Key |
plaintext_key | <string> (default null) | A plaintext key that Iglu should use for this API Key. We heavily discourage using this option. |
[public_keys]
Public Key definition has the same rules as tenants.
You do not need to define a public key for an API Key, uploading one via cachix generate-keypair <tenant_name> still works for configuration-managed API Keys
[public_keys.<name>]
| Key | Values | Description |
|---|---|---|
name | <string> | Name of the public key |
key | <string>(base64) | The value of the public key |
linked_api_key | <string>(References an api key defined at api_keys) | The linked API Key of this public key |
[deployment_keys]
Deployment Key definition has the same rules as tenants.
For more information on how cachix deploy works read the official cachix documentation at: https://docs.cachix.org/deploy/
You must provide one of the three generation methods (i.e setting one of these keys):
generated(Iglu generates a key and writes it to the file atout_filein TOML format)in_file(Iglu reads the key from this file)plaintext_key(Iglu uses this plaintext key)
| Key | Values | Description |
|---|---|---|
name | <string> | Name of the deployment key |
type | agent|activate | The type of Key you're configuring. For more information on which type you need, read up in the official docs |
expires_at | <iso_datetime_string> | The date and time at which this key is expiring |
tenant | <string> (References a tenant defined at tenants) | Defines which Tenant should be accessible by this Key |
in_file | <string> (default null) | Instructs Iglu to read the secret for this key from the given file. Works the same as for api_keys |
generated | <boolean>(default null) | Instructs Iglu to generate the key by itself. The Key will then be written to the file defined at out_file. Works the same as for api_keys |
plaintext_key | <string> (default null) | Instructs Iglu to use the provided key as the secret. Works the same as for api_keys |
out_file | <string> (default .share/iglu/keyoutput.toml) | A path to a file (if it doesn't exist it will be created by Iglu) to write the generated secret to. Works the same as for api_keys |
[keypairs]
Keypair definition has the same rules as tenants.
Any tenant that has set the signing_method = "server" must also have one keypair associated with them.
[keypairs.<name>]
| Key | Values | Description |
|---|---|---|
tenant | <string> (References a tenant defined at tenants) |
[config]
Advanced Settings: This section configures advanced settings in Iglu, that most users won't need to configure. Only configure these values if you know what you're doing!
This section refers to how Iglu reads the config and how it handles it.
[config.reconcile]
Settings which refer to the declarative reconciliation, meaning how iglu handles changes in the definitions above. You can also turn of reconsiliation entirely.
| Key | Values | Description |
|---|---|---|
mode | off|authorative|additive (default: authorative) | Which reconsiliation mode you want. Off means that no reconsiliation will happen, authorative means the "normal" mode where everything is reflected exactly in the database as in the configuration and additive means that nothing will ever be deleted by the reconsiliation script, only ever added or modified |
Example config
[database]
database_type = 'sqlite'
database_file_location = './out.db'
[logger]
logging_format = 'pretty'
logging_prefix = 'cache'
logging_prefix_color = 'magenta'
log_level = 'debug'
[server]
hostname = 'http://127.0.0.1:3000' #Set this to your hostname
hashing_secret = 'set this to something secure gawd damn' #This is the salt we are using to salt hashes in the DB, set this to something secure on your **initial** startup, changing this later will automatically make any API key unusuable
[server.encryption]
secret_file = "secret.key"
[storage]
storage_type = 'fs' #Only option for now, in the future we plan to also allow S3 compatible storage systems
binary_storage_directory = '/tmp/iglu' #This may be an existing or not existing path
[tenants]
[tenants.default]
github_username = 'iglu-sh' #Set to your Github Username, as far as we can tell this field is largely unused
is_public = true #True adds an allow rule with CIDR 0.0.0.0/0 and priority 100 to your cache, setting to false does the opposite. You can change this later.
preferred_compression_method = 'xz' #May either be xz or zstd
priority = 1 #Sets the priority of this nix cache, this affects which cache gets asked first for a cache hit during nix build processes
ttl = '5w'
signing_method = 'server'
[api_keys]
[api_keys.iglu]
generated = true
out_file = "iglu_out_directory/key.toml"
tenant = "default"
[public_keys]
[public_keys.iglu]
name = 'Iglu Default Key'
key = 'Z6AmDHNNlfVqV3IUDmhAKQL5wF7cADPROuLYUam+5Nk='
linked_api_key = 'iglu'
[keypairs]
[keypairs.iglu]
tenant = "default"