Use root db user by default

This commit is contained in:
P0nk
2024-05-09 22:08:28 +02:00
parent 7d42870abd
commit 0eb78e2d9e
4 changed files with 17 additions and 11 deletions

View File

@@ -4,15 +4,21 @@
#
# Cosmic JAR creation stage
#
FROM maven:3.9.1-eclipse-temurin-17 AS jar
FROM maven:3.9.6-amazoncorretto-21 AS jar
# Build in a separated location which won't have permissions issues.
WORKDIR /opt/cosmic
# Any changes to the pom will affect the entire build, so it should be copied first.
COPY pom.xml ./pom.xml
# Grab all the dependencies listed in the pom early, since it prevents changes to source code from requiring a complete re-download.
# Skip compiling tests since we don't want all the dependecies to be downloaded.
RUN mvn -f ./pom.xml clean dependency:go-offline -Dmaven.test.skip -T 1C
# Skip compiling tests since we don't want all the dependencies to be downloaded.
# RUN mvn -f ./pom.xml clean dependency:go-offline -Dmaven.test.skip -T 1C
# TODO: The above command stopped working as of Java 21 upgrade due to:
# Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:3.6.1:go-offline (default-cli) on project Cosmic: org.eclipse.aether.resolution.DependencyResolutionException: The following artifacts could
# not be resolved: io.netty:netty-tcnative:jar:${os.detected.classifier}:2.0.65.Final (absent): Could not find artifact io.netty:netty-tcnative:jar:${os.detected.classifier}:2.0.65.Final in central (https://repo.maven.apache.org/maven2) -> [Help 1]
# Source code changes may not change dependencies, so it can go last.
# Skip compiling tests since we don't want all the dependecies to be downloaded for plugins.
COPY src ./src
@@ -21,7 +27,7 @@ RUN mvn -f ./pom.xml clean package -Dmaven.test.skip -T 1C
#
# Server creation stage
#
FROM eclipse-temurin:17.0.6_10-jre
FROM amazoncorretto:21
# Host the server in a location that won't have permissions issues.
WORKDIR /opt/server

View File

@@ -161,8 +161,8 @@ server:
#Database Configuration
DB_URL_FORMAT: "jdbc:mysql://%s:3306/cosmic" # If the docker ENV for DB_HOST is anything but "db", this string format should be changed from 3306 to 3307 (or whichever port it was changed to in docker)
DB_HOST: "localhost"
DB_USER: "cosmic_server"
DB_PASS: "snailshell"
DB_USER: "root"
DB_PASS: ""
INIT_CONNECTION_POOL_TIMEOUT: 90 # Seconds
#Login Configuration

View File

@@ -21,12 +21,11 @@ services:
DB_HOST: "db" ## Remember if this is present it will OVERRIDE the host in the config.yaml, if you put here anything other than db, you'll need to change the config.yaml jdbc string to port 3307, and not port 3306
db:
image: mysql:8.0.23
image: mysql:8.4.0
environment:
MYSQL_RANDOM_ROOT_PASSWORD: "true"
MYSQL_DATABASE: "cosmic"
MYSQL_USER: "cosmic_server"
MYSQL_PASSWORD: "snailshell"
MYSQL_ROOT_PASSWORD: ""
MYSQL_ALLOW_EMPTY_PASSWORD: yes
ports:
- "3307:3306"
volumes:

View File

@@ -81,8 +81,9 @@ public class DatabaseConnection {
return true;
}
log.info("Initializing connection pool...");
final HikariConfig config = getConfig();
log.info("Initializing database connection pool. Connecting to:'{}' with user:'{}'", config.getJdbcUrl(),
config.getUsername());
Instant initStart = Instant.now();
try {
dataSource = new HikariDataSource(config);