Compare commits
20 Commits
feature/ta
...
74f02e7827
| Author | SHA1 | Date | |
|---|---|---|---|
| 74f02e7827 | |||
| dc07591612 | |||
| 0f9721f562 | |||
| 742d246cdb | |||
| 0ac12deed3 | |||
| 9a4652b8f2 | |||
| edd29ea029 | |||
| 7838e60a82 | |||
| 02a56ee434 | |||
| d60187cc07 | |||
| 6359c59af9 | |||
| c84e935f05 | |||
| f9ad7fddbd | |||
| f011205a22 | |||
| 5920067b02 | |||
| 9e6cba52f6 | |||
| 638dc42a46 | |||
| fd4248d722 | |||
| b71b4db66e | |||
| 9ee1a4de3c |
11
Dockerfile
Normal file
11
Dockerfile
Normal file
@@ -0,0 +1,11 @@
|
||||
# Используем официальный образ OpenJDK 17 как базовый образ
|
||||
FROM openjdk:17-jre-slim
|
||||
|
||||
# Установка рабочей директории внутри контейнера
|
||||
WORKDIR /app
|
||||
|
||||
# Копируем JAR-файл приложения из локальной директории внутрь контейнера
|
||||
COPY target/ServerMonitorBot-0.0.1-SNAPSHOT.jar app.jar
|
||||
|
||||
# Команда для запуска Spring Boot приложения при старте контейнера
|
||||
CMD ["java", "-jar", "app.jar"]
|
||||
15
Jenkinsfile
vendored
Normal file
15
Jenkinsfile
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
pipeline {
|
||||
agent {
|
||||
docker {
|
||||
image 'maven'
|
||||
args '-v /root/.m2:/root/.m2'
|
||||
}
|
||||
}
|
||||
stages {
|
||||
stage('Build') {
|
||||
steps {
|
||||
sh 'mvn -B -DskipTests clean package'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
14
docker-compose.yml
Normal file
14
docker-compose.yml
Normal file
@@ -0,0 +1,14 @@
|
||||
version: '3'
|
||||
services:
|
||||
app:
|
||||
build:
|
||||
context: .
|
||||
depends_on:
|
||||
- db
|
||||
|
||||
db:
|
||||
image: postgres:latest
|
||||
environment:
|
||||
POSTGRES_USER: servermonitorbot
|
||||
POSTGRES_PASSWORD: servermonitorbot
|
||||
POSTGRES_DB: servermonitorbot
|
||||
83
pom.xml
83
pom.xml
@@ -15,6 +15,10 @@
|
||||
<description>ServerMonitorBot</description>
|
||||
<properties>
|
||||
<java.version>17</java.version>
|
||||
<flyway.version>9.16.0</flyway.version>
|
||||
<db.url>${db.url}</db.url>
|
||||
<db.user>${db.username}</db.user>
|
||||
<db.password>${db.password}</db.password>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
@@ -51,30 +55,85 @@
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-jpa</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.liquibase</groupId>
|
||||
<artifactId>liquibase-core</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.postgresql</groupId>
|
||||
<artifactId>postgresql</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.flywaydb</groupId>
|
||||
<artifactId>flyway-core</artifactId>
|
||||
<version>${flyway.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.1</version> <!-- Укажите актуальную версию плагина -->
|
||||
<configuration>
|
||||
<excludes>
|
||||
<exclude>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</exclude>
|
||||
</excludes>
|
||||
<source>${java.version}</source> <!-- Укажите версию исходного кода Java -->
|
||||
<target>${java.version}</target> <!-- Укажите версию целевого байт-кода Java -->
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.flywaydb</groupId>
|
||||
<artifactId>flyway-maven-plugin</artifactId>
|
||||
<version>${flyway.version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>migrate</id>
|
||||
<phase>deploy</phase>
|
||||
<goals>
|
||||
<goal>migrate</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<url>${db.url}</url>
|
||||
<user>${db.username}</user>
|
||||
<password>${db.password}</password>
|
||||
<locations>
|
||||
<location>classpath:db/migration</location>
|
||||
</locations>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>com.spotify</groupId>
|
||||
<artifactId>docker-maven-plugin</artifactId>
|
||||
<version>1.2.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>build-image</id>
|
||||
<phase>install</phase>
|
||||
<goals>
|
||||
<goal>build</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<imageName>ServerMonitorBot</imageName>
|
||||
<serverId>remote-docker</serverId>
|
||||
<dockerDirectory>.</dockerDirectory>
|
||||
<resources>
|
||||
<resource>
|
||||
<targetPath>/</targetPath>
|
||||
<directory>${project.build.directory}</directory>
|
||||
<include>${project.build.finalName}.jar</include>
|
||||
</resource>
|
||||
</resources>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>build-image</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>build</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
|
||||
@@ -61,4 +61,4 @@ public class HddTempCommand extends CommandTemplate {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,20 +2,14 @@ spring:
|
||||
application:
|
||||
name: ServerMonitorBot
|
||||
datasource:
|
||||
url: jdbc:postgresql://localhost:5432/servermonitorbot
|
||||
username: servermonitorbot
|
||||
password: servermonitorbot
|
||||
url: @db.url@
|
||||
username: @db.username@
|
||||
password: @db.password@
|
||||
jpa:
|
||||
hibernate:
|
||||
ddl-auto: none
|
||||
liquibase:
|
||||
enabled: true
|
||||
change-log: classpath:db/scripts/changelog-master.xml
|
||||
url: jdbc:postgresql://localhost:5432/servermonitorbot
|
||||
user: servermonitorbot
|
||||
password: servermonitorbot
|
||||
liquibase-schema: "liquibase"
|
||||
default-schema: "servermonitorbot"
|
||||
flyway:
|
||||
locations: classpath:db/migration
|
||||
bot:
|
||||
name: "ServerMonitorBot"
|
||||
token: "token"
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
--changeset L_DelOff:create_table_users rollbackSplitStatements:true
|
||||
--comment: Создание таблицы пользователей
|
||||
CREATE SCHEMA servermonitorbot;
|
||||
CREATE TABLE users
|
||||
(
|
||||
id SERIAL PRIMARY KEY,
|
||||
@@ -1,10 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<databaseChangeLog
|
||||
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd">
|
||||
|
||||
<include file="release_0_0_1/changelog.xml" relativeToChangelogFile="true"/>
|
||||
|
||||
|
||||
</databaseChangeLog>
|
||||
@@ -1,16 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<databaseChangeLog
|
||||
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd">
|
||||
|
||||
<include file="scripts/01_create_table_users.sql" relativeToChangelogFile="true"/>
|
||||
<include file="scripts/02_create_table_roles.sql" relativeToChangelogFile="true"/>
|
||||
<include file="scripts/03_add_FK_users_to_roles.sql" relativeToChangelogFile="true"/>
|
||||
<include file="scripts/04_add_roles.sql" relativeToChangelogFile="true"/>
|
||||
<include file="scripts/05_add_anonymous_role.sql" relativeToChangelogFile="true"/>
|
||||
<include file="scripts/06_refactor_users_table.sql" relativeToChangelogFile="true"/>
|
||||
<include file="scripts/07_refactor_roles_table.sql" relativeToChangelogFile="true"/>
|
||||
<include file="scripts/08_add_roles.sql" relativeToChangelogFile="true"/>
|
||||
|
||||
</databaseChangeLog>
|
||||
Reference in New Issue
Block a user