Skip to content
Regularly backup a mysql database to a local drive
JavaScript Shell Dockerfile
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib
.dockerignore
.eslintrc.js
.gitignore
.npmrc
Dockerfile
README.md
package-lock.json
package.json
test.sh

README.md

Local Mysql Backup

Regularly run a mysqldump of your database to a local drive using this handy docker image. Setup with robb-j/node-base.

Sample Usage

docker run -it --rm \
  -e SQL_HOST=mysql \
  -e SQL_USER="root" \
  -e SQL_PASS="secret" \
  -e SCHEDULE="* * * * *" \
  -v "/my_massive_drive:/data" \
  --link mysql \
  -p 8080:80 \
  robb-j/mysql-local-backup

or

backup:
  image: robb-j/mysql-local-backup
  restart: unless-stopped
  environment:
    SCHEDULE: 20 4 5 * *
  env_file:
    - secrets.env
  volumes:
    - ./my_massive_drive:/data
  ports:
    - 8080:80

Where secrets.env has SQL_HOST, SQL_USER & SQL_PASS in it

Variables

Name Usage
SQL_HOST The hostname of your mysql container
SQL_USER The username of your mysql user
SQL_PASS The password of your mysql user
SCHEDULE The cron to run the backup on

Dev Commands

# Build & publish the image (from node-9:alpine)
# -> uses REGISTRY file & the npm version to tag image
npm run push-image

# Update version (builds & pushes a new docker image)
npm version ... # --help

# Lint the web & test directories
npm run lint

# Run the unit tests
npm test

# Generate coverage
npm run coverage          # outputs to coverage/
npm run coverage-summary  # outputs to terminal

# Watch code with nodemon (restarts on file changes)
npm run watch
You can’t perform that action at this time.