matthewbaggett/wait-for-mysql

v1.4 2023-12-07 00:07 UTC

This package is auto-updated.

Last update: 2024-04-07 00:58:36 UTC


README

Package that provides a shell script to wait for mysql/mariadb and postgres to be ready.

Does not actually contain any PHP.

Test

Usage

export MYSQL_HOST=localhost
export MYSQL_PORT=3306
vendor/bin/wait-for-mysql  

Or using a DSN:

export MYSQL_DSN=mysql://user:password@hostname:port/database
vendor/bin/wait-for-mysql  

MySQL/MariaDB Flavour

Input Environment Variables Example Input Default
MYSQL_HOST
  • MYSQL_HOST
  • MYSQL_HOSTNAME
  • MARIADB_HOST
  • MARIADB_HOSTNAME
hostname localhost
MYSQL_PORT
  • MYSQL_PORT
  • MARIADB_PORT
3306 3306
MYSQL_DSN
  • MYSQL_DSN
  • MYSQL_URL
  • DATABASE_DSN
  • DATABASE_URL
mysql://user:password@hostname:port/database

Postgres Flavour

There's also a postgres flavour, wait-for-postgres which has similar usage and environment variables as above.

Input Environment Variables Example Input Default
POSTGRES_HOST
  • POSTGRES_HOST
  • POSTGRES_HOSTNAME
  • PGSQL_HOST
  • PGSQL_HOSTNAME
hostname localhost
POSTGRES_PORT
  • POSTGRES_PORT
  • PGSQL_PORT
5432 5432
POSTGRES_DSN
  • POSTGRES_DSN
  • POSTGRES_URL
  • PGSQL_DSN
  • PGSQL_DSN
  • DATABASE_DSN
  • DATABASE_URL
postgres://user:password@hostname:port/database

MongoDB Flavour

There's also a mongodb flavour:

Input Environment Variables Example Input Default
MONGODB_HOST
  • MONGODB_HOST
  • MONGODB_HOSTNAME
hostname localhost
MONGODB_PORT
  • MONGODB_PORT
27017 27017
MONGODB_DSN
  • MONGODB_DSN
  • MONGODB_URL
  • DATABASE_DSN
  • DATABASE_URL
mongodb://user:password@hostname:port/database
MONGODB_DATABASE
  • MONGODB_DATABASE
database
MONGODB_USERNAME
  • MONGODB_USERNAME
username
MONGODB_PASSWORD
  • MONGODB_PASSWORD
password

Redis Flavour

There's also a redis flavour:

Input Environment Variables Example Input Default
REDIS_HOST
  • REDIS_HOST
  • REDIS_HOSTNAME
hostname redis
REDIS_PORT
  • REDIS_PORT
6379 6379
REDIS_PASSWORD
  • REDIS_PASSWORD
password

DynamoDB Flavour

There's also a dynamodb flavour:

Input Environment Variables Example Input Default
DYNAMODB_ENDPOINT
  • DYNAMODB_ENDPOINT
http://dynamo:8000