feat: allow modifying mariadb connection
This commit is contained in:
committed by
Aditya Chandel
parent
edb31b77ff
commit
5068b9bae4
@@ -48,7 +48,9 @@ services:
|
|||||||
- PUID=1000
|
- PUID=1000
|
||||||
- PGID=1000
|
- PGID=1000
|
||||||
- TZ=Etc/UTC
|
- TZ=Etc/UTC
|
||||||
- MYSQL_ROOT_PASSWORD=your_secure_password # Use a strong password; must match the one in the mariadb service
|
- DATABASE_URL=jdbc:mariadb://mariadb:3306/booklore
|
||||||
|
- DATABASE_USERNAME=booklore
|
||||||
|
- DATABASE_PASSWORD=your_secure_password # Use a strong password; must match the one in the mariadb service
|
||||||
depends_on:
|
depends_on:
|
||||||
mariadb:
|
mariadb:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
@@ -66,7 +68,10 @@ services:
|
|||||||
- PUID=1000
|
- PUID=1000
|
||||||
- PGID=1000
|
- PGID=1000
|
||||||
- TZ=Etc/UTC
|
- TZ=Etc/UTC
|
||||||
- MYSQL_ROOT_PASSWORD=your_secure_password # Use a strong password; must match the one in the booklore service
|
- MYSQL_ROOT_PASSWORD=your_secure_password # Use a strong password
|
||||||
|
- MYSQL_DATABASE=booklore
|
||||||
|
- MYSQL_USER=booklore
|
||||||
|
- MYSQL_PASSWORD=your_secure_password # Use a strong password; must match the one in the booklore service
|
||||||
volumes:
|
volumes:
|
||||||
- /your/local/path/to/mariadb/config:/config
|
- /your/local/path/to/mariadb/config:/config
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
@@ -107,6 +112,19 @@ Password: admin123
|
|||||||
> ⚠️ **Important:**
|
> ⚠️ **Important:**
|
||||||
> You’ll be prompted to change the default password upon your first login to ensure better security.
|
> You’ll be prompted to change the default password upon your first login to ensure better security.
|
||||||
|
|
||||||
|
## Configuration
|
||||||
|
|
||||||
|
The following environment variables can be configured:
|
||||||
|
|
||||||
|
| Variable Name | Description | Default Value |
|
||||||
|
|-------------------|---------------------------|---------------------------------------------------------------------|
|
||||||
|
| DATABASE_URL | JDBC connection URL | `jdbc:mariadb://${DATABASE_HOST}:${DATABASE_PORT}/${DATABASE_NAME}` |
|
||||||
|
| DATABASE_HOST | Database hostname | `mariadb` |
|
||||||
|
| DATABASE_PORT | Database port | `3306` |
|
||||||
|
| DATABASE_NAME | Database name | `booklore` |
|
||||||
|
| DATABASE_USERNAME | Database username for app | `root` |
|
||||||
|
| DATABASE_PASSWORD | Database password for app | **required** |
|
||||||
|
|
||||||
## Tech Stack
|
## Tech Stack
|
||||||
|
|
||||||
- **Backend:** Spring Boot (Java)
|
- **Backend:** Spring Boot (Java)
|
||||||
|
|||||||
@@ -14,12 +14,10 @@ spring:
|
|||||||
application:
|
application:
|
||||||
name: booklore-api
|
name: booklore-api
|
||||||
datasource:
|
datasource:
|
||||||
driver-class-name: org.mariadb.jdbc.Driver
|
url: ${DATABASE_URL:jdbc:mariadb://${DATABASE_HOST:${DB_HOST:mariadb}}:${DATABASE_PORT:3306}/${DATABASE_NAME:booklore}?createDatabaseIfNotExist=true}
|
||||||
url: jdbc:mariadb://${DB_HOST:mariadb}:3306/booklore?createDatabaseIfNotExist=true
|
username: ${DATABASE_USERNAME:root}
|
||||||
username: root
|
password: ${DATABASE_PASSWORD:${MYSQL_ROOT_PASSWORD}}
|
||||||
password: ${MYSQL_ROOT_PASSWORD}
|
|
||||||
jpa:
|
jpa:
|
||||||
database-platform: org.hibernate.dialect.MariaDBDialect
|
|
||||||
hibernate:
|
hibernate:
|
||||||
naming:
|
naming:
|
||||||
physical-strategy: org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
|
physical-strategy: org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
|
||||||
|
|||||||
@@ -13,6 +13,9 @@ TZ=Etc/UTC # Change this to your timezone (e.g., America/New_York, Asia/Kolk
|
|||||||
# Database Credentials (Replace with a secure password)
|
# Database Credentials (Replace with a secure password)
|
||||||
# This password is used by MariaDB. Make sure to keep it secure.
|
# This password is used by MariaDB. Make sure to keep it secure.
|
||||||
MYSQL_ROOT_PASSWORD=your_secure_password
|
MYSQL_ROOT_PASSWORD=your_secure_password
|
||||||
|
MYSQL_DATABASE=booklore
|
||||||
|
MYSQL_USER=booklore
|
||||||
|
MYSQL_PASSWORD=your_secure_password
|
||||||
|
|
||||||
# Paths for Docker Volumes (Update these paths as per your system)
|
# Paths for Docker Volumes (Update these paths as per your system)
|
||||||
# These paths store persistent data for Booklore and MariaDB.
|
# These paths store persistent data for Booklore and MariaDB.
|
||||||
|
|||||||
@@ -5,6 +5,10 @@ services:
|
|||||||
container_name: booklore_server
|
container_name: booklore_server
|
||||||
env_file:
|
env_file:
|
||||||
- .env
|
- .env
|
||||||
|
environment:
|
||||||
|
- DATABASE_URL=jdbc:mariadb://mariadb:3306/${MYSQL_DATABASE}
|
||||||
|
- DATABASE_USERNAME=${MYSQL_USER}
|
||||||
|
- DATABASE_PASSWORD=${MYSQL_PASSWORD}
|
||||||
depends_on:
|
depends_on:
|
||||||
mariadb:
|
mariadb:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
@@ -15,7 +19,7 @@ services:
|
|||||||
- ${BOOKLORE_BOOKS_PATH}:/books
|
- ${BOOKLORE_BOOKS_PATH}:/books
|
||||||
|
|
||||||
mariadb:
|
mariadb:
|
||||||
image: lscr.io/linuxserver/mariadb:11.4.5
|
image: lscr.io/linuxserver/mariadb:11.4
|
||||||
container_name: booklore_mariadb
|
container_name: booklore_mariadb
|
||||||
env_file:
|
env_file:
|
||||||
- .env
|
- .env
|
||||||
|
|||||||
Reference in New Issue
Block a user