Code Monkey home page Code Monkey logo

dokku-mariadb's Introduction

dokku mariadb Build Status IRC Network

Official mariadb plugin for dokku. Currently defaults to installing mariadb 11.3.2.

Requirements

  • dokku 0.19.x+
  • docker 1.8.x

Installation

# on 0.19.x+
sudo dokku plugin:install https://github.com/dokku/dokku-mariadb.git mariadb

Commands

mariadb:app-links <app>                            # list all mariadb service links for a given app
mariadb:backup <service> <bucket-name> [--use-iam] # create a backup of the mariadb service to an existing s3 bucket
mariadb:backup-auth <service> <aws-access-key-id> <aws-secret-access-key> <aws-default-region> <aws-signature-version> <endpoint-url> # set up authentication for backups on the mariadb service
mariadb:backup-deauth <service>                    # remove backup authentication for the mariadb service
mariadb:backup-schedule <service> <schedule> <bucket-name> [--use-iam] # schedule a backup of the mariadb service
mariadb:backup-schedule-cat <service>              # cat the contents of the configured backup cronfile for the service
mariadb:backup-set-encryption <service> <passphrase> # set encryption for all future backups of mariadb service
mariadb:backup-unschedule <service>                # unschedule the backup of the mariadb service
mariadb:backup-unset-encryption <service>          # unset encryption for future backups of the mariadb service
mariadb:clone <service> <new-service> [--clone-flags...] # create container <new-name> then copy data from <name> into <new-name>
mariadb:connect <service>                          # connect to the service via the mariadb connection tool
mariadb:create <service> [--create-flags...]       # create a mariadb service
mariadb:destroy <service> [-f|--force]             # delete the mariadb service/data/container if there are no links left
mariadb:enter <service>                            # enter or run a command in a running mariadb service container
mariadb:exists <service>                           # check if the mariadb service exists
mariadb:export <service>                           # export a dump of the mariadb service database
mariadb:expose <service> <ports...>                # expose a mariadb service on custom host:port if provided (random port on the 0.0.0.0 interface if otherwise unspecified)
mariadb:import <service>                           # import a dump into the mariadb service database
mariadb:info <service> [--single-info-flag]        # print the service information
mariadb:link <service> <app> [--link-flags...]     # link the mariadb service to the app
mariadb:linked <service> <app>                     # check if the mariadb service is linked to an app
mariadb:links <service>                            # list all apps linked to the mariadb service
mariadb:list                                       # list all mariadb services
mariadb:logs <service> [-t|--tail] <tail-num-optional> # print the most recent log(s) for this service
mariadb:pause <service>                            # pause a running mariadb service
mariadb:promote <service> <app>                    # promote service <service> as DATABASE_URL in <app>
mariadb:restart <service>                          # graceful shutdown and restart of the mariadb service container
mariadb:set <service> <key> <value>                # set or clear a property for a service
mariadb:start <service>                            # start a previously stopped mariadb service
mariadb:stop <service>                             # stop a running mariadb service
mariadb:unexpose <service>                         # unexpose a previously exposed mariadb service
mariadb:unlink <service> <app>                     # unlink the mariadb service from the app
mariadb:upgrade <service> [--upgrade-flags...]     # upgrade service <service> to the specified versions

Usage

Help for any commands can be displayed by specifying the command as an argument to mariadb:help. Plugin help output in conjunction with any files in the docs/ folder is used to generate the plugin documentation. Please consult the mariadb:help command for any undocumented commands.

Basic Usage

create a mariadb service

# usage
dokku mariadb:create <service> [--create-flags...]

flags:

  • -c|--config-options "--args --go=here": extra arguments to pass to the container create command (default: None)
  • -C|--custom-env "USER=alpha;HOST=beta": semi-colon delimited environment variables to start the service with
  • -i|--image IMAGE: the image name to start the service with
  • -I|--image-version IMAGE_VERSION: the image version to start the service with
  • -m|--memory MEMORY: container memory limit in megabytes (default: unlimited)
  • -N|--initial-network INITIAL_NETWORK: the initial network to attach the service to
  • -p|--password PASSWORD: override the user-level service password
  • -P|--post-create-network NETWORKS: a comma-separated list of networks to attach the service container to after service creation
  • -r|--root-password PASSWORD: override the root-level service password
  • -S|--post-start-network NETWORKS: a comma-separated list of networks to attach the service container to after service start
  • -s|--shm-size SHM_SIZE: override shared memory size for mariadb docker container

Create a mariadb service named lollipop:

dokku mariadb:create lollipop

You can also specify the image and image version to use for the service. It must be compatible with the mariadb image.

export MARIADB_IMAGE="mariadb"
export MARIADB_IMAGE_VERSION="${PLUGIN_IMAGE_VERSION}"
dokku mariadb:create lollipop

You can also specify custom environment variables to start the mariadb service in semicolon-separated form.

export MARIADB_CUSTOM_ENV="USER=alpha;HOST=beta"
dokku mariadb:create lollipop

print the service information

# usage
dokku mariadb:info <service> [--single-info-flag]

flags:

  • --config-dir: show the service configuration directory
  • --data-dir: show the service data directory
  • --dsn: show the service DSN
  • --exposed-ports: show service exposed ports
  • --id: show the service container id
  • --internal-ip: show the service internal ip
  • --initial-network: show the initial network being connected to
  • --links: show the service app links
  • --post-create-network: show the networks to attach to after service container creation
  • --post-start-network: show the networks to attach to after service container start
  • --service-root: show the service root directory
  • --status: show the service running status
  • --version: show the service image version

Get connection information as follows:

dokku mariadb:info lollipop

You can also retrieve a specific piece of service info via flags:

dokku mariadb:info lollipop --config-dir
dokku mariadb:info lollipop --data-dir
dokku mariadb:info lollipop --dsn
dokku mariadb:info lollipop --exposed-ports
dokku mariadb:info lollipop --id
dokku mariadb:info lollipop --internal-ip
dokku mariadb:info lollipop --initial-network
dokku mariadb:info lollipop --links
dokku mariadb:info lollipop --post-create-network
dokku mariadb:info lollipop --post-start-network
dokku mariadb:info lollipop --service-root
dokku mariadb:info lollipop --status
dokku mariadb:info lollipop --version

list all mariadb services

# usage
dokku mariadb:list

List all services:

dokku mariadb:list

print the most recent log(s) for this service

# usage
dokku mariadb:logs <service> [-t|--tail] <tail-num-optional>

flags:

  • -t|--tail [<tail-num>]: do not stop when end of the logs are reached and wait for additional output

You can tail logs for a particular service:

dokku mariadb:logs lollipop

By default, logs will not be tailed, but you can do this with the --tail flag:

dokku mariadb:logs lollipop --tail

The default tail setting is to show all logs, but an initial count can also be specified:

dokku mariadb:logs lollipop --tail 5

link the mariadb service to the app

# usage
dokku mariadb:link <service> <app> [--link-flags...]

flags:

  • -a|--alias "BLUE_DATABASE": an alternative alias to use for linking to an app via environment variable
  • -q|--querystring "pool=5": ampersand delimited querystring arguments to append to the service link
  • -n|--no-restart "false": whether or not to restart the app on link (default: true)

A mariadb service can be linked to a container. This will use native docker links via the docker-options plugin. Here we link it to our playground app.

NOTE: this will restart your app

dokku mariadb:link lollipop playground

The following environment variables will be set automatically by docker (not on the app itself, so they won’t be listed when calling dokku config):

DOKKU_MARIADB_LOLLIPOP_NAME=/lollipop/DATABASE
DOKKU_MARIADB_LOLLIPOP_PORT=tcp://172.17.0.1:3306
DOKKU_MARIADB_LOLLIPOP_PORT_3306_TCP=tcp://172.17.0.1:3306
DOKKU_MARIADB_LOLLIPOP_PORT_3306_TCP_PROTO=tcp
DOKKU_MARIADB_LOLLIPOP_PORT_3306_TCP_PORT=3306
DOKKU_MARIADB_LOLLIPOP_PORT_3306_TCP_ADDR=172.17.0.1

The following will be set on the linked application by default:

DATABASE_URL=mysql://mariadb:SOME_PASSWORD@dokku-mariadb-lollipop:3306/lollipop

The host exposed here only works internally in docker containers. If you want your container to be reachable from outside, you should use the expose subcommand. Another service can be linked to your app:

dokku mariadb:link other_service playground

It is possible to change the protocol for DATABASE_URL by setting the environment variable MARIADB_DATABASE_SCHEME on the app. Doing so will after linking will cause the plugin to think the service is not linked, and we advise you to unlink before proceeding.

dokku config:set playground MARIADB_DATABASE_SCHEME=mysql2
dokku mariadb:link lollipop playground

This will cause DATABASE_URL to be set as:

mysql2://mariadb:SOME_PASSWORD@dokku-mariadb-lollipop:3306/lollipop

unlink the mariadb service from the app

# usage
dokku mariadb:unlink <service> <app>

flags:

  • -n|--no-restart "false": whether or not to restart the app on unlink (default: true)

You can unlink a mariadb service:

NOTE: this will restart your app and unset related environment variables

dokku mariadb:unlink lollipop playground

set or clear a property for a service

# usage
dokku mariadb:set <service> <key> <value>

Set the network to attach after the service container is started:

dokku mariadb:set lollipop post-create-network custom-network

Set multiple networks:

dokku mariadb:set lollipop post-create-network custom-network,other-network

Unset the post-create-network value:

dokku mariadb:set lollipop post-create-network

Service Lifecycle

The lifecycle of each service can be managed through the following commands:

connect to the service via the mariadb connection tool

# usage
dokku mariadb:connect <service>

Connect to the service via the mariadb connection tool:

NOTE: disconnecting from ssh while running this command may leave zombie processes due to moby/moby#9098

dokku mariadb:connect lollipop

enter or run a command in a running mariadb service container

# usage
dokku mariadb:enter <service>

A bash prompt can be opened against a running service. Filesystem changes will not be saved to disk.

NOTE: disconnecting from ssh while running this command may leave zombie processes due to moby/moby#9098

dokku mariadb:enter lollipop

You may also run a command directly against the service. Filesystem changes will not be saved to disk.

dokku mariadb:enter lollipop touch /tmp/test

expose a mariadb service on custom host:port if provided (random port on the 0.0.0.0 interface if otherwise unspecified)

# usage
dokku mariadb:expose <service> <ports...>

Expose the service on the service's normal ports, allowing access to it from the public interface (0.0.0.0):

dokku mariadb:expose lollipop 3306

Expose the service on the service's normal ports, with the first on a specified ip adddress (127.0.0.1):

dokku mariadb:expose lollipop 127.0.0.1:3306

unexpose a previously exposed mariadb service

# usage
dokku mariadb:unexpose <service>

Unexpose the service, removing access to it from the public interface (0.0.0.0):

dokku mariadb:unexpose lollipop

promote service as DATABASE_URL in

# usage
dokku mariadb:promote <service> <app>

If you have a mariadb service linked to an app and try to link another mariadb service another link environment variable will be generated automatically:

DOKKU_DATABASE_BLUE_URL=mysql://other_service:ANOTHER_PASSWORD@dokku-mariadb-other-service:3306/other_service

You can promote the new service to be the primary one:

NOTE: this will restart your app

dokku mariadb:promote other_service playground

This will replace DATABASE_URL with the url from other_service and generate another environment variable to hold the previous value if necessary. You could end up with the following for example:

DATABASE_URL=mysql://other_service:ANOTHER_PASSWORD@dokku-mariadb-other-service:3306/other_service
DOKKU_DATABASE_BLUE_URL=mysql://other_service:ANOTHER_PASSWORD@dokku-mariadb-other-service:3306/other_service
DOKKU_DATABASE_SILVER_URL=mysql://lollipop:SOME_PASSWORD@dokku-mariadb-lollipop:3306/lollipop

start a previously stopped mariadb service

# usage
dokku mariadb:start <service>

Start the service:

dokku mariadb:start lollipop

stop a running mariadb service

# usage
dokku mariadb:stop <service>

Stop the service and removes the running container:

dokku mariadb:stop lollipop

pause a running mariadb service

# usage
dokku mariadb:pause <service>

Pause the running container for the service:

dokku mariadb:pause lollipop

graceful shutdown and restart of the mariadb service container

# usage
dokku mariadb:restart <service>

Restart the service:

dokku mariadb:restart lollipop

upgrade service to the specified versions

# usage
dokku mariadb:upgrade <service> [--upgrade-flags...]

flags:

  • -c|--config-options "--args --go=here": extra arguments to pass to the container create command (default: None)
  • -C|--custom-env "USER=alpha;HOST=beta": semi-colon delimited environment variables to start the service with
  • -i|--image IMAGE: the image name to start the service with
  • -I|--image-version IMAGE_VERSION: the image version to start the service with
  • -N|--initial-network INITIAL_NETWORK: the initial network to attach the service to
  • -P|--post-create-network NETWORKS: a comma-separated list of networks to attach the service container to after service creation
  • -R|--restart-apps "true": whether or not to force an app restart (default: false)
  • -S|--post-start-network NETWORKS: a comma-separated list of networks to attach the service container to after service start
  • -s|--shm-size SHM_SIZE: override shared memory size for mariadb docker container

