Advanced configuration
Production usage
It is recommended to create a project specific image of scheduler that will be based on tshio/scheduler
and (if you need) contain Initial jobs. The easiest way to do so is to create your own Dockerfile
:
FROM tshio/scheduler:latest as scheduler
COPY jobs.json /app/services/scheduler/init-data-volume/
Supported environment variables
LOG_LEVEL
- Description: The variable specifies the level of logging logs by the logger available options:
"error"
,"warn"
,"help"
,"info"
,"debug"
,"verbose"
,"silly"
- Default:
"debug"
REQUEST_LOGGER_FORMAT:
- Description: All requests are logged so the DevOps can check if the request comes from a user or other service (we use morgan library to log information). We created our format to display information but fill free to use one of build-in morgan library available options:
"combined"
,"common"
,"dev"
,"short"
,"tiny"
- Default:
":remote-addr :method :url :status :response-time ms - req-body :body - api-key :apiKey - authorization :authorization"
REQUEST_BODY_KEYS_TO_HIDE
- Description: We don't want to look at our users' private data so by default we hide some common properties. If you want to cheng that please provide your string with words you want to hide separated witch coma
,
- Default:
"password,token,accessToken,accessKey,authorization"
REDIS_URL:
- Description: The variable specifies URL to Redis.
- Default:
"redis://redis:6379"
CONNECTION_STRING:
- Description: The variable specifies URL to PostgreSQL.
- Default:
"postgres://postgres:password@postgres:5432/scheduler"
QUEUE_NAME:
- Description: The variable specifies Redis queue name.
- Default:
"scheduler-queue"
JOB_ATTEMPTS_NUMBER:
- Description: The total number of attempts to try the job until it completes.
- Default:
3
TIME_BETWEEN_ATTEMPTS_IN_MS:
- Description: Setting for automatic retries if the job fails.
- Default:
5000
INITIAL_JOBS_JSON_PATH:
- Description: The variable specifies the path to file with initial scheduler jobs
- Default:
"/app/services/scheduler/init-data-volume/jobs.json"
- Example jobs.json file:
[ { "name": "Initial Job 1", "type": "http", "payload": { "method": "POST", "url": "http://example.com?foo=bar", "headers": { "Content-Type": "application/json" }, "body": "{}", "options": { "compress": true, "follow": 0, "size": 0, "timeout": 0 } }, "jobOptions": { "cron": "0 22 * * 1" }, "startImmediately": true } ]
- Example jobs.json file: