diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 09d475b..4af7ec1 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -21,4 +21,4 @@ jobs: uses: gradle/actions/setup-gradle@v3 - name: Build Gateway - run: (cd botalka && ./gradlew :build) + run: (./gradlew :botalka:build) diff --git a/.gitignore b/.gitignore index 22509b8..1405414 100644 --- a/.gitignore +++ b/.gitignore @@ -23,4 +23,44 @@ hs_err_pid* replay_pid* +### IntelliJ IDEA ### .idea +*.iws +*.iml +*.ipr +out/ +!**/src/main/**/out/ +!**/src/test/**/out/ + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ + +### VS Code ### +.vscode/ + +### Kotlin ### +.kotlin + +### STS ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache +bin/ +!**/src/main/**/bin/ +!**/src/test/**/bin/ + +# Other +HELP.md +.gradle +build/ +!gradle/wrapper/gradle-wrapper.jar +!**/src/main/**/build/ +!**/src/test/**/build/ diff --git a/README.md b/README.md index 40bdf57..57117f4 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,11 @@ # Learning Management System A simple learning management system. + +## Build & Run + +```bash +gradle :botalka:build +docker compose down +docker compose up --build --force-recreate +``` diff --git a/botalka/.gitignore b/botalka/.gitignore deleted file mode 100644 index 5a979af..0000000 --- a/botalka/.gitignore +++ /dev/null @@ -1,40 +0,0 @@ -HELP.md -.gradle -build/ -!gradle/wrapper/gradle-wrapper.jar -!**/src/main/**/build/ -!**/src/test/**/build/ - -### STS ### -.apt_generated -.classpath -.factorypath -.project -.settings -.springBeans -.sts4-cache -bin/ -!**/src/main/**/bin/ -!**/src/test/**/bin/ - -### IntelliJ IDEA ### -.idea -*.iws -*.iml -*.ipr -out/ -!**/src/main/**/out/ -!**/src/test/**/out/ - -### NetBeans ### -/nbproject/private/ -/nbbuild/ -/dist/ -/nbdist/ -/.nb-gradle/ - -### VS Code ### -.vscode/ - -### Kotlin ### -.kotlin diff --git a/botalka/Dockerfile b/botalka/Dockerfile new file mode 100644 index 0000000..fbbd7d5 --- /dev/null +++ b/botalka/Dockerfile @@ -0,0 +1,5 @@ +FROM eclipse-temurin:21-jdk-alpine + +COPY build/libs/botalka-0.0.1.jar /botalka.jar + +ENTRYPOINT ["java", "-jar", "/botalka.jar"] \ No newline at end of file diff --git a/botalka/build.gradle.kts b/botalka/build.gradle.kts index 27c898f..2cc49c0 100644 --- a/botalka/build.gradle.kts +++ b/botalka/build.gradle.kts @@ -155,7 +155,7 @@ tasks.runKtlintCheckOverMainSourceSet { detekt { buildUponDefaultConfig = true allRules = false - config.setFrom(file("$projectDir/../config/detekt.yml")) + config.setFrom(file("$rootDir/config/detekt.yml")) } tasks.withType().configureEach { @@ -194,9 +194,8 @@ koverReport { } jooq { - val schemaSql = "src/main/resources/database/schema.sql" + val schemaSql = "$projectDir/src/main/resources/database/schema.sql" - version = jooqVersion executions { create("main") { configuration { diff --git a/botalka/docker-compose.yml b/botalka/docker-compose.yml deleted file mode 100644 index 3d8c659..0000000 --- a/botalka/docker-compose.yml +++ /dev/null @@ -1,14 +0,0 @@ -version: '3.8' -services: - database: - container_name: lms-database - image: postgres - restart: always - ports: - - "5432:5432" - volumes: - - ./src/main/resources/database:/docker-entrypoint-initdb.d - environment: - POSTGRES_DB: postgres - POSTGRES_USER: postgres - POSTGRES_PASSWORD: postgres diff --git a/botalka/gradle/wrapper/gradle-wrapper.properties b/botalka/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index 97f9ad6..0000000 --- a/botalka/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright 2012-2024 the original author or authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip -networkTimeout=10000 -validateDistributionUrl=true -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists diff --git a/botalka/settings.gradle.kts b/botalka/settings.gradle.kts deleted file mode 100644 index 5449d1b..0000000 --- a/botalka/settings.gradle.kts +++ /dev/null @@ -1 +0,0 @@ -rootProject.name = "botalka" diff --git a/botalka/src/main/resources/application.yml b/botalka/src/main/resources/application.yml index a3951f1..82cd9f0 100644 --- a/botalka/src/main/resources/application.yml +++ b/botalka/src/main/resources/application.yml @@ -2,7 +2,7 @@ spring: application: name: botalka r2dbc: - url: r2dbc:postgresql://localhost:5432/postgres + url: r2dbc:postgresql://database:5432/postgres username: postgres password: postgres server: diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..c64c2e2 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,30 @@ +version: '3.8' +services: + botalka: + container_name: lms-botalka + build: + context: botalka + dockerfile: Dockerfile + image: botalka:latest + ports: + - "8080:8080" + networks: + - lms-network + database: + container_name: lms-database + image: postgres + restart: always + ports: + - "5432:5432" + volumes: + - ./botalka/src/main/resources/database:/docker-entrypoint-initdb.d + environment: + POSTGRES_DB: postgres + POSTGRES_USER: postgres + POSTGRES_PASSWORD: postgres + networks: + - lms-network +networks: + lms-network: + driver: bridge + diff --git a/botalka/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar similarity index 100% rename from botalka/gradle/wrapper/gradle-wrapper.jar rename to gradle/wrapper/gradle-wrapper.jar diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..a80b22c --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,7 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip +networkTimeout=10000 +validateDistributionUrl=true +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/botalka/gradlew b/gradlew similarity index 100% rename from botalka/gradlew rename to gradlew diff --git a/botalka/gradlew.bat b/gradlew.bat similarity index 90% rename from botalka/gradlew.bat rename to gradlew.bat index 6689b85..7101f8e 100644 --- a/botalka/gradlew.bat +++ b/gradlew.bat @@ -43,11 +43,11 @@ set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 if %ERRORLEVEL% equ 0 goto execute -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail @@ -57,11 +57,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe if exist "%JAVA_EXE%" goto execute -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail diff --git a/settings.gradle.kts b/settings.gradle.kts new file mode 100644 index 0000000..4010ea4 --- /dev/null +++ b/settings.gradle.kts @@ -0,0 +1,7 @@ +plugins { + id("org.gradle.toolchains.foojay-resolver-convention") version "0.7.0" +} + +rootProject.name = "lms" + +include("botalka")