Skip to content

Commit 78e4255

Browse files
authored
Merge pull request #18 from linuxserver/redis-db
Support custom redis DB IDs
2 parents 2790a45 + 55c795e commit 78e4255

File tree

3 files changed

+19
-11
lines changed

3 files changed

+19
-11
lines changed

readme-vars.yml

+15-9
Original file line numberDiff line numberDiff line change
@@ -21,25 +21,30 @@ param_volumes:
2121
- { vol_path: "/config", vol_host_path: "<path to data on host>", desc: "config directory volume mapping" }
2222
param_usage_include_env: true
2323
param_env_vars:
24+
- { env_var: "TZ", env_value: "<TZ>", desc: "Timezone (i.e., America/New_York)" }
2425
- { env_var: "SUPERUSER_EMAIL", env_value: "<SUPERUSER_EMAIL>", desc: "Email address for `admin` account" }
2526
- { env_var: "SUPERUSER_PASSWORD", env_value: "<SUPERUSER_PASSWORD>", desc: "Password for `admin` account" }
2627
- { env_var: "ALLOWED_HOST", env_value: "<ALLOWED_HOST>", desc: "The hostname you will use to access the app (i.e., netbox.example.com)" }
27-
- { env_var: "BASE_PATH", env_value: "<BASE_PATH>", desc: "The path you will use to access the app (i.e., /netbox, optional, default: none)" }
28-
- { env_var: "DB_NAME", env_value: "<DB_NAME>", desc: "Database name (optional, default: netbox)" }
28+
- { env_var: "DB_NAME", env_value: "<DB_NAME>", desc: "Database name (default: netbox)" }
2929
- { env_var: "DB_USER", env_value: "<DB_USER>", desc: "Database user" }
3030
- { env_var: "DB_PASSWORD", env_value: "<DB_PASSWORD>", desc: "Database password" }
31-
- { env_var: "DB_HOST", env_value: "<DB_HOST>", desc: "Database host (optional, default: postgres)" }
32-
- { env_var: "DB_PORT", env_value: "<DB_PORT>", desc: "Database port (optional)" }
33-
- { env_var: "REDIS_HOST", env_value: "<REDIS_HOST>", desc: "Redis host (optional, default: redis)" }
34-
- { env_var: "REDIS_PORT", env_value: "<REDIS_PORT>", desc: "Redis port number (optional, default: 6379)" }
35-
- { env_var: "REDIS_PASSWORD", env_value: "<REDIS_PASSWORD>", desc: "Redis password (optional, default: none)" }
31+
- { env_var: "DB_HOST", env_value: "<DB_HOST>", desc: "Database host (default: postgres)" }
32+
- { env_var: "DB_PORT", env_value: "<DB_PORT>", desc: "Database port (defaul: 5432)" }
33+
- { env_var: "REDIS_HOST", env_value: "<REDIS_HOST>", desc: "Redis host (default: redis)" }
34+
- { env_var: "REDIS_PORT", env_value: "<REDIS_PORT>", desc: "Redis port number (default: 6379)" }
35+
- { env_var: "REDIS_PASSWORD", env_value: "<REDIS_PASSWORD>", desc: "Redis password (default: none)" }
36+
- { env_var: "REDIS_DB_TASK", env_value: "<REDIS_DB_TASK>", desc: "Redis database ID for tasks (default: 0)" }
37+
- { env_var: "REDIS_DB_CACHE", env_value: "<REDIS_DB_CACHE>", desc: "Redis database ID for caching (default: 1)" }
38+
39+
opt_param_usage_include_env: true
40+
opt_param_env_vars:
41+
- { env_var: "BASE_PATH", env_value: "<BASE_PATH>", desc: "The path you will use to access the app (i.e., /netbox, optional, default: none)" }
3642
- { env_var: "REMOTE_AUTH_ENABLED", env_value: "<REMOTE_AUTH_ENABLED>", desc: "Enable remote authentication (optional, default: False)" }
3743
- { env_var: "REMOTE_AUTH_BACKEND", env_value: "<REMOTE_AUTH_BACKEND>", desc: "Python path to the custom Django authentication backend to use for external user authentication (optional, default: netbox.authentication.RemoteUserBackend)" }
3844
- { env_var: "REMOTE_AUTH_HEADER", env_value: "<REMOTE_AUTH_HEADER>", desc: "Name of the HTTP header which informs NetBox of the currently authenticated user. (optional, default: HTTP_REMOTE_USER)" }
3945
- { env_var: "REMOTE_AUTH_AUTO_CREATE_USER", env_value: "<REMOTE_AUTH_AUTO_CREATE_USER>", desc: "If true, NetBox will automatically create local accounts for users authenticated via a remote service (optional, default: False)" }
4046
- { env_var: "REMOTE_AUTH_DEFAULT_GROUPS", env_value: "<REMOTE_AUTH_DEFAULT_GROUPS>", desc: "The list of groups to assign a new user account when created using remote authentication (optional, default: [])" }
4147
- { env_var: "REMOTE_AUTH_DEFAULT_PERMISSIONS", env_value: "<REMOTE_AUTH_DEFAULT_PERMISSIONS>", desc: "A mapping of permissions to assign a new user account when created using remote authentication (optional, default: {})" }
42-
- { env_var: "TZ", env_value: "<TZ>", desc: "Timezone (i.e., America/New_York)" }
4348

