Skip to content

Commit

Permalink
Корректировка запуска docker-compose и spring boot application.
Browse files Browse the repository at this point in the history
  • Loading branch information
Vladislav Kuznetsov committed Jul 6, 2024
1 parent 365d808 commit d04593b
Show file tree
Hide file tree
Showing 11 changed files with 35 additions and 57 deletions.
17 changes: 17 additions & 0 deletions .idea/dataSources.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 0 additions & 9 deletions .idea/runConfigurations/ProtegoTotalumBotApp.xml

This file was deleted.

12 changes: 6 additions & 6 deletions buildSrc/src/main/kotlin/Dependencies.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
}

/**
Expand All @@ -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"
Expand Down Expand Up @@ -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}"

Expand Down
33 changes: 4 additions & 29 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -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
volumes:
- ./postgres/create_schemas.sql:/docker-entrypoint-initdb.d/create_schemas.sql
6 changes: 0 additions & 6 deletions docker/postgres/Dockerfile

This file was deleted.

2 changes: 1 addition & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ ___
### 📋 Инструкции по запуску

___
Пока не написано
Для корректной работы нужно добавить переменную окружения **BOT_TOKEN** в конфигурацию запуска.

### ⚙ Включает функциональность

Expand Down
2 changes: 1 addition & 1 deletion pt-discord/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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. Здесь происходит:
Expand All @@ -29,7 +30,7 @@ class DiscordConfig {
@Bean
fun kord(botCommands: List<Command>) =
runBlocking {
Kord(System.getenv("BOT_TOKEN")).apply {
Kord(getenv("BOT_TOKEN")).apply {
botCommands.asFlow().collect { it.start(this) }

login {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
databaseChangeLog:
- include:
file: 2023.1/db.2023.1-master.yaml
file: init/db.init-master.yml
relativeToChangelogFile: true
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
databaseChangeLog:
- changeSet:
id: 2023.1-create_tables
author: Vladislav Kuznetsov
id: Инициализация структуры базы данных
author: Владислав Кузнецов
changes:
- createTable:
columns:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
databaseChangeLog:
- include:
file: db.2023.1-create_tables.yaml
file: db.init-create-tables.yml
relativeToChangelogFile: true

0 comments on commit d04593b

Please sign in to comment.