|
| 1 | +Statusengine Interface is able to read the configuration from a config file or environment variable. |
| 2 | +If both is present the values from the configuration file gets used as preferred values. |
| 3 | + |
| 4 | +| Priority | Source | Comment | |
| 5 | +|----------|----------------------|----------------------------------------------------------------| |
| 6 | +| 0 | default value | Hardcoded value | |
| 7 | +| 1 | environment variable | If present it will overwrite the default | |
| 8 | +| 2 | configuration file | If present it will overwrite the environment variable | |
| 9 | + |
| 10 | + |
| 11 | +To keep it simple it is recommended to define everything in the configuration file **or** the environment variables. |
| 12 | +Even if its possible, I don't recommend to use a mix of both. |
| 13 | + |
| 14 | +## List of available environment variables |
| 15 | +| Environment variable | Type | Required | Example / Comments | |
| 16 | +|-----------------------------------------------|--------|----------|-----------------------------------------------------------------------------------------| |
| 17 | +| SEI_USE_CRATE | bool | yes | You must set `SEI_USE_CRATE` or `SEI_USE_MYSQL` | |
| 18 | +| SEI_USE_MYSQL | bool | yes | | |
| 19 | +| SEI_MYSQL_HOST | string | depends | Required if `SEI_USE_MYSQL` is enabled | |
| 20 | +| SEI_MYSQL_PORT | int | depends | Required if `SEI_USE_MYSQL` is enabled | |
| 21 | +| SEI_MYSQL_USER | string | depends | Required if `SEI_USE_MYSQL` is enabled | |
| 22 | +| SEI_MYSQL_PASSWORD | string | depends | Required if `SEI_USE_MYSQL` is enabled | |
| 23 | +| SEI_MYSQL_DATABASE | string | depends | Required if `SEI_USE_MYSQL` is enabled | |
| 24 | +| SEI_CRATE_NODES | array | depends | `export SEI_CRATE_NODES="127.0.0.1:4200,192.168.1.1:4200,192.168.10.1:4200"` | |
| 25 | +| SEI_ALLOW_ANONYMOUS | bool | no | | |
| 26 | +| SEI_ANONYMOUS_CAN_SUBMIT_COMMANDS | bool | no | | |
| 27 | +| SEI_URLS_WITHOUT_LOGIN | array | no | | |
| 28 | +| SEI_AUTH_TYPE | string | no | | |
| 29 | +| SEI_LDAP_SERVER | string | depend |Required if `SEI_AUTH_TYPE` is `ldap` | |
| 30 | +| SEI_LDAP_PORT | int | no |Required if `SEI_AUTH_TYPE` is `ldap` | |
| 31 | +| SEI_LDAP_USE_SSL | bool | no |Required if `SEI_AUTH_TYPE` is `ldap` | |
| 32 | +| SEI_LDAP_BIND_DN | string | no |Required if `SEI_AUTH_TYPE` is `ldap` | |
| 33 | +| SEI_LDAP_BIND_PASSWORD | string | depend |Required if `SEI_AUTH_TYPE` is `ldap` | |
| 34 | +| SEI_LDAP_BASE_DN | string | depend |Required if `SEI_AUTH_TYPE` is `ldap` | |
| 35 | +| SEI_LDAP_FILTER | string | no |Required if `SEI_AUTH_TYPE` is `ldap` | |
| 36 | +| SEI_LDAP_ATTRIBUTE | string | no |Required if `SEI_AUTH_TYPE` is `ldap` | |
| 37 | +| SEI_DISPLAY_PERFDATA | bool | no | | |
| 38 | +| SEI_PERFDATA_BACKEND | string | no | On of `crate`, `graphite`, `mysql` or `elasticsearch` | |
| 39 | +| SEI_GRAPHITE_URL | string | depend |Required if `SEI_DISPLAY_PERFDATA` is `1` and `SEI_PERFDATA_BACKEND` is `graphite` | |
| 40 | +| SEI_GRAPHITE_ILLEGAL_CHARACTERS | string | no | | |
| 41 | +| SEI_GRAPHITE_PREFIX | string | no | | |
| 42 | +| SEI_GRAPHITE_USE_BASIC_AUTH | bool | no | | |
| 43 | +| SEI_GRAPHITE_USER | string | depend |Required if `SEI_GRAPHITE_USE_BASIC_AUTH` is `1` | |
| 44 | +| SEI_GRAPHITE_PASSWORD | string | depend |Required if `SEI_GRAPHITE_USE_BASIC_AUTH` is `1` | |
| 45 | +| SEI_GRAPHITE_ALLOW_SELF_SIGNED_CERTIFICATES | bool | no | | |
| 46 | +| SEI_ELASTICSEARCH_INDEX | string | depend |Required if `SEI_DISPLAY_PERFDATA` is `1` and `SEI_PERFDATA_BACKEND` is `elasticsearch` | |
| 47 | +| SEI_ELASTICSEARCH_ADDRESS | string | depend |Required if `SEI_DISPLAY_PERFDATA` is `1` and `SEI_PERFDATA_BACKEND` is `elasticsearch` | |
| 48 | +| SEI_ELASTICSEARCH_PORT | int | no | | |
| 49 | +| SEI_ELASTICSEARCH_PATTERN | string | depend | | |
| 50 | + |
| 51 | + |
| 52 | +## Default values |
| 53 | +All variables have a predefined default value. |
| 54 | +Search in the file [src/Config.php](/src/Config.php) for a variable name to get the default value. |
| 55 | + |
| 56 | +## Documentation for each variable |
| 57 | +More information about each variable can be found in |
| 58 | +[etc/config.yml.example](/etc/config.yml.example). |
| 59 | +Search for a variable without the `SEI_` prefix. |
| 60 | + |
| 61 | +## Data types |
| 62 | +| Data Type | How to pass | Example | |
| 63 | +|-----------|--------------------------------------------------|------------------------------------------------------------------------------| |
| 64 | +| string | `VAR="value"` | `export SEI_MYSQL_HOST="127.0.0.1"` | |
| 65 | +| int | `VAR=value` | `export SEI_MYSQL_PORT=3306` | |
| 66 | +| bool | `VAR=1` or out of `[1, true, on, 0, false, off]` | `export SEI_USE_MYSQL=1` | |
| 67 | +| array | `VAR=value1,value2` | `export SEI_CRATE_NODES="127.0.0.1:4200,192.168.1.1:4200,192.168.10.1:4200"` | |
| 68 | + |
| 69 | + |
| 70 | +## Example |
| 71 | + |
| 72 | +This examples work without any config.yml file. |
| 73 | + |
| 74 | +#### Apache |
| 75 | +````apacheconfig |
| 76 | +
|
| 77 | +<VirtualHost *:443> |
| 78 | +
|
| 79 | + DocumentRoot "/usr/share/statusengine-ui/public/" |
| 80 | +
|
| 81 | + SetEnv SEI_USE_MYSQL 1 |
| 82 | + SetEnv SEI_MYSQL_HOST localhost |
| 83 | + SetEnv SEI_MYSQL_USER statusengine |
| 84 | + SetEnv SEI_MYSQL_PASSWORD password |
| 85 | + SetEnv SEI_MYSQL_DATABASE statusengine_data |
| 86 | +
|
| 87 | + SetEnv SEI_DISPLAY_PERFDATA 1 |
| 88 | + SetEnv SEI_PERFDATA_BACKEND mysql |
| 89 | +
|
| 90 | + SetEnv SEI_ALLOW_ANONYMOUS 0 |
| 91 | +
|
| 92 | + SSLEngine On |
| 93 | + SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem |
| 94 | + SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key |
| 95 | +
|
| 96 | + ErrorLog "/var/log/apache2/statusengine-ui-error.log" |
| 97 | + CustomLog "/var/log/apache2/statusengine-ui-access.log" combined |
| 98 | +</VirtualHost> |
| 99 | +```` |
| 100 | + |
| 101 | + |
| 102 | +#### Nginx |
| 103 | +```` |
| 104 | +server { |
| 105 | + #Redirect http to https |
| 106 | + listen 80; |
| 107 | +
|
| 108 | + server_tokens off; |
| 109 | + return 301 https://$host$request_uri; |
| 110 | +} |
| 111 | +
|
| 112 | +server { |
| 113 | + listen 443 ssl; |
| 114 | +
|
| 115 | + server_tokens off; |
| 116 | + ssl_certificate /etc/ssl/certs/ssl-cert-snakeoil.pem; |
| 117 | + ssl_certificate_key /etc/ssl/private/ssl-cert-snakeoil.key; |
| 118 | +
|
| 119 | + root /usr/share/statusengine-ui/public/; |
| 120 | + index index.html; |
| 121 | +
|
| 122 | + access_log /var/log/nginx/access.log; |
| 123 | + error_log /var/log/nginx/error.log; |
| 124 | +
|
| 125 | + location ~ \index.php { |
| 126 | + include /etc/nginx/fastcgi_params; |
| 127 | + fastcgi_pass 127.0.0.1:9000; |
| 128 | + fastcgi_index index.php; |
| 129 | + fastcgi_param SCRIPT_FILENAME $document_root/api/index.php; |
| 130 | + fastcgi_param SCRIPT_NAME /api/index.php; |
| 131 | + fastcgi_param PHP_SELF $document_uri; |
| 132 | + |
| 133 | + fastcgi_param SEI_USE_MYSQL 1; |
| 134 | + fastcgi_param SEI_MYSQL_HOST localhost; |
| 135 | + fastcgi_param SEI_MYSQL_USER statusengine; |
| 136 | + fastcgi_param SEI_MYSQL_PASSWORD password; |
| 137 | + fastcgi_param SEI_MYSQL_DATABASE statusengine_data; |
| 138 | + |
| 139 | + fastcgi_param SEI_DISPLAY_PERFDATA 1; |
| 140 | + fastcgi_param SEI_PERFDATA_BACKEND mysql; |
| 141 | + |
| 142 | + fastcgi_param SEI_ALLOW_ANONYMOUS 0; |
| 143 | + } |
| 144 | +
|
| 145 | + location ~ /\.git { |
| 146 | + deny all; |
| 147 | + } |
| 148 | +
|
| 149 | + # Remove css, js, and images from access log |
| 150 | + location ~* \.(?:css|js|svg|gif|png|html|ttf|ico|jpg|jpeg)$ { |
| 151 | + access_log off; |
| 152 | + } |
| 153 | +} |
| 154 | +```` |
| 155 | + |
| 156 | +### Bash |
| 157 | +For Statusengine Interface Console (cli) |
| 158 | + |
| 159 | +```` |
| 160 | +export SEI_USE_MYSQL=1 |
| 161 | +export SEI_MYSQL_HOST="localhost" |
| 162 | +export SEI_MYSQL_USER="statusengine" |
| 163 | +export SEI_MYSQL_PASSWORD="password" |
| 164 | +export SEI_MYSQL_DATABASE="statusengine_data" |
| 165 | +
|
| 166 | +export SEI_DISPLAY_PERFDATA=1 |
| 167 | +export SEI_PERFDATA_BACKEND="mysql" |
| 168 | +
|
| 169 | +export SEI_ALLOW_ANONYMOUS=0 |
| 170 | +
|
| 171 | +/usr/share/statusengine-ui/bin/Console.php users |
| 172 | +
|
| 173 | +```` |
| 174 | + |
| 175 | +### PHP built-in server |
| 176 | + |
| 177 | +*Not supported* => https://bugs.php.net/bug.php?id=67808 |
0 commit comments