Sign inSign up

startx/db-tools

By startx

•Updated over 5 years ago

Container for database management with mysql and couchbase backend

Image
1

5.9K

startx/db-tools repository overview

⁠docker-db-tools sxapi

SXDbTools is a container for managing data from and to a mysql and/or a couchbase backend. All command work with a couchbase cluser and / or a mysql server the same way.

Features list :

  • Dumping multiple buckets or database(s) content
  • Importing multiple dump into database(s) or bucket(s)
  • Creating bucket and/or database, user(s) + load data into couchbase or mysql
  • Deleting and Recreating bucket and/or database, user(s) + load data into couchbase or mysql
  • Creating multiple bucket or database user(s)
  • Deleting and Recreating multiple bucket or database user(s)
  • Creating multiple bucket(s) or database(s)
  • Deleting and Recreating multiple bucket(s) or database(s)
  • Backup multiple buckets or database(s) content into archives
  • Importing archive into buckets or database(s)
  • Use volume for persisting data and load data from external source
  • Use container linking to discover mysql credentials
  • Available as a s2i builder to build openshift pod ready to inject or backup couchbase cluser or mysql server

Build Status docker build last commit licence

sx-dbtools is available from dockerhub registry⁠ under the startx namespace⁠. You can use image name startx/db-tools⁠ to access this image. Add a flavour to get the desired version, for example docker pull startx/db-tools:latest for the latest version.
Here is a list of the various available versions.

Docker tagbranch / tagDockerfileDescription
latestmaster⁠Dockerfile⁠Docker image with debug activated + local sample volume + local application volume + docker-compose test environment
testingtesting⁠Dockerfile⁠Docker image with debug activated + local sample volume + docker-compose test environment
stabledocker⁠Dockerfile⁠Docker image with debug desactivated
stable-s2is2i⁠Dockerfile⁠Docker image with s2i config + debug desactivated
0.1.46v0.1.46⁠Dockerfile⁠Latest release version coresponding to a fixed in time stable release (full list available on tag list⁠)
0.1.46-s2iv0.1.46-s2i⁠Dockerfile⁠Latest release version coresponding to a fixed in time stable release (full list available on tag list⁠)

⁠Getting Started

⁠Linked services

you must tag properly the database service when you link your containers.

Link tagDescription
dbmmysql container running offical mariadb:10.0 image
dbccouchbase container running offical couchbase:5.5.2 image

See docker linked services examples⁠, docker-compose linked services examples⁠ or openshift linked services examples⁠ for copy and paste examples.

⁠Data volumes

you must use the appropriate data volumes and fill them with appropriate file to get your data loaded or dumped properly.

Container volumeDescription
/dumpvolume containing a mysql directory and/or a couchbase directory
/backupvolume containing backup files

See docker data volumes examples⁠, docker-compose data volumes examples⁠ or openshift data volumes examples⁠ for copy and paste examples.

⁠Environement variables

Using environement variable you can customize this tools and use it to interact with various kind of backend infrastructure (container, host, remote, IaaS, DBaaS)

VariableDefaultDescription
SXCMDIf set, container will execute this command instead of the container command (ex: SXCMD="create mysql demo2" for creating the demo2 mysql database)
SXDBTOOLS_DEBUGtrueActivate debugging display
SXDBTOOLS_BACKUP_DIR/backupThe final destination directory for backup
SXDBTOOLS_DUMP_DIR/dumpThe final destination directory for dump
SXDBTOOLS_DELAYUse this param with a positive integer to delay execution of the command
MYSQL_DUMP_DIR/dump/mysqlDirectory used for save and restore mysql dump (container internal path)
MYSQL_DUMP_DATAFILEdata.sqlFilename of the default sql data dump file
MYSQL_DUMP_SCHEMAFILEschema.sqlFilename of the default sql schema dump file
MYSQL_DUMP_ISEXTENDEDtrueEnable smart extended dump for fast load, readibility and versioning
MYSQL_HOSTdbmHostname of the mysql database. Could use whatever public IP or DSN.
MYSQL_ADMIN[linked user]Mysql admin user and password (ex: user:password). Default will use root and MYSQL_ROOT_PASSWORD found into the linked container
MYSQL_DATABASEMysql database name to use or create
MYSQL_USERSMysql list of users to the database "," is separator between users and ":" between user and his password. ex : user:password,user2:user2Password,user3,user4
COUCHBASE_DUMP_DIR/dump/couchbaseDirectory used for save and restore couchbase dump (container internal path)
COUCHBASE_DUMP_DATAFILEdata.jsonFilename of the json data dump file
COUCHBASE_HOSTdbcHostname of the couchbase database. Could use whatever public IP or DSN.
COUCHBASE_ADMINdev:devCouchbase admin user and password (ex: user:password)
COUCHBASE_USERSMysql list of users to the cluster "," is separator between users and ":" between user and his password. ex : user:password,user2:user2Password,user3,user4
COUCHBASE_BUCKETCouchbase bucket name to use or create

See docker environement variables examples⁠, docker-compose environement variables examples⁠ or openshift environement variables examples⁠ for copy and paste examples.

