Skip to content

Commit 0a98468

Browse files
author
尘绝
committed
version1.build mysql
1 parent ed1f5b9 commit 0a98468

File tree

21 files changed

+411
-29
lines changed

21 files changed

+411
-29
lines changed

docker-compose.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,25 @@ services:
143143
# count: all # 或者您想要的数量,例如 1
144144
# capabilities: [gpu]
145145

146+
147+
mysql:
148+
image: mysql:8.0.23
149+
container_name: mysql
150+
environment:
151+
MYSQL_ROOT_PASSWORD: 'root'
152+
MYSQL_DATABASE: 'muagent'
153+
MYSQL_USER: 'muagent'
154+
MYSQL_PASSWORD: 'muagent'
155+
ports:
156+
- "3306:3306"
157+
volumes:
158+
- ./examples/mysql/db:/var/lib/mysql
159+
- ./examples/mysql/mysql.cnf:/etc/mysql/conf.d/mysql.cnf
160+
- ./examples/mysql/init:/docker-entrypoint-initdb.d
161+
restart: on-failure
162+
networks:
163+
- ekg-net
164+
146165
runtime:
147166
build:
148167
context: ./runtime
@@ -158,6 +177,8 @@ services:
158177
- ekg-net
159178
volumes:
160179
- ./runtime:/home/user/runtime
180+
depends_on:
181+
- mysql
161182
command: ["bash", "-c", "cd /home/user/runtime && mvn package && java -jar /home/user/runtime/bootstrap/muagent-runtime.jar"]
162183

163184
ekgservice:

examples/mysql/init/init.sql

Lines changed: 68 additions & 0 deletions
Large diffs are not rendered by default.

examples/mysql/mysql.cnf

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[mysqld]
2+
character-set-server=utf8mb4
3+
collation-server=utf8mb4_unicode_ci
4+
5+
[client]
6+
default-character-set=utf8mb4
7+
8+
[mysql]
9+
default-character-set=utf8mb4

runtime/bootstrap/src/main/java/com/alipay/muagent/bootstrap/BootstrapApplication.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.alipay.muagent.bootstrap;
22

33
import com.alipay.muagent.util.LoggerUtil;
4+
import org.mybatis.spring.annotation.MapperScan;
45
import org.slf4j.Logger;
56
import org.slf4j.LoggerFactory;
67
import org.springframework.boot.SpringApplication;
@@ -10,6 +11,7 @@
1011

1112
@SpringBootApplication
1213
@ComponentScan(basePackages = {"com.alipay.muagent"})
14+
@MapperScan("com.alipay.muagent.service.mybatisplus.mapper")
1315
public class BootstrapApplication {
1416

1517
private static final Logger LOGGER = LoggerFactory.getLogger(BootstrapApplication.class);

runtime/bootstrap/src/main/resources/config/application.properties

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,11 @@ spring.application.name=runtime
22

33
logging.path=./logs
44

5+
spring.datasource.type=com.zaxxer.hikari.HikariDataSource
6+
spring.datasource.url=jdbc:mysql://mysql:3306/muagent?allowPublicKeyRetrieval=true&characterEncoding=utf-8&&useSSL=false&serverTimezone=UTC
7+
spring.datasource.username=root
8+
spring.datasource.password=root
9+
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
10+
11+
mybatis-plus.mapper-locations=classpath:mapper/*.xml
12+
mybatis-plus.type-aliases-package=com.alipay.muagent.model

runtime/bootstrap/src/main/resources/tools/system.select_tool.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"id": 2,
2+
"id": "system.select_tool",
33
"gmtCreate": "2024-07-17T07:20:35.000+00:00",
44
"gmtModified": "2024-07-17T07:20:35.000+00:00",
55
"toolKey": "system.select_tool",

runtime/bootstrap/src/main/resources/tools/undercover.dispatch_keyword.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"id": 2,
2+
"id": "undercover.dispatch_keyword",
33
"gmtCreate": "2024-07-17T07:20:35.000+00:00",
44
"gmtModified": "2024-07-17T07:20:35.000+00:00",
55
"toolKey": "undercover.dispatch_keyword",

runtime/bootstrap/src/main/resources/tools/undercover.dispatch_position.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"id": 2,
2+
"id": "undercover.dispatch_position",
33
"gmtCreate": "2024-07-17T07:20:35.000+00:00",
44
"gmtModified": "2024-07-17T07:20:35.000+00:00",
55
"toolKey": "undercover.dispatch_position",

runtime/bootstrap/src/main/resources/tools/undercover.judge.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"id": 2,
2+
"id": "undercover.judge",
33
"gmtCreate": "2024-07-17T07:20:35.000+00:00",
44
"gmtModified": "2024-07-17T07:20:35.000+00:00",
55
"toolKey": "undercover.judge",

runtime/model/pom.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,13 @@
3333
<groupId>org.projectlombok</groupId>
3434
<artifactId>lombok</artifactId>
3535
</dependency>
36+
37+
<!-- MyBatis Plus -->
38+
<dependency>
39+
<groupId>com.baomidou</groupId>
40+
<artifactId>mybatis-plus-boot-starter</artifactId>
41+
</dependency>
42+
3643
</dependencies>
3744

3845
</project>

0 commit comments

Comments
 (0)