Configuration
DBacked configuration is made to be adaptable to a lot of different scenarios. It should be easy to integrate DBacked in your existing system.
There is three sources of configuration (from highest to lowest priority):
- Command line arguments CLI
- Environment variables ENV
- Configuration file CFG
Every following configuration can be provided through these means. The configuration file default location is /etc/dbacked/config.json
but can be changed with --config-file-path
command line argument.
Some configuration are only used for the free DBacked version and other for the Pro DBacked service. They will be ignored if specified and not useful.
Agent config
- Subscription type: can be
free
orpro
- Optionnal Default: free
--subscription-type free
CLIDBACKED_SUBSCRIPTION_TYPE=free
ENV"subscriptionType": "free"
CFG
- Agent ID: Used when multiple instances of DBacked are launched to identify which made the backup
- Optionnal
--agent-id awesome-agent
CLIDBACKED_AGENT_ID=awesome-agent
ENV"agentId": "awesome-agent"
CFG
- Database tools download directory: where to download tools like
pg_dump
andmongorestore
- Optionnal Default: /tmp/dbacked
--database-tools-directory /tmp/dbacked
CLIDBACKED_DATABASE_TOOLS_DIRECTORY=/tmp/dbacked
ENV"databaseToolsDirectory": "/tmp/dbacked"
CFG
- DBacked Pro API key: Used to identify to DBacked servers when using pro version
- DBacked PRO
--apikey thisismyapikey
CLIDBACKED_APIKEY=thisismyapikey
ENV"apikey": "thisismyapikey"
CFG
- Email: Used to send you an alert if no backups have been made in the last 30 days, if you don't give an email, no beacon will be sent to the DBacked servers, for more information, look at the corresponding documentation
- DBacked FREE Optionnal
--email john@gmail.com
CLIDBACKED_EMAIL=john@gmail.com
ENV"email": "john@gmail.com"
CFG
- Backup schedule: When to backup the database, should be a cron expression. Use
0 0 * * *
to backup everyday at midnight. For more information look at Crontab.guru.- DBacked FREE Required
--cron "0 0 * * *"
CLIDBACKED_CRON="0 0 * * *"
ENV"cron": "0 0 * * *"
CFG
Security config
- Public Key: The RSA public key as a PEM to use to encrypt your backups, recommended length is 4096bits. DBacked can create one for you during the interactive install. If you are using DBacked Pro, the agent will fetch the key from the servers but you can specify it to be sure no backups will be encrypted with another key than your own.
- Required
--public-key XXXXX
CLIDBACKED_PUBLIC_KEY=XXXXX
ENV"publicKey": "XXXXX"
CFG
AWS S3 config
This config is only used for DBacked free. It will be ignored if you are a DBacked Pro user.
The access key and secret should have enough privileges to create and list backups. Look at the S3 documentation for more information.
- S3 Access Key ID:
- DBacked FREE Required
--s3-access-key-id XXXXX
CLIDBACKED_S3_ACCESS_KEY_ID=XXXXX
ENV"s3accessKeyId": "XXXXX"
CFG
- S3 Secret Access Key:
- DBacked FREE Required
--s3-secret-access-key XXXXX
CLIDBACKED_S3_SECRET_ACCESS_KEY=XXXXX
ENV"s3secretAccessKey": "XXXXX"
CFG
- S3 Region: Should be a valid AWS S3 region
- DBacked FREE Required
--s3-region eu-west-1
CLIDBACKED_S3_REGION=eu-west-1
ENV"s3region": "eu-west-1"
CFG
- S3 Bucket Name: This bucket needs to be created before
- DBacked FREE Required
--s3-bucket test-bucket
CLIDBACKED_S3_BUCKET=test-bucket
ENV"s3bucket": "test-bucket"
CFG
Database config
- Database type: can be
pg
,mysql
ormongodb
- Required
--db-type pg
CLIDBACKED_DB_TYPE=pg
ENV"dbType": "pg"
CFG
- Database connection string: Only for MongoDB, look at the documentation on the MongoDB website for more information
- MongoDB Only Required
--db-connection-string mongodb://db1.example.net:27017/prod
CLIDBACKED_DB_CONNECTION_STRING="mongodb://db1.example.net:27017/prod"
ENV"dbConnectionString": "mongodb://db1.example.net:27017/prod"
CFG
- Database Host: Can be a hostname or an IP address
- PostgreSQL and MySQL Only Required
--db-host localhost
CLIDBACKED_DB_HOST="localhost"
ENV"dbHost": "localhost"
CFG
- Database Port:
- PostgreSQL and MySQL Only Optionnal
--db-port 5432
CLIDBACKED_DB_PORT="5432"
ENV"dbPort": "5432"
CFG
- Database Username:
- PostgreSQL and MySQL Only Optionnal
--db-username backup
CLIDBACKED_DB_USERNAME="backup"
ENV"dbUsername": "backup"
CFG
- Database Password:
- PostgreSQL and MySQL Only Optionnal
--db-password secretpassword
CLIDBACKED_DB_PASSWORD="secretpassword"
ENV"dbPassword": "secretpassword"
CFG
- Database Name:
- PostgreSQL and MySQL Only Required
--db-name prod
CLIDBACKED_DB_NAME="prod"
ENV"dbName": "prod"
CFG
- Database Alias: Used in backups files names, by default it's the database name
- PostgreSQL and MySQL Only Optionnal
--db-alias staging
CLIDBACKED_DB_ALIAS="staging"
ENV"dbAlias": "staging"
CFG
Misc
- Dumper Options: Additionnal arguments to provide to
pg_dump
,mysqldump
ormongodump
- Optionnal
--dumper-options "--no-privileges"
CLIDBACKED_DUMPER_OPTIONS="--no-privileges"
ENV"dumperOptions": "--no-privileges"
CFG
- Send analytics: Send anonymous analytics to our servers to help us improve DBacked. Would be much appreciated! 😃 For more information about what's sent and when, look at the related section on the Security page.
- Optionnal Default: false
--send-analytics
CLIDBACKED_SEND_ANALYTICS="true"
ENV"sendAnalytics": true
CFG
- Daemon: Daemonize the agent, detaching it from the current session. It will check if another daemon is already running before daemonizing
- Optionnal Only with start-agent command
--daemon
CLIDBACKED_DAEMON="true"
ENV"daemon": true
CFG
- Daemon Name: Use another name to daemonize the agent, useful when you want multiple instances of DBacked to be daemonized at the same time (for multiple databases)
- Optionnal Only with start-agent command
--daemon-name staging
CLIDBACKED_DAEMON_NAME="staging"
ENV"daemonName": staging
CFG