4449
param_usage_include_ports: true
4550
param_ports:
@@ -48,12 +53,13 @@ param_ports:
4853
# application setup block
4954
app_setup_block_enabled: true
5055
app_setup_block: |
51-
Netbox requires a postgres database.
56+
Netbox requires a postgres database and a redis instance.
5257
5358
Access the WebUI at <your-ip>:8000. For more information, check out [NetBox](https://github.com/netbox-community/netbox).
5459
5560
# changelog
5661
changelogs:
62+
- { date: "26.04.21:", desc: "Added Redis database environment variables." }
5763
- { date: "03.02.21:", desc: "Added remote authentication environment variables." }
5864
- { date: "02.01.21:", desc: "Added BASE_PATH environment variable." }
5965
- { date: "23.08.20:", desc: "Initial Release." }

root/defaults/configuration.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
# 'SENTINELS': [('mysentinel.redis.example.com', 6379)],
3333
# 'SENTINEL_SERVICE': 'netbox',
3434
'PASSWORD': '{{REDIS_PASSWORD}}',
35-
'DATABASE': 0,
35+
'DATABASE': {{REDIS_DB_TASK}},
3636
'DEFAULT_TIMEOUT': 300,
3737
'SSL': False,
3838
},
@@ -43,7 +43,7 @@
4343
# 'SENTINELS': [('mysentinel.redis.example.com', 6379)],
4444
# 'SENTINEL_SERVICE': 'netbox',
4545
'PASSWORD': '{{REDIS_PASSWORD}}',
46-
'DATABASE': 1,
46+
'DATABASE': {{REDIS_DB_CACHE}},
4747
'DEFAULT_TIMEOUT': 300,
4848
'SSL': False,
4949
}

root/etc/cont-init.d/50-config

+2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ NETBOX_CONF[DB_PORT]=${DB_PORT:-}
1313
NETBOX_CONF[REDIS_HOST]=${REDIS_HOST:-redis}
1414
NETBOX_CONF[REDIS_PORT]=${REDIS_PORT:-6379}
1515
NETBOX_CONF[REDIS_PASSWORD]=${REDIS_PASSWORD:-}
16+
NETBOX_CONF[REDIS_DB_TASK]=${REDIS_DB_TASK:-0}
17+
NETBOX_CONF[REDIS_DB_CACHE]=${REDIS_DB_CACHE:-1}
1618
NETBOX_CONF[REMOTE_AUTH_ENABLED]=${REMOTE_AUTH_ENABLED:-False}
1719
NETBOX_CONF[REMOTE_AUTH_BACKEND]=${REMOTE_AUTH_BACKEND:-netbox.authentication.RemoteUserBackend}
1820
NETBOX_CONF[REMOTE_AUTH_HEADER]=${REMOTE_AUTH_HEADER:-HTTP_REMOTE_USER}

0 commit comments

Comments
 (0)