add modules to distr

This commit is contained in:
etreschenkov 2022-08-03 19:02:41 +03:00
parent 35cfaf010d
commit 031bc087fc
24 changed files with 94 additions and 191 deletions

View file

@ -16,7 +16,7 @@
<properties>
<keycloak-spring-boot-starter.version>17.0.1</keycloak-spring-boot-starter.version>
</properties>
<dependencies>
@ -31,7 +31,7 @@
<dependency>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-spring-boot-starter</artifactId>
<version>17.0.1</version>
<version>${keycloak-spring-boot-starter.version}</version>
</dependency>
</dependencies>
@ -40,14 +40,14 @@
<dependency>
<groupId>org.keycloak.bom</groupId>
<artifactId>keycloak-adapter-bom</artifactId>
<version>17.0.1</version>
<version>${keycloak-spring-boot-starter.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<finalName>backend-api</finalName>
<resources>
<resource>
<directory>src/main/resources</directory>
@ -58,23 +58,8 @@
<filtering>false</filtering>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<!-- <addClasspath>true</addClasspath>-->
<!-- <addDefaultImplementationEntries>true</addDefaultImplementationEntries>-->
<mainClass>ru.spcex.clearing.backendapi.BackendApiApplication</mainClass>
</manifest>
<manifestEntries>
<Built-By>Maven</Built-By>
</manifestEntries>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>

View file

@ -4,10 +4,13 @@ import ru.clearing.classes.ConstSerializable;
import ru.clearing.classes.StaticData.Profile.CompanyInfo;
import ru.clearing.classes.objects.BusinessObject;
import java.io.Serial;
/**
* DB: COMPANY
*/
public class Company extends BusinessObject {
@Serial
private static final long serialVersionUID = ConstSerializable.serialVersionUID;
private String clearingCode;

View file

@ -34,7 +34,6 @@
<dependency>
<groupId>com.mchange</groupId>
<artifactId>c3p0</artifactId>
<version>0.9.5.2</version>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
@ -45,26 +44,12 @@
<dependency>
<groupId>com.github.albfernandez</groupId>
<artifactId>javadbf</artifactId>
<version>1.13.1</version>
</dependency>
</dependencies>
<build>
<finalName>jar/${project.artifactId}</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<!--<classpathPrefix>../lib/</classpathPrefix>-->
<mainClass>ru.spcex.clearing.dbf.exporter.DBFLoaderApplication</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
@ -76,8 +61,7 @@
</execution>
</executions>
<configuration>
<addResources>true</addResources>
<classifier>exec</classifier>
<finalName>${project.artifactId}</finalName>
</configuration>
</plugin>
</plugins>

View file

@ -8,7 +8,7 @@
</appender>
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>../logs/dbf_export.log</file>
<file>./logs//dbf_export.log</file>
<encoder>
<charset>UTF-8</charset>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>

View file

@ -35,7 +35,6 @@
<dependency>
<groupId>com.mchange</groupId>
<artifactId>c3p0</artifactId>
<version>0.9.5.2</version>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
@ -46,26 +45,11 @@
<dependency>
<groupId>com.github.albfernandez</groupId>
<artifactId>javadbf</artifactId>
<version>1.13.1</version>
</dependency>
</dependencies>
<build>
<finalName>jar/${project.artifactId}</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<!--<classpathPrefix>../lib/</classpathPrefix>-->
<mainClass>ru.spcex.clearing.dbf.importer.DBFLoaderApplication</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
@ -77,8 +61,7 @@
</execution>
</executions>
<configuration>
<addResources>true</addResources>
<classifier>exec</classifier>
<finalName>${project.artifactId}</finalName>
</configuration>
</plugin>
</plugins>

View file

@ -8,7 +8,7 @@
</appender>
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>../logs/dbf_loader.log</file>
<file>./logs//dbf_loader.log</file>
<encoder>
<charset>UTF-8</charset>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>

View file

@ -49,6 +49,10 @@
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
</dependency>
<dependency>
<groupId>com.mchange</groupId>
<artifactId>c3p0</artifactId>

View file

@ -2,7 +2,6 @@ package ru.spcex.clearing.storage.businessevent;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.lang.NonNull;
import org.springframework.stereotype.Component;
import ru.clearing.classes.StaticData.Company.Company;
import ru.clearing.classes.StaticData.Company.CompanyUpdate;
import ru.clearing.classes.StaticData.Profile.CompanyInfo;
@ -15,7 +14,7 @@ import java.util.Arrays;
import java.util.List;
import java.util.Map;
@Component
//@Component
public class CompanyUpdateMapStore extends BusinessEventMapStore<CompanyUpdate> {
public CompanyUpdateMapStore(JdbcTemplate jdbcTemplate) {

View file

@ -19,18 +19,18 @@ public class DbConnectionConfig {
private ConfigurationRootElement configRoot = DfaConfig.get().getRoot();
@Bean
public DataSource dataSource() /*fixme why: throws PropertyVetoException*/ {
public DataSource dataSource() {
DataSource result;
String login = configRoot.getDatabase().getLogin();
String password = configRoot.getDatabase().getPassword();
String login = "clearing";
String password = "Aa111111";
String logTimeoutPart = "";
String dbPath = configRoot.getDatabase().getJdbcConnectionString();
String dbPath = "jdbc:postgresql://10.200.200.133:5432/postgres";
int timeoutSec = configRoot.getDatabase().getConnectionAcquireTimeoutSeconds();
ComboPooledDataSource cpds = new ComboPooledDataSource();
try {
cpds.setDriverClass(configRoot.getDatabase().getDriver());
} catch (Exception ue) { // fixme не компилится из-за PropertyVetoException
cpds.setDriverClass("org.postgresql.Driver");
} catch (Exception ue) {
throw new RuntimeException(ue);
}
cpds.setJdbcUrl(dbPath);

View file

@ -27,21 +27,7 @@ public class HazelcastConfiguration {
public Config hazelCastConfig() {
Config config = new Config();
config.setInstanceName("instance");
config.setGroupConfig(new GroupConfig()
// todo config .setName(configRoot.getHazelcast().getLogin())
// .setPassword(configRoot.getHazelcast().getPassword()
// )
);
// if (StringUtils.isEmpty(configRoot.getHazelcast().getMancenterUrl())) {
// config.setManagementCenterConfig(new ManagementCenterConfig()
// .setEnabled(false)
// );
// } else {
// config.setManagementCenterConfig(new ManagementCenterConfig()
// .setEnabled(true)
// .setUrl(configRoot.getHazelcast().getMancenterUrl())
// );
// }
config.setGroupConfig(new GroupConfig());
config.setProperty("hazelcast.shutdownhook.enabled", "true");
config.setProperty("hazelcast.logging.type", "slf4j");
config.setProperty("hazelcast.operation.call.timeout.millis", "600000");
@ -52,10 +38,6 @@ public class HazelcastConfiguration {
.setEnabled(false))
.setTcpIpConfig(new TcpIpConfig()
.setEnabled(true)
// .setMembers(
// DfaConfig.get()
// .getRoot().getHazelcast().getClusterMembersList()
// )
)
)
);
@ -77,7 +59,7 @@ public class HazelcastConfiguration {
config.addMapConfig(poolMapConfigs.map_ProfileDocument());
config.addMapConfig(poolMapConfigs.map_Contact());
config.addMapConfig(poolMapConfigs.map_Company());
config.addMapConfig(poolMapConfigs.map_CompanyUpdate());
// config.addMapConfig(poolMapConfigs.map_CompanyUpdate());
return config;
}

View file

@ -177,7 +177,7 @@ public class PoolMapConfigs {
.addMapIndexConfig(makeMapIndexConfig("companyId"));
}
@Autowired
// @Autowired
private CompanyUpdateMapStore companyUpdateMapStore;
public MapConfig map_CompanyUpdate() {

13
pom.xml
View file

@ -31,6 +31,8 @@
<!--suppress UnresolvedMavenProperty -->
<folder_root_clearing>${folder_root_clearing_temp}</folder_root_clearing>
<folder_root_clearing_backend-api>${folder_root_clearing}/clearing-parent/backend-api</folder_root_clearing_backend-api>
<folder_root_dbf-exporter>${folder_root_clearing}/clearing-parent/dbf-exporter</folder_root_dbf-exporter>
<folder_root_dbf-importer>${folder_root_clearing}/clearing-parent/dbf-importer</folder_root_dbf-importer>
<!-- IMDG -->
<external_libraries.hazelcast.version>3.12.4</external_libraries.hazelcast.version>
</properties>
@ -76,6 +78,17 @@
<artifactId>platform-storage-api</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>com.github.albfernandez</groupId>
<artifactId>javadbf</artifactId>
<version>1.13.1</version>
</dependency>
<dependency>
<groupId>com.mchange</groupId>
<artifactId>c3p0</artifactId>
<version>0.9.5.2</version>
</dependency>
</dependencies>
</dependencyManagement>

View file

@ -27,7 +27,7 @@
<profiles>
<profile>
<id>distr</id>
<id>distributive</id>
<build>
<plugins>
@ -106,9 +106,39 @@
</fileSets>
</configuration>
</execution>
<execution>
<id>copy-dbf-exporter-bin</id>
<phase>prepare-package</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<fileSets>
<fileSet>
<sourceFile>${folder_root_dbf-exporter}/target/dbf-exporter.jar</sourceFile>
<destinationFile>${folder.clearing.distr.modules}/dbf-exporter/dbf-exporter.jar</destinationFile>
</fileSet>
</fileSets>
</configuration>
</execution>
<execution>
<id>copy-dbf-importer-bin</id>
<phase>prepare-package</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<fileSets>
<fileSet>
<sourceFile>${folder_root_dbf-importer}/target/dbf-importer.jar</sourceFile>
<destinationFile>${folder.clearing.distr.modules}/dbf-importer/dbf-importer.jar</destinationFile>
</fileSet>
</fileSets>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
@ -132,27 +162,5 @@
</plugins>
</build>
</profile>
<profile>
<id>coverage</id>
<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<executions>
<execution>
<id>report-aggregate</id>
<phase>verify</phase>
<goals>
<goal>report-aggregate</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

View file

@ -0,0 +1,3 @@
#!/bin/sh
docker build -t backend-api:1.0.0 ../modules/backend-api/
docker run -p 8090:8080 -v /opt/clearing/logs:/opt/clearing/bin/logs backend-api:1.0.0 &

View file

@ -0,0 +1,3 @@
#!/bin/sh
docker build -t dbf-exporter:1.0.0 ../modules/dbf-exporter/
docker run -p 8070:8080 -v /opt/clearing/logs:/opt/clearing/bin/logs dbf-exporter:1.0.0 &

View file

@ -0,0 +1,3 @@
#!/bin/sh
docker build -t dbf-importer:1.0.0 ../modules/dbf-importer/
docker run -p 8060:8080 -v /opt/clearing/logs:/opt/clearing/bin/logs dbf-importer:1.0.0 &

View file

@ -0,0 +1,6 @@
#!/bin/sh
./os.sh
sleep 60
./backend-api.sh &
./dbf-exporter.sh &
./dbf-importer.sh &

View file

@ -0,0 +1,2 @@
#!/bin/sh
docker build -t debian:stable-20220125-jdk17 ../modules/os/

View file

@ -1,2 +0,0 @@
docker build -t backend-api:1.0.0 ../backend-api/
docker run -p 8090:8080 backend-api:1.0.0

View file

@ -1,2 +0,0 @@
docker build -t dbf-exporter ../dbf-exporter/
docker run -p 8090:8080 dbf-exporter:latest

View file

@ -1,2 +0,0 @@
docker build -t dbf-importer ../dbf-importer/
docker run -p 8090:8080 dbf-importer:latest

View file

@ -1 +0,0 @@
docker build -t debian:stable-20220125-jdk17 ../os/

View file

@ -1,39 +1,5 @@
FROM debian:stable-20220125
FROM debian:stable-20220125-jdk17
###############################################################################################################################################
# Global system deps
###############################################################################################################################################
RUN apt update \
&& apt install apt-file -y \
&& apt upgrade -y
RUN apt install -y \
wget \
tzdata \
curl \
ca-certificates
###############################################################################################################################################
# Java
###############################################################################################################################################
ENV JAVA_VERSION jdk17.0.4+8
RUN set -eux; \
ESUM='637a742591f75447eaab1f23942db038d411686f'; \
BINARY_URL='https://download.bell-sw.com/java/17.0.4+8/bellsoft-jdk17.0.4+8-linux-amd64.tar.gz'; \
curl -LfsSo /tmp/bellsoft-jdk.tar.gz ${BINARY_URL}; \
mkdir -p /opt/java/bellsoft-jdk; \
cd /opt/java/bellsoft-jdk; \
tar -xf /tmp/bellsoft-jdk.tar.gz --strip-components=1; \
rm -rf /tmp/bellsoft-jdk.tar.gz;
ENV JAVA_HOME=/opt/java/bellsoft-jdk/ \
PATH="/opt/java/bellsoft-jdk/bin:$PATH"
#
ADD dbf-exporter.jar /deployments/dbf-exporter.jar
ADD dbf-exporter.jar /opt/clearing/bin/dbf-exporter.jar
USER root
RUN mkdir ./logs
ENTRYPOINT java -jar /deployments/dbf-exporter.jar
ENTRYPOINT java -jar /opt/clearing/bin/dbf-exporter.jar

View file

@ -1,39 +1,5 @@
FROM debian:stable-20220125
FROM debian:stable-20220125-jdk17
###############################################################################################################################################
# Global system deps
###############################################################################################################################################
RUN apt update \
&& apt install apt-file -y \
&& apt upgrade -y
RUN apt install -y \
wget \
tzdata \
curl \
ca-certificates
###############################################################################################################################################
# Java
###############################################################################################################################################
ENV JAVA_VERSION jdk17.0.4+8
RUN set -eux; \
ESUM='637a742591f75447eaab1f23942db038d411686f'; \
BINARY_URL='https://download.bell-sw.com/java/17.0.4+8/bellsoft-jdk17.0.4+8-linux-amd64.tar.gz'; \
curl -LfsSo /tmp/bellsoft-jdk.tar.gz ${BINARY_URL}; \
mkdir -p /opt/java/bellsoft-jdk; \
cd /opt/java/bellsoft-jdk; \
tar -xf /tmp/bellsoft-jdk.tar.gz --strip-components=1; \
rm -rf /tmp/bellsoft-jdk.tar.gz;
ENV JAVA_HOME=/opt/java/bellsoft-jdk/ \
PATH="/opt/java/bellsoft-jdk/bin:$PATH"
#
ADD dbf-importer.jar /deployments/dbf-importer.jar
ADD dbf-importer.jar /opt/clearing/bin/dbf-importer.jar
USER root
RUN mkdir ./logs
ENTRYPOINT java -jar /deployments/dbf-importer.jar
ENTRYPOINT java -jar /opt/clearing/bin/dbf-importer.jar