⁠Actions you can perform

⁠Global Commands
Commanddatabase-typeoptionsDescription
createCreate all user(s) + database(s) + data for all database type
createmysql/couchbaseCreate all user(s) + database(s) + data for one database type (mysql or couchbase)
createmysql/couchbasedatabaseCreate one database + data for one database type (mysql or couchbase)
deleteDelete all user(s) + database(s) + data for all database type
deletemysql/couchbaseDelete all user(s) + database(s) + data for one database type (mysql or couchbase)
deletemysql/couchbasedatabaseDelete one database + data for one database type (mysql or couchbase)
recreateDelete and create all user(s) + database(s) + data for all database type
recreatemysql/couchbaseDelete and create all user(s) + database(s) + data for one database type (mysql or couchbase)
recreatemysql/couchbasedatabaseDelete and create one database + data for one database type (mysql or couchbase)

See docker global commands examples⁠, docker-compose global commands examples⁠ or openshift global commands examples⁠ for copy and paste examples.

⁠Data Commands
Commanddatabase-typeoptionsDescription
dumpDump all database(s) AND all bucket(s) in dump directory
dumpmysql/couchbaseDump all database(s) OR all bucket(s) in dump directory
dumpmysql/couchbasedatabaseDump only one database or bucket in dump directory
importimport all database(s) AND all bucket(s) from dump directory
importmysql/couchbaseimport all database(s) OR all bucket(s) from dump directory
importmysql/couchbasedatabaseimport database(s) from dump directory
create-dataalias of import command

See docker data commands examples⁠, docker-compose data commands examples⁠ or openshift data commands examples⁠ for copy and paste examples.

⁠Backup / Restore Commands
Commanddatabase-typeoptionsDescription
backupBackup database(s) in backup directory (not implemented)
backupmysql/couchbaseBackup all database(s) or all bucket(s) in backup directory (not implemented)
backupmysql/couchbasedatabaseBackup one database or bucket in backup directory (not implemented)
restorearchivename.tgzRestore database(s) in backup directory (not implemented)

See docker backup/restore commands examples⁠, docker-compose backup/restore commands examples⁠ or openshift backup/restore commands examples⁠ for copy and paste examples.

⁠Database Commands
Commanddatabase-typeoptionsDescription
create-dbCreate all database(s) for all database type
create-dbmysql/couchbaseCreate all database(s) for one database type (mysql or couchbase)
create-dbmysql/couchbasedatabaseCreate one database for one database type (mysql or couchbase)
delete-dbDelete all database(s) for all database type
delete-dbmysql/couchbaseDelete all database(s) for one database type (mysql or couchbase)
delete-dbmysql/couchbasedatabaseDelete one database for one database type (mysql or couchbase)
recreate-dbDelete and create all database(s) for all database type
recreate-dbmysql/couchbaseDelete and create all database(s) for one database type (mysql or couchbase)
recreate-dbmysql/couchbasedatabaseDelete and create one database for one database type (mysql or couchbase)

See docker database commands examples⁠, docker-compose database commands examples⁠ or openshift database commands examples⁠ for copy and paste examples.

⁠User management Commands
Commanddatabase-typeoptionsDescription
create-userCreate all user(s) for all database type
create-usermysql/couchbaseCreate all user(s) for one database type (mysql or couchbase)
create-usermysql/couchbaseuserCreate one user for one database type (mysql or couchbase)
delete-userDelete all user(s) for all database type
delete-usermysql/couchbaseDelete all user(s) for one database type (mysql or couchbase)
delete-usermysql/couchbaseuserDelete one user for one database type (mysql or couchbase)
recreate-userDelete and create all user(s) for all database type
recreate-usermysql/couchbaseDelete and create all user(s) for one database type (mysql or couchbase)
recreate-usermysql/couchbaseuserDelete and create one user for one database type (mysql or couchbase)

See docker user management commands examples⁠, docker-compose user management commands examples⁠ or openshift user management commands examples⁠ for copy and paste examples.

⁠sx-dbtools Commands
Commanddatabase-typeoptionsDescription
usageusage message
helpdisplay information about a command
infogive information about the running sx-dbtools
versiongive the version of the running sx_dbtools
cmdreturn an interactive bash command
bashalias of command with no arguments
cmdcommandexecute the command and return result
daemoncontainer never giveup and run permanently

See docker sx-dbtools commands examples⁠, docker-compose sx-dbtools commands examples⁠ or openshift sx-dbtools commands examples⁠ for copy and paste examples.

⁠Troubleshooting

If you run into difficulties installing or running db-tools, you can create an issue⁠.

⁠Built With

⁠Contributing

Read the contributing guide⁠ for details on our code of conduct, and the process for submitting pull requests to us.

⁠Authors

This project is mainly developped by the startx⁠ dev team. You can see the complete list of contributors who participated in this project by reading CONTRIBUTORS.md⁠.

⁠License

This project is licensed under the Apache License Version 2.0 - see the LICENSE⁠ file for details

Tag summary

Content type

Image

Digest

Size

423.9 MB

Last updated

over 5 years ago

docker pull startx/db-tools