You can upgrade an existing service to a new image or image-version:

dokku mariadb:upgrade lollipop

Service Automation

Service scripting can be executed using the following commands:

list all mariadb service links for a given app

# usage
dokku mariadb:app-links <app>

List all mariadb services that are linked to the playground app.

dokku mariadb:app-links playground

create container then copy data from into

# usage
dokku mariadb:clone <service> <new-service> [--clone-flags...]

flags:

  • -c|--config-options "--args --go=here": extra arguments to pass to the container create command (default: None)
  • -C|--custom-env "USER=alpha;HOST=beta": semi-colon delimited environment variables to start the service with
  • -i|--image IMAGE: the image name to start the service with
  • -I|--image-version IMAGE_VERSION: the image version to start the service with
  • -m|--memory MEMORY: container memory limit in megabytes (default: unlimited)
  • -N|--initial-network INITIAL_NETWORK: the initial network to attach the service to
  • -p|--password PASSWORD: override the user-level service password
  • -P|--post-create-network NETWORKS: a comma-separated list of networks to attach the service container to after service creation
  • -r|--root-password PASSWORD: override the root-level service password
  • -S|--post-start-network NETWORKS: a comma-separated list of networks to attach the service container to after service start
  • -s|--shm-size SHM_SIZE: override shared memory size for mariadb docker container

You can clone an existing service to a new one:

dokku mariadb:clone lollipop lollipop-2

check if the mariadb service exists

# usage
dokku mariadb:exists <service>

Here we check if the lollipop mariadb service exists.

dokku mariadb:exists lollipop

check if the mariadb service is linked to an app

# usage
dokku mariadb:linked <service> <app>

Here we check if the lollipop mariadb service is linked to the playground app.

dokku mariadb:linked lollipop playground

list all apps linked to the mariadb service

# usage
dokku mariadb:links <service>

List all apps linked to the lollipop mariadb service.

dokku mariadb:links lollipop

Data Management

The underlying service data can be imported and exported with the following commands:

import a dump into the mariadb service database

# usage
dokku mariadb:import <service>

Import a datastore dump:

dokku mariadb:import lollipop < data.dump

export a dump of the mariadb service database

# usage
dokku mariadb:export <service>

By default, datastore output is exported to stdout:

dokku mariadb:export lollipop

You can redirect this output to a file:

dokku mariadb:export lollipop > data.dump

Backups

Datastore backups are supported via AWS S3 and S3 compatible services like minio.

You may skip the backup-auth step if your dokku install is running within EC2 and has access to the bucket via an IAM profile. In that case, use the --use-iam option with the backup command.

Backups can be performed using the backup commands:

set up authentication for backups on the mariadb service

# usage
dokku mariadb:backup-auth <service> <aws-access-key-id> <aws-secret-access-key> <aws-default-region> <aws-signature-version> <endpoint-url>

Setup s3 backup authentication:

dokku mariadb:backup-auth lollipop AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY

Setup s3 backup authentication with different region:

dokku mariadb:backup-auth lollipop AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY AWS_REGION

Setup s3 backup authentication with different signature version and endpoint:

dokku mariadb:backup-auth lollipop AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY AWS_REGION AWS_SIGNATURE_VERSION ENDPOINT_URL

More specific example for minio auth:

dokku mariadb:backup-auth lollipop MINIO_ACCESS_KEY_ID MINIO_SECRET_ACCESS_KEY us-east-1 s3v4 https://YOURMINIOSERVICE

remove backup authentication for the mariadb service

# usage
dokku mariadb:backup-deauth <service>

Remove s3 authentication:

dokku mariadb:backup-deauth lollipop

create a backup of the mariadb service to an existing s3 bucket

# usage
dokku mariadb:backup <service> <bucket-name> [--use-iam]

flags:

  • -u|--use-iam: use the IAM profile associated with the current server

