diff --git a/.idea/dataSources.xml b/.idea/dataSources.xml
new file mode 100644
index 0000000..0231b00
--- /dev/null
+++ b/.idea/dataSources.xml
@@ -0,0 +1,17 @@
+
+
+
+
+ postgresql
+ true
+ org.postgresql.Driver
+ jdbc:postgresql://localhost:5123/protego_totalum
+
+
+
+
+
+ $ProjectFileDir$
+
+
+
\ No newline at end of file
diff --git a/.idea/runConfigurations/ProtegoTotalumBotApp.xml b/.idea/runConfigurations/ProtegoTotalumBotApp.xml
deleted file mode 100644
index 955d87c..0000000
--- a/.idea/runConfigurations/ProtegoTotalumBotApp.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/buildSrc/src/main/kotlin/Dependencies.kt b/buildSrc/src/main/kotlin/Dependencies.kt
index fd4d58f..b9bec99 100644
--- a/buildSrc/src/main/kotlin/Dependencies.kt
+++ b/buildSrc/src/main/kotlin/Dependencies.kt
@@ -8,7 +8,6 @@ object Groups {
// Базы данных
const val POSTGRES = "org.postgresql"
const val LIQUIBASE = "org.liquibase"
- const val R2DBC = "org.postgresql"
// Reactor
const val NETTY = "io.netty"
@@ -20,9 +19,10 @@ object Groups {
const val JACKSON = "com.fasterxml.jackson.module"
// Kotlin
- const val KTX = "org.jetbrains.kotlinx"
+ private const val JET_BRAINS = "org.jetbrains"
+ const val KTX = "$JET_BRAINS.kotlinx"
+ const val KT = "$JET_BRAINS.kotlin"
const val REACTOR_KT = "io.projectreactor.kotlin"
- const val KT = "org.jetbrains.kotlin"
}
/**
@@ -33,7 +33,7 @@ object Artifacts {
const val SPRING_BOOT = "spring-boot"
const val SPRING_BOOT_STARTER = "${SPRING_BOOT}-starter"
const val SPRING_BOOT_DATA_R2DBC = "${SPRING_BOOT}-starter-data-r2dbc"
- const val SPRING_BOOT_DATA_WEBFLUX = "${SPRING_BOOT}-starter-webflux"
+ const val SPRING_BOOT_STARTER_WEBFLUX = "${SPRING_BOOT}-starter-webflux"
// Базы данных
const val POSTGRES = "postgresql"
@@ -85,10 +85,10 @@ object Libs {
const val SPRING_BOOT = "${Groups.SPRING_BOOT}:${Artifacts.SPRING_BOOT}"
const val SPRING_BOOT_STARTER = "${Groups.SPRING_BOOT}:${Artifacts.SPRING_BOOT_STARTER}"
const val SPRING_BOOT_DATA_R2DBC = "${Groups.SPRING_BOOT}:${Artifacts.SPRING_BOOT_DATA_R2DBC}"
- const val SPRING_BOOT_DATA_WEBFLUX = "${Groups.SPRING_BOOT}:${Artifacts.SPRING_BOOT_DATA_WEBFLUX}"
+ const val SPRING_BOOT_STARTER_WEBFLUX = "${Groups.SPRING_BOOT}:${Artifacts.SPRING_BOOT_STARTER_WEBFLUX}"
// Базы данных
- const val PG_R2DBC = "${Groups.R2DBC}:${Artifacts.PG_R2DBC}:${Versions.PG_R2DBC}"
+ const val PG_R2DBC = "${Groups.POSTGRES}:${Artifacts.PG_R2DBC}:${Versions.PG_R2DBC}"
const val POSTGRES = "${Groups.POSTGRES}:${Artifacts.POSTGRES}"
const val LIQUIBASE = "${Groups.LIQUIBASE}:${Artifacts.LIQUIBASE}"
diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml
index 4b7ee41..d061c4d 100644
--- a/docker/docker-compose.yml
+++ b/docker/docker-compose.yml
@@ -1,37 +1,12 @@
services:
database:
- container_name: $APPLICATION_NAME-postgres
- build:
- context: ./postgres
- dockerfile: ./Dockerfile
+ container_name: db-postgres
+ image: postgres:16-alpine
ports:
- ${PG_PORT}:5432
environment:
POSTGRES_DB: $PG_DBNAME
POSTGRES_USER: $PG_USER
POSTGRES_PASSWORD: $PG_PASSWORD
- networks:
- - protego-totalum-network
- protego-totalum-bot:
- container_name: $APPLICATION_NAME-bot
- depends_on:
- - database
- build:
- context: ../pt-discord
- dockerfile: ./Dockerfile
- ports:
- - "8080:8080"
- command:
- - protego-totalum-bot.jar
- environment:
- PROTEGO_TOTALUM_DB_HOST: database
- PROTEGO_TOTALUM_DB_PORT: 5432
- networks:
- - protego-totalum-network
- env_file:
- - ignore.env
-
-networks:
- protego-totalum-network:
- name: $APPLICATION_NAME-network
- external: false
\ No newline at end of file
+ volumes:
+ - ./postgres/create_schemas.sql:/docker-entrypoint-initdb.d/create_schemas.sql
\ No newline at end of file
diff --git a/docker/postgres/Dockerfile b/docker/postgres/Dockerfile
deleted file mode 100644
index 6f92e56..0000000
--- a/docker/postgres/Dockerfile
+++ /dev/null
@@ -1,6 +0,0 @@
-FROM postgres:16-alpine
-USER 65534
-RUN localedef -i ru_RU -c -f UTF-8 -A /usr/share/locale/locale.alias ru_RU.UTF-8
-ENV LANG ru_RU.utf8
-
-#COPY create_schemas.sql /docker-entrypoint-initdb.d/
\ No newline at end of file
diff --git a/docker/postgres/create_schemas.sql b/docker/postgres/create_schemas.sql
index b1b558e..eb3f449 100644
--- a/docker/postgres/create_schemas.sql
+++ b/docker/postgres/create_schemas.sql
@@ -1,3 +1,2 @@
\connect protego_totalum
-create schema if not exists protego_totalum;
create schema if not exists liquibase;
\ No newline at end of file
diff --git a/docs/README.md b/docs/README.md
index 17cccfd..64c3467 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -22,7 +22,7 @@ ___
### 📋 Инструкции по запуску
___
-Пока не написано
+Для корректной работы нужно добавить переменную окружения **BOT_TOKEN** в конфигурацию запуска.
### ⚙ Включает функциональность
diff --git a/pt-database/src/main/resources/database.yml b/pt-database/src/main/resources/database.yml
index a567a5d..a750a53 100644
--- a/pt-database/src/main/resources/database.yml
+++ b/pt-database/src/main/resources/database.yml
@@ -9,6 +9,7 @@ spring:
url: jdbc:${PT_DB_TYPE:postgresql}://${PT_DB_HOST:localhost}:${PT_DB_PORT:5123}/${PT_DB_NAME:protego_totalum}
user: ${PT_DB_LOGIN:protego_totalum}
password: ${PT_DB_PASSWORD:protego_totalum}
+ liquibaseSchema: liquibase
logging:
level:
diff --git a/pt-discord/build.gradle.kts b/pt-discord/build.gradle.kts
index e6fe11b..8881c34 100644
--- a/pt-discord/build.gradle.kts
+++ b/pt-discord/build.gradle.kts
@@ -7,7 +7,7 @@ dependencies {
implementation(Libs.KORD_CORE)
// Spring
- implementation(Libs.SPRING_BOOT_DATA_WEBFLUX)
+ implementation(Libs.SPRING_BOOT_STARTER_WEBFLUX)
// Kotlin
implementation(Libs.JACKSON_KT)
diff --git a/pt-discord/src/main/kotlin/io/github/hogwartsschoolofmagic/config/DiscordConfig.kt b/pt-discord/src/main/kotlin/io/github/hogwartsschoolofmagic/config/DiscordConfig.kt
index 25bc351..2ab2777 100644
--- a/pt-discord/src/main/kotlin/io/github/hogwartsschoolofmagic/config/DiscordConfig.kt
+++ b/pt-discord/src/main/kotlin/io/github/hogwartsschoolofmagic/config/DiscordConfig.kt
@@ -9,6 +9,7 @@ import kotlinx.coroutines.runBlocking
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
import org.springframework.context.annotation.DependsOn
+import java.lang.System.getenv
/**
* Основная конфигурация бота в Discord. Здесь происходит:
@@ -29,7 +30,7 @@ class DiscordConfig {
@Bean
fun kord(botCommands: List) =
runBlocking {
- Kord(System.getenv("BOT_TOKEN")).apply {
+ Kord(getenv("BOT_TOKEN")).apply {
botCommands.asFlow().collect { it.start(this) }
login {
diff --git a/pt-discord/src/main/resources/db/changelog/db.changelog-master.yaml b/pt-discord/src/main/resources/db/changelog/db.changelog-master.yaml
index e9c6b5c..1daf9ae 100644
--- a/pt-discord/src/main/resources/db/changelog/db.changelog-master.yaml
+++ b/pt-discord/src/main/resources/db/changelog/db.changelog-master.yaml
@@ -1,4 +1,4 @@
databaseChangeLog:
- include:
- file: 2023.1/db.2023.1-master.yaml
+ file: init/db.init-master.yaml
relativeToChangelogFile: true
\ No newline at end of file
diff --git a/pt-discord/src/main/resources/db/changelog/2023.1/db.2023.1-create_tables.yaml b/pt-discord/src/main/resources/db/changelog/init/db.init-create-tables.yaml
similarity index 96%
rename from pt-discord/src/main/resources/db/changelog/2023.1/db.2023.1-create_tables.yaml
rename to pt-discord/src/main/resources/db/changelog/init/db.init-create-tables.yaml
index 49e258e..a8733c4 100644
--- a/pt-discord/src/main/resources/db/changelog/2023.1/db.2023.1-create_tables.yaml
+++ b/pt-discord/src/main/resources/db/changelog/init/db.init-create-tables.yaml
@@ -1,7 +1,7 @@
databaseChangeLog:
- changeSet:
- id: 2023.1-create_tables
- author: Vladislav Kuznetsov
+ id: Инициализация структуры базы данных
+ author: Владислав Кузнецов
changes:
- createTable:
columns:
diff --git a/pt-discord/src/main/resources/db/changelog/2023.1/db.2023.1-master.yaml b/pt-discord/src/main/resources/db/changelog/init/db.init-master.yaml
similarity index 62%
rename from pt-discord/src/main/resources/db/changelog/2023.1/db.2023.1-master.yaml
rename to pt-discord/src/main/resources/db/changelog/init/db.init-master.yaml
index 279d6ad..c8f70a6 100644
--- a/pt-discord/src/main/resources/db/changelog/2023.1/db.2023.1-master.yaml
+++ b/pt-discord/src/main/resources/db/changelog/init/db.init-master.yaml
@@ -1,4 +1,4 @@
databaseChangeLog:
- include:
- file: db.2023.1-create_tables.yaml
+ file: db.init-create-tables.yaml
relativeToChangelogFile: true
\ No newline at end of file