drago-ex / project-docker-db
The package extends the Drago Project to include mysqli database on docker.
Package info
github.com/drago-ex/project-docker-db
Type:drago-tools-resource
pkg:composer/drago-ex/project-docker-db
Requires
- php: >=8.3 <9
- drago-ex/database: ^4.0 || ^5.0
- drago-ex/project-docker: ^1.1
Requires (Dev)
- drago-ex/project-tools: ^1.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
A MariaDB database in Docker for Drago Project, the mysqli extension in the PHP image and the database connection of the application (Dibi).
Requirements
- PHP >= 8.3, < 9
- Drago Project with Project Docker
- Docker
Installation
composer require drago-ex/project-docker-db
Project Tools copies docker-compose.override.yaml, the Dockerfile
of the database image and local/db.neon into the project. Build the images again afterwards
(npm run docker:build).
Usage
- The database
appruns as the servicedb; the connection of the application is inlocal/db.neon(keep it out of git).docker compose watch(npm run docker:dev) copies its changes into the container. - The data are in the Docker volume
db-data.docker compose downkeeps them,docker compose down --volumesdeletes them. - The database listens on
127.0.0.1:6033, so tools on your computer can connect to it.DB_PORT=6033publishes it on every interface; Docker bypasses firewalls such asufw, so never do so on a server.
Development Only
The user and passwords (super/pass, root root) in docker-compose.override.yaml and local/db.neon are
for local development. Change them before the setup runs anywhere else; the docker:production script uses the
same files.