Backup the lollipop service to the my-s3-bucket bucket on AWS:`

dokku mariadb:backup lollipop my-s3-bucket --use-iam

Restore a backup file (assuming it was extracted via tar -xf backup.tgz):

dokku mariadb:import lollipop < backup-folder/export

set encryption for all future backups of mariadb service

# usage
dokku mariadb:backup-set-encryption <service> <passphrase>

Set the GPG-compatible passphrase for encrypting backups for backups:

dokku mariadb:backup-set-encryption lollipop

unset encryption for future backups of the mariadb service

# usage
dokku mariadb:backup-unset-encryption <service>

Unset the GPG encryption passphrase for backups:

dokku mariadb:backup-unset-encryption lollipop

schedule a backup of the mariadb service

# usage
dokku mariadb:backup-schedule <service> <schedule> <bucket-name> [--use-iam]

flags:

  • -u|--use-iam: use the IAM profile associated with the current server

Schedule a backup:

'schedule' is a crontab expression, eg. "0 3 * * *" for each day at 3am

dokku mariadb:backup-schedule lollipop "0 3 * * *" my-s3-bucket

Schedule a backup and authenticate via iam:

dokku mariadb:backup-schedule lollipop "0 3 * * *" my-s3-bucket --use-iam

cat the contents of the configured backup cronfile for the service

# usage
dokku mariadb:backup-schedule-cat <service>

Cat the contents of the configured backup cronfile for the service:

dokku mariadb:backup-schedule-cat lollipop

unschedule the backup of the mariadb service

# usage
dokku mariadb:backup-unschedule <service>

Remove the scheduled backup from cron:

dokku mariadb:backup-unschedule lollipop

Disabling docker image pull calls

If you wish to disable the docker image pull calls that the plugin triggers, you may set the MARIADB_DISABLE_PULL environment variable to true. Once disabled, you will need to pull the service image you wish to deploy as shown in the stderr output.

Please ensure the proper images are in place when docker image pull is disabled.

dokku-mariadb's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

dokku-mariadb's Issues

Cannot run `mariadb:connect` and `mariadb:export` commands

Description of problem

Cannot run mariadb:connect and mariadb:export commands, it says command not found for mysql and mysqldump, respectively.
I checked and both mysql and mysqldump commands are available in the host machine but not in the container - in the service container the names are mariadb and mariadb-dump.

How reproducible

The problem occurs when I execute the following commands:

# dokku mariadb:export myservice
OCI runtime exec failed: exec failed: unable to start container process: exec: "mysqldump": executable file not found in $PATH: unknown

# dokku mariadb:connect myservice
env: ‘mysql’: No such file or directory

Environment Information

         00_dokku-standard    0.30.9 enabled    dokku core standard plugin                                                    
         mariadb              1.34.0 enabled    dokku mariadb service plugin                                                  

How (deb/make) and where (AWS, VirtualBox, physical, etc.) was Dokku installed?:

Using Debian repository.

Temporary fix

I've symlinked the executables and it worked:

container_id=$(dokku mariadb:info myservice | grep 'Id:' | awk '{print $2}')
docker exec -it $container_id ln -s /usr/bin/mariadb-dump /usr/bin/mysqldump
docker exec -it $container_id ln -s /usr/bin/mariadb /usr/bin/mysql

After this, running dokku mariadb:export works but warns:

mysqldump: Deprecated program name. It will be removed in a future release, use '/usr/bin/mariadb-dump' instead

Consider to change default character set to utf8

MariaDB's default character set is latin1, so we can't handle utf8 encoded data by default.

Since dokku-mariadb supports custom user configuration, basically I think we don't need to change default configurations, but I think this is a reasonable one to change.

dokku-mysql plugin already changed to use utf8 as a default character set by this Pull request (#62).

How to configure my.cnf

Hi!

I would like to configure innodb_buffer_pool_size . Is this configurable somehow.

I usually update it @ /etc/mysql/my.cnf for Wordpress Digitalocean VPSes

But for docker im not quite sure where to do that.

root@creative:~# locate my.cnf
/var/lib/docker/aufs/diff/66978a415c79686619b2999bab3338fb05aa505f032d032a13bd9132d40440af/etc/mysql/my.cnf
/var/lib/docker/aufs/diff/86fd8e7b9fca2d7999ef3a524e4470941c64a9542f2b4d3aab818378716f908c/etc/mysql/my.cnf
/var/lib/docker/aufs/diff/bae39a7a3d4407dc5d7dea3750d6504c3bc2bb778623eca20189b23cee14e899/etc/mysql/my.cnf
/var/lib/docker/aufs/diff/bae39a7a3d4407dc5d7dea3750d6504c3bc2bb778623eca20189b23cee14e899/etc/systemd/system/mariadb.service.d/migrated-from-my.cnf-settings.conf
/var/lib/docker/aufs/diff/eedacc43acd02e38fd1a142e8a4f06c539b550a2e516e7c54a32f715f6b2a154/etc/mysql/my.cnf
/var/lib/docker/aufs/diff/fecfc185bfdffd32718f317bb291f1cc60bbd4e48af6ff994e9ea16394281224/etc/mysql/my.cnf
/var/lib/docker/aufs/diff/fecfc185bfdffd32718f317bb291f1cc60bbd4e48af6ff994e9ea16394281224/etc/systemd/system/mariadb.service.d/migrated-from-my.cnf-settings.conf
/var/lib/docker/aufs/mnt/14eaa86df27268627a37d73502eed9d224ee8ccee866f3c3285624ec7de0142d/etc/mysql/my.cnf
/var/lib/docker/aufs/mnt/288bafabce28d53fafe731c0abefc43543d2ddb4c6bc412a3bb3138de9ff2c9d/etc/mysql/my.cnf
/var/lib/docker/aufs/mnt/288bafabce28d53fafe731c0abefc43543d2ddb4c6bc412a3bb3138de9ff2c9d/etc/systemd/system/mariadb.service.d/migrated-from-my.cnf-settings.conf
/var/lib/docker/aufs/mnt/2c5d3a751c36f58374c18b14ff078c2424c29a9de8179ea044a0ee85179d3277/etc/mysql/my.cnf
/var/lib/docker/aufs/mnt/2c5d3a751c36f58374c18b14ff078c2424c29a9de8179ea044a0ee85179d3277/etc/systemd/system/mariadb.service.d/migrated-from-my.cnf-settings.conf
/var/lib/docker/aufs/mnt/41d669f6b3af325b1d4191ff7a6acaf40c59a219262db149cdfe1deeaab56073/etc/mysql/my.cnf
/var/lib/docker/aufs/mnt/641403e5b5e4489404feddb34368cecf8c4cee29368e651427667bdabf0909c6/etc/mysql/my.cnf
/var/lib/docker/aufs/mnt/641403e5b5e4489404feddb34368cecf8c4cee29368e651427667bdabf0909c6/etc/systemd/system/mariadb.service.d/migrated-from-my.cnf-settings.conf
/var/lib/docker/aufs/mnt/7ebe0235653c4fea9be013d0aa4b42075465dbcaf42745421af5fd0218de32e4/etc/mysql/my.cnf
/var/lib/docker/aufs/mnt/81aef3c69b1907c467c24fa305105c11a2236c1fbfba5500f481445b70cbfb90/etc/mysql/my.cnf
/var/lib/docker/aufs/mnt/81aef3c69b1907c467c24fa305105c11a2236c1fbfba5500f481445b70cbfb90/etc/systemd/system/mariadb.service.d/migrated-from-my.cnf-settings.conf
/var/lib/docker/aufs/mnt/cb2edc194593a897e2bb7e53cf232ff867594ca2012fe86a1b77117fe64f51eb/etc/mysql/my.cnf
/var/lib/docker/aufs/mnt/f1cfd174edd4cedb75fa81254481a409ae65eff94c5cfd42e56b7093127ca682/etc/mysql/my.cnf
/var/lib/docker/aufs/mnt/f1cfd174edd4cedb75fa81254481a409ae65eff94c5cfd42e56b7093127ca682/etc/systemd/system/mariadb.service.d/migrated-from-my.cnf-settings.conf

When i run doker ps i see mariab containers for each blog container. Im not quite sure where to look for my.cnf

➜ ~ sudo docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
58ecf780fe59 dokku/blog.stockholmhealth.com:latest "/start web" 7 minutes ago Up 7 minutes blog.stockholmhealth.com.web.1
cc5d4cf4cf15 dokku/skaistumanoslepums.lv:latest "/start web" 22 hours ago Up 22 hours skaistumanoslepums.lv.web.1
fc4d5e252359 mariadb:10.1.13 "/docker-entrypoint.s" 22 hours ago Up 22 hours 3306/tcp dokku.mariadb.skaistumanoslepums.lv
8fb23aa02b5f dokku/uz-veselibu.lv:latest "/start web" 22 hours ago Up 22 hours uz-veselibu.lv.web.1
11e7c8bb5f0e dokku/blog.swisslanguages.com:latest "/start web" 23 hours ago Up 23 hours blog.swisslanguages.com.web.1
bf344ed59f00 mariadb:10.1.13 "/docker-entrypoint.s" 29 hours ago Up 29 hours 3306/tcp dokku.mariadb.blog.stockholmhealth.com
a4cd8d9f820f dokku/blog:latest "/start web" 4 days ago Up 4 days blog.web.1
694494f0241b mariadb:10.1.13 "/docker-entrypoint.s" 4 days ago Up 4 days 3306/tcp dokku.mariadb.uz-veselibu.lv
75b9a0618ca6 mariadb:10.1.13 "/docker-entrypoint.s" 4 days ago Up 4 days 3306/tcp dokku.mariadb.blog.swisslanguages.com
0e9df5bd0fee mariadb:10.1.13 "/docker-entrypoint.s" 4 days ago Up 4 days 3306/tcp dokku.mariadb.blog

Unable to list Mariadb services due to a `*` folder

I started to have an issue everytime I ran: dokku mariadb:list. The command tried to run something on every file in the current folder, as weird as it sounds.

Real log of root@localhost:/home/dokku/web-app# dokku mariadb:list

Error: No such image or container: dokku.mariadb.CONTAINER.web.1
cat: /var/lib/dokku/services/mariadb/CONTAINER.web.1/ID: No such file or directory
Unable to read inspect data: json: cannot unmarshal array into Go value of type types.ContainerJSON
Unable to read inspect data: json: cannot unmarshal array into Go value of type types.ContainerJSON
Unable to read inspect data: json: cannot unmarshal array into Go value of type types.ContainerJSON
Unable to read inspect data: json: cannot unmarshal array into Go value of type types.ContainerJSON
Unable to read inspect data: json: cannot unmarshal array into Go value of type types.ContainerJSON
/var/lib/dokku/plugins/enabled/mariadb/functions: line 349: /var/lib/dokku/services/mariadb/CONTAINER.web.1/LINKS: No such file or directory
Error: No such image or container: dokku.mariadb.DOKKU_SCALE
cat: /var/lib/dokku/services/mariadb/DOKKU_SCALE/ID: No such file or directory
Unable to read inspect data: json: cannot unmarshal array into Go value of type types.ContainerJSON
Unable to read inspect data: json: cannot unmarshal array into Go value of type types.ContainerJSON
Unable to read inspect data: json: cannot unmarshal array into Go value of type types.ContainerJSON
Unable to read inspect data: json: cannot unmarshal array into Go value of type types.ContainerJSON
Unable to read inspect data: json: cannot unmarshal array into Go value of type types.ContainerJSON
/var/lib/dokku/plugins/enabled/mariadb/functions: line 349: /var/lib/dokku/services/mariadb/DOKKU_SCALE/LINKS: No such file or directory
Error: No such image or container: dokku.mariadb.ENV
cat: /var/lib/dokku/services/mariadb/ENV/ID: No such file or directory
Unable to read inspect data: json: cannot unmarshal array into Go value of type types.ContainerJSON
Unable to read inspect data: json: cannot unmarshal array into Go value of type types.ContainerJSON
Unable to read inspect data: json: cannot unmarshal array into Go value of type types.ContainerJSON
Unable to read inspect data: json: cannot unmarshal array into Go value of type types.ContainerJSON
Unable to read inspect data: json: cannot unmarshal array into Go value of type types.ContainerJSON
/var/lib/dokku/plugins/enabled/mariadb/functions: line 349: /var/lib/dokku/services/mariadb/ENV/LINKS: No such file or directory

It continues for every file in the current folder.

After some research I've found an awful folder:

root@localhost:/var/lib/dokku/services/mariadb# ls -la
total 16
drwxr-xr-x 2 dokku dokku 4096 Nov  4 16:57 *
drwxr-xr-x 4 dokku dokku 4096 Nov  4 17:35 .
drwxr-xr-x 4 root  root  4096 Nov  4 16:48 ..
drwxr-xr-x 3 dokku dokku 4096 Nov  4 17:35 web-app

That */ folder has a LINKS file without content.

I don't know how it was created.

-

.

dokku mariadb:create <service> freezes

I've traced the execution until functions#L257.

After stopping the command (Ctrl + c), the new service is frozen as "restarting" and can't be remove (it is detected as stopped), so the only way to really stop its container is sudo docker stop <id>.

dokku mariadb:logs <service> returns this (repeated more than 10 times):

error: database is uninitialized and password option is not specified
You need to specify one of MYSQL_ROOT_PASSWORD, MYSQL_ALLOW_EMPTY_PASSWORD and MYSQL_RANDOM_ROOT_PASSWORD

one service with multiples databases

As you say me in ohardy/dokku-mariadb#14 (comment), I could use one service container with multiple databases.

First of all, I tried to connect with the instance and create the database manually, but doesn't work:

MariaDB [kikoblog]> CREATE DATABASE anoter_database;
ERROR 1044 (42000): Access denied for user 'mariadb'@'%' to database 'anoter_database'
MariaDB [kikoblog]>

Seems like it is a permission issue. Any ideas?

One more thing: I want to use single container with multiple databases because my machine is limited and I think that is a good approach to avoid have multiple services running that is equivalent to use more machine resources. Can you confirm me that this premise is correct?

thanks for your time maintaining amazing projects! :)

Designate a data-dir at create or install

Description of problem

I have a separate large drive on my host server that I want to use as the data storage location for database systems. Is it possible to specify the data-dir for this plugin either at install time or at the time I create a new service?

ERROR: unable to connect

Every time I want to create a database I get an error.

Command:

$ dokku mariadb:create example-database

stdout:

Waiting for container to be ready

stderr:

ERROR: unable to connect

exit-code:

1

Systeminfo

dokku version 0.19.8

plugn: 0.3.2
  00_dokku-standard    0.19.8 enabled    dokku core standard plugin
  20_events            0.19.8 enabled    dokku core events logging plugin
  app-json             0.19.8 enabled    dokku core app-json plugin
  apps                 0.19.8 enabled    dokku core apps plugin
  builder-dockerfile   0.19.8 enabled    dokku core builder-dockerfile plugin
  builder-herokuish    0.19.8 enabled    dokku core builder-herokuish plugin
  buildpacks           0.19.8 enabled    dokku core buildpacks plugin
  certs                0.19.8 enabled    dokku core certificate management plugin
  checks               0.19.8 enabled    dokku core checks plugin
  common               0.19.8 enabled    dokku core common plugin
  config               0.19.8 enabled    dokku core config plugin
  docker-options       0.19.8 enabled    dokku core docker-options plugin
  domains              0.19.8 enabled    dokku core domains plugin
  enter                0.19.8 enabled    dokku core enter plugin
  git                  0.19.8 enabled    dokku core git plugin
  letsencrypt          0.9.1 enabled    Automated installation of let's encrypt TLS certificates
  logs                 0.19.8 enabled    dokku core logs plugin
  mariadb              1.9.1 enabled    dokku mariadb service plugin
  network              0.19.8 enabled    dokku core network plugin
  nginx-vhosts         0.19.8 enabled    dokku core nginx-vhosts plugin
  plugin               0.19.8 enabled    dokku core plugin plugin
  proxy                0.19.8 enabled    dokku core proxy plugin
  ps                   0.19.8 enabled    dokku core ps plugin
  repo                 0.19.8 enabled    dokku core repo plugin
  resource             0.19.8 enabled    dokku core resource plugin
  scheduler-docker-local 0.19.8 enabled    dokku core scheduler-docker-local plugin
  shell                0.19.8 enabled    dokku core shell plugin
  ssh-keys             0.19.8 enabled    dokku core ssh-keys plugin
  storage              0.19.8 enabled    dokku core storage plugin
  tags                 0.19.8 enabled    dokku core tags plugin
  tar                  0.19.8 enabled    dokku core tar plugin
  trace                0.19.8 enabled    dokku core trace plugin

Container log

Initializing database


PLEASE REMEMBER TO SET A PASSWORD FOR THE MariaDB root USER !
To do so, start the server, then issue the following commands:

'/usr/bin/mysqladmin' -u root password 'new-password'
'/usr/bin/mysqladmin' -u root -h 0dd5bef4825c password 'new-password'

Alternatively you can run:
'/usr/bin/mysql_secure_installation'

which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.

See the MariaDB Knowledgebase at http://mariadb.com/kb or the
MySQL manual for more instructions.

Please report any problems at http://mariadb.org/jira

The latest information about MariaDB is available at http://mariadb.org/.
You can find additional information about the MySQL part at:
http://dev.mysql.com
Consider joining MariaDB's strong and vibrant community:
https://mariadb.org/get-involved/

Database initialized
MySQL init process in progress...
2019-11-14 12:00:51 0 [Note] mysqld (mysqld 10.4.6-MariaDB-1:10.4.6+maria~bionic) starting as process 104 ...
2019-11-14 12:00:51 0 [Note] InnoDB: Using Linux native AIO
2019-11-14 12:00:51 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2019-11-14 12:00:51 0 [Note] InnoDB: Uses event mutexes
2019-11-14 12:00:51 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2019-11-14 12:00:51 0 [Note] InnoDB: Number of pools: 1
2019-11-14 12:00:51 0 [Note] InnoDB: Using SSE2 crc32 instructions
2019-11-14 12:00:51 0 [Note] mysqld: O_TMPFILE is not supported on /tmp (disabling future attempts)
2019-11-14 12:00:51 0 [Note] InnoDB: Initializing buffer pool, total size = 256M, instances = 1, chunk size = 128M
2019-11-14 12:00:51 0 [Note] InnoDB: Completed initialization of buffer pool
2019-11-14 12:00:51 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2019-11-14 12:00:51 0 [Note] InnoDB: 128 out of 128 rollback segments are active.
2019-11-14 12:00:51 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2019-11-14 12:00:51 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2019-11-14 12:00:51 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2019-11-14 12:00:51 0 [Note] InnoDB: 10.4.6 started; log sequence number 140108; transaction id 21
2019-11-14 12:00:51 0 [Note] Plugin 'FEEDBACK' is disabled.
2019-11-14 12:00:51 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2019-11-14 12:00:51 0 [Note] InnoDB: Buffer pool(s) load completed at 191114 12:00:51
2019-11-14 12:00:51 0 [Note] Reading of all Master_info entries succeeded
2019-11-14 12:00:51 0 [Note] Added new Master_info '' to hash table
2019-11-14 12:00:51 0 [Note] mysqld: ready for connections.
Version: '10.4.6-MariaDB-1:10.4.6+maria~bionic'  socket: '/var/run/mysqld/mysqld.sock'  port: 0  mariadb.org binary distribution
Warning: Unable to load '/usr/share/zoneinfo/leap-seconds.list' as time zone. Skipping it.

2019-11-14 12:02:36 0 [Note] mysqld (initiated by: unknown): Normal shutdown
2019-11-14 12:02:36 0 [Note] Event Scheduler: Purging the queue. 0 events
2019-11-14 12:02:36 0 [Note] InnoDB: FTS optimize thread exiting.
2019-11-14 12:02:36 0 [Note] InnoDB: Starting shutdown...
2019-11-14 12:02:36 0 [Note] InnoDB: Dumping buffer pool(s) to /var/lib/mysql/ib_buffer_pool
2019-11-14 12:02:36 0 [Note] InnoDB: Buffer pool(s) dump completed at 191114 12:02:36
2019-11-14 12:02:37 0 [Note] InnoDB: Shutdown completed; log sequence number 140117; transaction id 24
2019-11-14 12:02:37 0 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1"
2019-11-14 12:02:37 0 [Note] mysqld: Shutdown complete


MySQL init process done. Ready for start up.

2019-11-14 12:02:37 0 [Note] mysqld (mysqld 10.4.6-MariaDB-1:10.4.6+maria~bionic) starting as process 1 ...
2019-11-14 12:02:37 0 [Note] InnoDB: Using Linux native AIO
2019-11-14 12:02:37 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2019-11-14 12:02:37 0 [Note] InnoDB: Uses event mutexes
2019-11-14 12:02:37 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2019-11-14 12:02:37 0 [Note] InnoDB: Number of pools: 1
2019-11-14 12:02:37 0 [Note] InnoDB: Using SSE2 crc32 instructions
2019-11-14 12:02:37 0 [Note] mysqld: O_TMPFILE is not supported on /tmp (disabling future attempts)
2019-11-14 12:02:37 0 [Note] InnoDB: Initializing buffer pool, total size = 256M, instances = 1, chunk size = 128M
2019-11-14 12:02:37 0 [Note] InnoDB: Completed initialization of buffer pool
2019-11-14 12:02:37 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2019-11-14 12:02:37 0 [Note] InnoDB: 128 out of 128 rollback segments are active.
2019-11-14 12:02:37 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2019-11-14 12:02:37 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2019-11-14 12:02:37 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2019-11-14 12:02:37 0 [Note] InnoDB: 10.4.6 started; log sequence number 140117; transaction id 21
2019-11-14 12:02:37 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2019-11-14 12:02:37 0 [Note] Plugin 'FEEDBACK' is disabled.
2019-11-14 12:02:37 0 [Note] Server socket created on IP: '::'.
2019-11-14 12:02:37 0 [Note] InnoDB: Buffer pool(s) load completed at 191114 12:02:37
2019-11-14 12:02:37 0 [Note] Reading of all Master_info entries succeeded
2019-11-14 12:02:37 0 [Note] Added new Master_info '' to hash table
2019-11-14 12:02:37 0 [Note] mysqld: ready for connections.
Version: '10.4.6-MariaDB-1:10.4.6+maria~bionic'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  mariadb.org binary distribution

Start a new (removed) container

I want to call for ideas to add a new command to deploy a new container with existent configuration.

This was the case: While I was cleaning up docker containers and images, I destroyed a dokku-mariadb container that was stopped earlier. I've found that there's no command to deploy again a dokku-mariadb container. mariadb:create creates a new configuration and mariadb:start doesn't found the old container.

I ended up creating a new command mariadb:deploy that is similar to mariadb:create but it reads the actual configuration to deploy the container.

As I could end up pushing the feature to other plugins like dokku-mongo, etc, I would want to quickly discuss with you the right name and description for the command.

What do you think?

list function doesn't work

When I use the list command, I see the following errors:

alfred@vps206308:~$ dokku mariadb:list
[sudo] password for alfred:
-----> MariaDB services:
Error: No such image or container: dokku.mariadb.bootstrap.sh
cat: /var/lib/dokku/services/mariadb/bootstrap.sh/ID: No such file or directory
json: cannot unmarshal array into Go value of type types.ContainerJSON
json: cannot unmarshal array into Go value of type types.ContainerJSON
json: cannot unmarshal array into Go value of type types.ContainerJSON
json: cannot unmarshal array into Go value of type types.ContainerJSON
json: cannot unmarshal array into Go value of type types.ContainerJSON
       bootstrap.sh,  (stopped)
Error: No such image or container: dokku.mariadb.cron.sh
cat: /var/lib/dokku/services/mariadb/cron.sh/ID: No such file or directory
json: cannot unmarshal array into Go value of type types.ContainerJSON
json: cannot unmarshal array into Go value of type types.ContainerJSON
json: cannot unmarshal array into Go value of type types.ContainerJSON
json: cannot unmarshal array into Go value of type types.ContainerJSON
json: cannot unmarshal array into Go value of type types.ContainerJSON
       cron.sh,  (stopped)
Error: No such image or container: dokku.mariadb.provision.sh
cat: /var/lib/dokku/services/mariadb/provision.sh/ID: No such file or directory
json: cannot unmarshal array into Go value of type types.ContainerJSON
json: cannot unmarshal array into Go value of type types.ContainerJSON
json: cannot unmarshal array into Go value of type types.ContainerJSON
json: cannot unmarshal array into Go value of type types.ContainerJSON
json: cannot unmarshal array into Go value of type types.ContainerJSON
       provision.sh,  (stopped)
       sendy, mariadb:10.0.21 (running)

I have 1 mariadb container running:

alfred@vps206308:~$ sudo docker ps
CONTAINER ID        IMAGE                      COMMAND                  CREATED             STATUS              PORTS               NAMES
4ab5b615900b        dokku/sendy:latest         "/start web"             43 hours ago        Up 43 hours                             grave_mccarthy
d2acd3a277de        mariadb:10.0.21            "/docker-entrypoint.s"   44 hours ago        Up 44 hours         3306/tcp            dokku.mariadb.sendy
17f09423309b        dokku/placeholder:latest   "/start web"             2 days ago          Up 2 days                               evil_bartik

latest version of dokku (0.4.1) and latest version of the plugin too.

EDIT: I just noticed that bootstrap.sh, provision.sh and cron.sh are files in the current directory.

alfred@vps206308:~$ ls -l
total 12
-rw-r--r-- 1 root   root   3094 Sep 30 23:40 bootstrap.sh
-rwxr-xr-x 1 alfred alfred  353 Oct  1 17:16 cron.sh
-rwxr-xr-x 1 alfred alfred 1737 Sep 30 23:40 provision.sh

Locking tables

The export command (mysql dump) by default locks all the tables. For a big export on a large site this can cause the site to become unresponsive. Although locking tables protects data consistency, it's often better to risk that and not kill the site during a backup.

So I propose changing https://github.com/dokku/dokku-mariadb/blob/master/functions#L64

from

docker exec "$SERVICE_NAME" mysqldump --user=mariadb --password="$PASSWORD" "$SERVICE"

to

docker exec "$SERVICE_NAME" mysqldump --lock-tables=false --user=mariadb --password="$PASSWORD" "$SERVICE"

Thoughts?

If it helps, we did it on the previous mariadb plugin - Kloadut/dokku-md-plugin@91fb68e

[Question] How to connect using GUI Client

Supposing this URI:

DSN: mysql://mariadb:PASSWORD@dokku-mariadb-kikoblog:3306/kikoblog

And using sequel pro it should be looks like:

screen shot 2016-01-07 at 00 53 25

but something is failling...

Unable to connect to host 172.17.0.1 because the port connection via SSH was refused.

Please ensure that your MySQL host is set up to allow TCP/IP connections (no --skip-networking) and is configured to allow connections from the host you are tunnelling via.

You may also want to check the port is correct and that you have the necessary privileges.

Checking the error detail will show the SSH debug log which may provide more details.

MySQL said: Lost connection to MySQL server at 'reading initial communication packet', system error: 0

How I check the mariadb internal IP? Like dokku-alt/dokku-alt#117

db backup script

could you please provide a db backup script which could dump all the databases?

Shared database container?

The plugin seems to work fine as is, but I was hoping for a slightly different approach. I'd like to model the database container/engine as a separate entity from the service, and allow that one container could support multiple services. I.e. one database engine/container could support multiple services. The advantage of this approach would be that it would require much less RAM for the mariadb container(s), especially in the case of having many web services each with infrequent use.

Given that most commands reference the service they are interested in, I don't imagine much would have to change in the interface. Mostly just an optional parameter on mariadb:create to name the engine, and some implications for how the configuration and data directories are laid out. What else?

Have I misunderstood something about how I could use the existing implementation to acheive this? Would you be interested in extending the official dokku plugin to support this sort of usage? I haven't scoped this out much yet, but if I helped with implementation, would you be OK with supporting this over time?

I don't like the idea of just having different apps use different databases within the one service, unless I can insulate the apps from each others' access details, but maybe there's another approach to be had there.

Couldn't destroy a service when the app is destroyed

When I tried to destroy MariaDB service, it comes back and says, "linked app can't be deleted". But the app is already destroyed and when I tried to unlink, it says "app is not available to unlink".

So, I've to create the app again just to destroy MariaDB service.

1.0 release

This plugin should be considered as ready for a 1.0 release.

Restore from filesys backup

When you have big sql file backups it takes like forever to restore them, restoring the MySQL/MariaDB file system is much faster. Probably the password needs to be set again, but just archiving the /var/lib/mysql directory is way faster than restoring a sql file.

How to override plugin alias

Currently my env variables in my app look like DOKKU_MARIADB_APP_NAME_DB_PORT. I'm looking to override the prefixed alias DOKKU_MARIADB, because Symfony framework only listens to env variables prefixed with SYMFONY__.

Is it the case that this prefix comes from PLUGIN_ALT_ALIAS in the config? I'm struggling a bit to override the PLUGIN_ALT_ALIAS env variable from the config. How would you do that?
With dokku config:set ?

Database stuck in 'Restarting'

I have a mariadb service stuck in 'Restarting'. Issue persists on reboot. Everything on apt is up-to-date. Fresh installation on DigitalOcean Ubuntu 16.04. No other software installed apart from dokku and its dependencies.

dokku plugins installed:

  • letsencrypt
  • mariadb
  • postgres

There is just 1 other mariadb service that is running and works well.


dokku mariadb:stop

! Service is already stopped

dokku mariadb:start

-----> Starting container
docker: Error response from daemon: Conflict. The container name "/dokku.mariadb.bigtime-db-staging" is already in use by container "fa87f9e256425729f41155318041f30b7e37578637cd51fa178c95833ca4e858". You have to remove (or rename) that container to be able to reuse that name.
See 'docker run --help'.

dokku mariadb:destroy --force

-----> Deleting [redacted db name]
Deleting container data
! Service is already stopped
Removing container
Error response from daemon: You cannot remove a restarting container fa87f9e256425729f41155318041f30b7e37578637cd51fa178c95833ca4e858. Stop the container before attempting removal or force remove

dokku mariadb:logs
https://gist.github.com/shrmnk/405bc8bc2d1d47a8892c15b868923503

Error while trying to setup backup - Container is restarting

Hi,

I am just getting started with Dokku and MariaDb, and I tried to take a backup, but got the error:

Error response from daemon: Container ac223eb28ab6936df0b073772efbf34a281da0c2eXXXXXXXXXXXXXXXXX is restarting, wait until the container is running

Also, the error messages is messing up the console:

root@dokku:~# dokku mariadb:backup appmakers appmakers2
Error response from daemon: Container ac223eb28ab6936df0b073772efbf34a281da0c2eXXXXXXXXXXXXXXXXX is restarting, wait until the container is running
                                                                                                                                                        root@dokku:~# dokku mariadb:backup appmakers appmakers2
                                                                                                                                                                                                                Error response from daemon: Container ac223eb28ab6936df0b073772efbf34a281da0c2eXXXXXXXXXXXXXXXXX is restarting, wait until the container is running
                                                                                                                                                    root@dokku:~# dokku mariadb:backup appmakers appmakers2
                                                                                                                                                                                                            Error response from daemon: Container ac223eb28ab6936df0b073772efbf34a281da0c2eXXXXXXXXXXXXXXXXX is restarting, wait until the container is running
                                                                                                                                                root@dokku:~#

Any help would be gratly appreciated :)

Kills itself when not enough memory?

Looks like Dokku might kill the DB when there is not enough RAM to run all the containers (?). I have one mariadb container and one container with my app on 1GB Dokku DigitalOcean machine.

That's the log output I'm getting:

2016-04-20 15:08:41 140161145636800 [Note] mysqld (mysqld 10.1.10-MariaDB-1~jessie) starting as process 1 ...
2016-04-20 15:08:41 140161145636800 [Note] InnoDB: Using mutexes to ref count buffer pool pages
2016-04-20 15:08:41 140161145636800 [Note] InnoDB: The InnoDB memory heap is disabled
2016-04-20 15:08:41 140161145636800 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2016-04-20 15:08:41 140161145636800 [Note] InnoDB: Memory barrier is not used
2016-04-20 15:08:41 140161145636800 [Note] InnoDB: Compressed tables use zlib 1.2.8
2016-04-20 15:08:41 140161145636800 [Note] InnoDB: Using Linux native AIO
2016-04-20 15:08:41 140161145636800 [Note] InnoDB: Using SSE crc32 instructions
2016-04-20 15:08:41 140161145636800 [Note] InnoDB: Initializing buffer pool, size = 256.0M
InnoDB: mmap(276824064 bytes) failed; errno 12
2016-04-20 15:08:41 140161145636800 [ERROR] InnoDB: Cannot allocate memory for the buffer pool
2016-04-20 15:08:41 140161145636800 [ERROR] Plugin 'InnoDB' init function returned error.
2016-04-20 15:08:41 140161145636800 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2016-04-20 15:08:41 140161145636800 [Note] Plugin 'FEEDBACK' is disabled.
2016-04-20 15:08:41 140161145636800 [ERROR] Unknown/unsupported storage engine: InnoDB
2016-04-20 15:08:41 140161145636800 [ERROR] Aborting

The question is:
How to prevent the behaviour? Shouldn't be some fallback in that case?

Diagnosing database status

What I am trying to do

Set up a vanilla Wordpress 4.5 blog with MariaDB

What is not working

Error establishing a database connection

It was working a few days ago, before the PHP buildpack v95 fiasco, could this be connected?

I have an unchanged Wordpress 4.5 fork that I deploy as blog

I create a dokku app, a database and link them:

$ dokku apps:create blog
$ dokku mariadb:create blog
$ dokku mariadb:link blog blog

#=> DATABASE_URL: mysql://mariadb:31fd7198d2f22978@dokku-mariadb-blog:3306/blog

I navigate to http://blog.my.domain.com to begin the Wordpress setup process, all is well. I proceed to database detail entering:

Database Name = blog
Username = mariadb
Password = 31fd7198d2f22978
Database Host = dokku-mariadb-blog:3306
Table Prefix = _wp

I click to submit these settings and Wordpress informs me that it was unable to connect to the database.

What I have tried:

Connecting to the db, no luck, access denied

$ dokku mariadb:connect blog
#=> ERROR 1045 (28000): Access denied for user 'mariadb'@'localhost' (using password: YES)

Reading the DB logs, there are some errors, but nothing stands out for me

dokku mariadb:logs blog

output gist

Restarting, stop+starting the DB

No luck.

Unlinking, destroying, rebuilding the db

Nope, new DATABASE_URL does not work either.

What is needed

A reliable way to tell if the database is absolutely definitely running or down.
I have no idea what is going wrong, it worked a few days ago. Perhaps I need to upgrade database adapter and/or plugin version?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.