Start MSQL Schema and config the YML for docker

the 'special' words are in properties file.
This commit is contained in:
bryce
2024-11-05 21:40:18 +13:00
parent 8a5488f331
commit e31b5c4a63
3 changed files with 13 additions and 29 deletions

View File

@@ -3,13 +3,13 @@ CREATE DATABASE bricklog_db
GO
-- Grant Permissions & Flush
GRANT ALL PERMISSIONS TO bl_server IDENTIFIED BY l3g0D3t41l$h3r3
GRANT ALL PERMISSIONS TO bl_server
GO
-- Create a new table called 'collection_table' in schema 'bricklog_db'
-- Create the table in the specified schema
CREATE TABLE lego_builds (
id INT NOT NULL PRIMARY KEY, -- Lego Build ID can be used here (hence not Auto_increment)
legoId INT NOT NULL PRIMARY KEY, -- Lego Build ID can be used here (hence not Auto_increment)
builder VARCHAR(255) NOT NULL,
buildName VARCHAR(255) NOT NULL,
is_kitset BOOLEAN NOT NULL,

View File

@@ -1,29 +1,12 @@
version: '0.1'
services:
bricklog-server:
bricklog_server:
container_name: BrickLog_Server
build:
context: ./BrickLog-Server
context: .
dockerfile: Dockerfile
ports:
- "8080:8080" # Adjust based on your server's port
environment:
- SPRING_DATASOURCE_URL=jdbc:mariadb://db:3306/bricklog
- SPRING_DATASOURCE_USERNAME=bl_server
- SPRING_DATASOURCE_PASSWORD=l3g0D3t41l$h3r3
depends_on:
- db # Ensure the database starts before the server
db:
image: mysql:8.0
restart: always
environment:
MYSQL_DATABASE: bricklog
MYSQL_ROOT_PASSWORD: root # Set a strong password in production
ports:
- "3306:3306" # Expose MySQL port
volumes:
- db_data:/var/lib/mysql # Persist database data
volumes:
db_data:
- "8080:8080" # Expose the application on port 8080
extra_hosts:
- "host.docker.internal:host-gateway" # Enables access to the host's MariaDB instance

View File

@@ -1,7 +1,8 @@
# MariaDB Configuration
spring.datasource.url=jdbc:mariadb://localhost:3306/bricklog_db
spring.datasource.username=your_db_username
spring.datasource.password=your_db_password
# Database configuration
spring.datasource.url=jdbc:mariadb://host.docker.internal:3306/bricklog
spring.datasource.username=bricklog
spring.datasource.password=your_password_here
# JPA settings
spring.jpa.hibernate.ddl-auto=update # Creates tables automatically; set to 'none' in production if not needed