mirror of
https://codeup.aliyun.com/64f7d6b8ce01efaafef1e678/coal/coal.git
synced 2026-01-25 07:46:40 +08:00
Merge branch 'master' of https://e.coding.net/lihongjie/coal/coal
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -33,4 +33,3 @@ build/
|
||||
.vscode/
|
||||
*.log
|
||||
|
||||
GeoLite2-City/
|
||||
17
Dockerfile
Normal file
17
Dockerfile
Normal file
@@ -0,0 +1,17 @@
|
||||
FROM maven:3-eclipse-temurin-17 as build
|
||||
WORKDIR /code
|
||||
COPY pom.xml .
|
||||
COPY settings.xml .
|
||||
|
||||
RUN mvn verify --fail-never -P build --settings settings.xml
|
||||
|
||||
COPY src ./src
|
||||
RUN mvn clean install -DskipTests -P build --settings settings.xml
|
||||
|
||||
FROM eclipse-temurin:17-jdk-alpine
|
||||
WORKDIR /app
|
||||
|
||||
ARG JAR_FILE=target/*.jar
|
||||
COPY --from=build /code/target/*.jar app.jar
|
||||
COPY GeoLite2-City ./GeoLite2-City
|
||||
ENTRYPOINT ["sh", "-c", "java ${JAVA_OPTS} -jar app.jar ${0} ${@}"]
|
||||
BIN
GeoLite2-City/GeoLite2-City.mmdb
Normal file
BIN
GeoLite2-City/GeoLite2-City.mmdb
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 68 MiB |
56
Jenkinsfile
vendored
Normal file
56
Jenkinsfile
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
pipeline{
|
||||
|
||||
agent any
|
||||
|
||||
options {
|
||||
|
||||
disableConcurrentBuilds()
|
||||
}
|
||||
|
||||
|
||||
triggers {
|
||||
pollSCM 'H/3 * * * * '
|
||||
}
|
||||
stages{
|
||||
|
||||
|
||||
stage("打包"){
|
||||
|
||||
|
||||
steps{
|
||||
|
||||
sh "docker build . -t coal:${env.BRANCH_NAME}"
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
stage("关闭 docker-compose"){
|
||||
|
||||
|
||||
steps{
|
||||
|
||||
sh "docker-compose --project-directory docker/${env.BRANCH_NAME} down || true"
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
stage("启动 docker-compose"){
|
||||
|
||||
|
||||
steps{
|
||||
|
||||
sh "docker-compose --project-name ${env.JOB_NAME.replace('/', '_')} --project-directory docker/${env.BRANCH_NAME} up -d"
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
39
docker/localdev/docker-compose.yaml
Normal file
39
docker/localdev/docker-compose.yaml
Normal file
@@ -0,0 +1,39 @@
|
||||
services:
|
||||
pg:
|
||||
image: postgres
|
||||
ports:
|
||||
- "5432:5432"
|
||||
environment:
|
||||
POSTGRES_PASSWORD: 'abc@123'
|
||||
POSTGRES_USER: "postgres"
|
||||
POSTGRES_DB: "coal"
|
||||
networks:
|
||||
- dn
|
||||
volumes:
|
||||
- pg_data:/var/lib/postgresql/data
|
||||
|
||||
|
||||
redis:
|
||||
image: redis:7
|
||||
ports:
|
||||
- "6379:6379"
|
||||
volumes:
|
||||
- ./redis.conf:/etc/redis/redis.conf
|
||||
- redis_data:/data
|
||||
networks:
|
||||
- dn
|
||||
command:
|
||||
- redis-server
|
||||
- /etc/redis/redis.conf
|
||||
|
||||
|
||||
networks:
|
||||
dn:
|
||||
driver: bridge
|
||||
|
||||
|
||||
|
||||
volumes:
|
||||
pg_data:
|
||||
redis_data:
|
||||
|
||||
2276
docker/localdev/redis.conf
Normal file
2276
docker/localdev/redis.conf
Normal file
File diff suppressed because it is too large
Load Diff
53
docker/master/docker-compose.yaml
Normal file
53
docker/master/docker-compose.yaml
Normal file
@@ -0,0 +1,53 @@
|
||||
services:
|
||||
pg:
|
||||
image: postgres
|
||||
ports:
|
||||
- "5432:5432"
|
||||
environment:
|
||||
POSTGRES_PASSWORD: 'abc@123'
|
||||
POSTGRES_USER: "postgres"
|
||||
POSTGRES_DB: "coal"
|
||||
networks:
|
||||
- dn
|
||||
volumes:
|
||||
- pg_data:/var/lib/postgresql/data
|
||||
|
||||
|
||||
redis:
|
||||
image: redis:7
|
||||
ports:
|
||||
- "6379:6379"
|
||||
volumes:
|
||||
- ./redis.conf:/etc/redis/redis.conf
|
||||
- redis_data:/data
|
||||
networks:
|
||||
- dn
|
||||
command:
|
||||
- redis-server
|
||||
- /etc/redis/redis.conf
|
||||
|
||||
coal:
|
||||
image: coal:master
|
||||
networks:
|
||||
- dn
|
||||
environment:
|
||||
PG_HOST: pg
|
||||
REDIS_HOST: redis
|
||||
volumes:
|
||||
- spring_data:/data
|
||||
ports:
|
||||
- "7456:7456"
|
||||
command:
|
||||
- --spring.profiles.active=master
|
||||
|
||||
networks:
|
||||
dn:
|
||||
driver: bridge
|
||||
|
||||
|
||||
|
||||
volumes:
|
||||
pg_data:
|
||||
redis_data:
|
||||
spring_data:
|
||||
|
||||
2276
docker/master/redis.conf
Normal file
2276
docker/master/redis.conf
Normal file
File diff suppressed because it is too large
Load Diff
53
docker/prod/docker-compose.yaml
Normal file
53
docker/prod/docker-compose.yaml
Normal file
@@ -0,0 +1,53 @@
|
||||
services:
|
||||
pg:
|
||||
image: postgres
|
||||
ports:
|
||||
- "25432:5432"
|
||||
environment:
|
||||
POSTGRES_PASSWORD: 'abc@123'
|
||||
POSTGRES_USER: "postgres"
|
||||
POSTGRES_DB: "coal"
|
||||
networks:
|
||||
- dn
|
||||
volumes:
|
||||
- pg_data:/var/lib/postgresql/data
|
||||
|
||||
|
||||
redis:
|
||||
image: redis:7
|
||||
ports:
|
||||
- "26379:6379"
|
||||
volumes:
|
||||
- ./redis.conf:/etc/redis/redis.conf
|
||||
- redis_data:/data
|
||||
networks:
|
||||
- dn
|
||||
command:
|
||||
- redis-server
|
||||
- /etc/redis/redis.conf
|
||||
|
||||
coal:
|
||||
image: coal:master
|
||||
networks:
|
||||
- dn
|
||||
environment:
|
||||
PG_HOST: pg
|
||||
REDIS_HOST: redis
|
||||
volumes:
|
||||
- spring_data:/data
|
||||
ports:
|
||||
- "27456:7456"
|
||||
command:
|
||||
- --spring.profiles.active=prod
|
||||
|
||||
networks:
|
||||
dn:
|
||||
driver: bridge
|
||||
|
||||
|
||||
|
||||
volumes:
|
||||
pg_data:
|
||||
redis_data:
|
||||
spring_data:
|
||||
|
||||
2276
docker/prod/redis.conf
Normal file
2276
docker/prod/redis.conf
Normal file
File diff suppressed because it is too large
Load Diff
53
docker/test/docker-compose.yaml
Normal file
53
docker/test/docker-compose.yaml
Normal file
@@ -0,0 +1,53 @@
|
||||
services:
|
||||
pg:
|
||||
image: postgres
|
||||
ports:
|
||||
- "15432:5432"
|
||||
environment:
|
||||
POSTGRES_PASSWORD: 'abc@123'
|
||||
POSTGRES_USER: "postgres"
|
||||
POSTGRES_DB: "coal"
|
||||
networks:
|
||||
- dn
|
||||
volumes:
|
||||
- pg_data:/var/lib/postgresql/data
|
||||
|
||||
|
||||
redis:
|
||||
image: redis:7
|
||||
ports:
|
||||
- "16379:6379"
|
||||
volumes:
|
||||
- ./redis.conf:/etc/redis/redis.conf
|
||||
- redis_data:/data
|
||||
networks:
|
||||
- dn
|
||||
command:
|
||||
- redis-server
|
||||
- /etc/redis/redis.conf
|
||||
|
||||
coal:
|
||||
image: coal:master
|
||||
networks:
|
||||
- dn
|
||||
environment:
|
||||
PG_HOST: pg
|
||||
REDIS_HOST: redis
|
||||
volumes:
|
||||
- spring_data:/data
|
||||
ports:
|
||||
- "17456:7456"
|
||||
command:
|
||||
- --spring.profiles.active=test
|
||||
|
||||
networks:
|
||||
dn:
|
||||
driver: bridge
|
||||
|
||||
|
||||
|
||||
volumes:
|
||||
pg_data:
|
||||
redis_data:
|
||||
spring_data:
|
||||
|
||||
2276
docker/test/redis.conf
Normal file
2276
docker/test/redis.conf
Normal file
File diff suppressed because it is too large
Load Diff
77
pom.xml
77
pom.xml
@@ -16,7 +16,69 @@
|
||||
<properties>
|
||||
<java.version>17</java.version>
|
||||
</properties>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>build</id>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>aliyun</id>
|
||||
<url>http://192.168.0.118:8081/repository/maven-public/</url>
|
||||
<releases>
|
||||
<enabled>true</enabled>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
<repository>
|
||||
<releases>
|
||||
<updatePolicy>never</updatePolicy>
|
||||
<enabled>false</enabled>
|
||||
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>false</enabled>
|
||||
</snapshots>
|
||||
|
||||
<id>central</id>
|
||||
<name>Central Repository</name>
|
||||
<url>https://repo.maven.apache.org/maven2</url>
|
||||
</repository>
|
||||
|
||||
</repositories>
|
||||
|
||||
<pluginRepositories>
|
||||
<pluginRepository>
|
||||
<releases>
|
||||
<updatePolicy>never</updatePolicy>
|
||||
<enabled>false</enabled>
|
||||
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>false</enabled>
|
||||
</snapshots>
|
||||
|
||||
<id>central</id>
|
||||
<name>Central Repository</name>
|
||||
<url>https://repo.maven.apache.org/maven2</url>
|
||||
</pluginRepository>
|
||||
<pluginRepository>
|
||||
<id>aliyun</id>
|
||||
<url>http://192.168.0.118:8081/repository/maven-public/</url>
|
||||
<releases>
|
||||
<enabled>true</enabled>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
</pluginRepository>
|
||||
</pluginRepositories>
|
||||
</profile>
|
||||
</profiles>
|
||||
<repositories>
|
||||
|
||||
<repository>
|
||||
<id>aliyun</id>
|
||||
<url>https://maven.aliyun.com/repository/public</url>
|
||||
@@ -29,11 +91,10 @@
|
||||
</repository>
|
||||
|
||||
|
||||
|
||||
|
||||
</repositories>
|
||||
|
||||
<pluginRepositories>
|
||||
|
||||
<pluginRepository>
|
||||
<id>aliyun</id>
|
||||
<url>https://maven.aliyun.com/repository/public</url>
|
||||
@@ -66,10 +127,10 @@
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-quartz -->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>org.springframework.boot</groupId>-->
|
||||
<!-- <artifactId>spring-boot-starter-quartz</artifactId>-->
|
||||
<!-- </dependency>-->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>org.springframework.boot</groupId>-->
|
||||
<!-- <artifactId>spring-boot-starter-quartz</artifactId>-->
|
||||
<!-- </dependency>-->
|
||||
<!-- https://mvnrepository.com/artifact/p6spy/p6spy -->
|
||||
<dependency>
|
||||
<groupId>p6spy</groupId>
|
||||
@@ -155,7 +216,6 @@
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>jakarta.persistence</groupId>
|
||||
<artifactId>jakarta.persistence-api</artifactId>
|
||||
@@ -206,7 +266,6 @@
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>org.postgresql</groupId>
|
||||
<artifactId>postgresql</artifactId>
|
||||
@@ -227,7 +286,6 @@
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
@@ -261,6 +319,7 @@
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<mainClass>cn.lihongjie.coal.CoalApplication</mainClass>
|
||||
<excludes>
|
||||
<exclude>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
|
||||
14
settings.xml
Normal file
14
settings.xml
Normal file
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
|
||||
|
||||
<mirrors>
|
||||
<mirror>
|
||||
<id>maven-default-http-blocker</id>
|
||||
<mirrorOf>dummy</mirrorOf>
|
||||
<name>Dummy mirror to override default blocking mirror that blocks http</name>
|
||||
<url>http://0.0.0.0/</url>
|
||||
</mirror>
|
||||
</mirrors>
|
||||
</settings>
|
||||
@@ -2,13 +2,12 @@ package cn.lihongjie.coal.config;
|
||||
|
||||
import com.alibaba.druid.pool.DruidDataSource;
|
||||
import com.p6spy.engine.spy.P6DataSource;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
import org.springframework.context.annotation.Profile;
|
||||
import org.springframework.core.env.Environment;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
@@ -29,18 +28,13 @@ public class DruidConfig {
|
||||
|
||||
@Bean
|
||||
@Primary
|
||||
@Profile({"dev", "master"})
|
||||
public DataSource p6DataSource() {
|
||||
|
||||
DataSource dataSource = druidDataSource();
|
||||
|
||||
if (ArrayUtils.contains(environment.getActiveProfiles(), "dev")) {
|
||||
return new P6DataSource(druidDataSource());
|
||||
|
||||
|
||||
return new P6DataSource(dataSource);
|
||||
} else {
|
||||
return dataSource;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -27,9 +27,9 @@ spring:
|
||||
|
||||
druid:
|
||||
driver-class-name: org.postgresql.Driver
|
||||
url: jdbc:postgresql://localhost:5432/coal
|
||||
username: postgres
|
||||
password: 'abc@123'
|
||||
url: jdbc:postgresql://${PG_HOST:localhost}:${PG_PORT:5432}/coal
|
||||
username: ${PG_USER:postgres}
|
||||
password: ${PG_PASSWORD:abc@123}
|
||||
initial-size: 10
|
||||
max-active: 200
|
||||
min-idle: 10
|
||||
@@ -50,9 +50,9 @@ spring:
|
||||
redis:
|
||||
repositories:
|
||||
enabled: false
|
||||
host: localhost
|
||||
port: 6379
|
||||
password: 'abc@123'
|
||||
host: ${REDIS_HOST:localhost}
|
||||
port: ${REDIS_PORT:6379}
|
||||
password: ${REDIS_PASSWORD:abc@123}
|
||||
|
||||
cache:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user