chore(server): enable pay/mall modules and local compose/flyway setup

This commit is contained in:
2026-08-01 12:19:53 +08:00
parent a841652fd4
commit 6db64917a2
6 changed files with 123 additions and 34 deletions

36
compose.yaml Normal file
View File

@@ -0,0 +1,36 @@
name: gongxue-local
services:
postgres:
image: postgres:17-alpine
ports:
- "127.0.0.1::5432"
environment:
POSTGRES_DB: ruoyi-vue-pro
POSTGRES_USER: postgres
POSTGRES_PASSWORD: 123456
volumes:
- postgres-data:/var/lib/postgresql/data
- ./sql/postgresql/ruoyi-vue-pro.sql:/docker-entrypoint-initdb.d/000-platform.sql:ro
- ./script/docker/init-local-roles.sql:/docker-entrypoint-initdb.d/010-local-roles.sql:ro
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres -d ruoyi-vue-pro"]
interval: 2s
timeout: 5s
retries: 30
redis:
image: redis:6-alpine
ports:
- "127.0.0.1::6379"
volumes:
- redis-data:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 2s
timeout: 5s
retries: 30
volumes:
postgres-data:
redis-data:

View File

@@ -20,8 +20,8 @@
<!-- <module>yudao-module-bpm</module>-->
<!-- <module>yudao-module-report</module>-->
<!-- <module>yudao-module-mp</module>-->
<!-- <module>yudao-module-pay</module>-->
<!-- <module>yudao-module-mall</module>-->
<module>yudao-module-pay</module>
<module>yudao-module-mall</module>
<!-- <module>yudao-module-crm</module>-->
<!-- <module>yudao-module-erp</module>-->
<!-- <module>yudao-module-iot</module>-->

View File

@@ -0,0 +1,25 @@
CREATE ROLE yudao_flyway LOGIN NOINHERIT PASSWORD '123456';
CREATE ROLE yudao_runtime LOGIN NOINHERIT PASSWORD '123456';
ALTER SCHEMA public OWNER TO yudao_flyway;
DO $$
DECLARE
object RECORD;
BEGIN
FOR object IN
SELECT format('%I.%I', schemaname, tablename) AS name
FROM pg_tables
WHERE schemaname = 'public'
LOOP
EXECUTE 'ALTER TABLE ' || object.name || ' OWNER TO yudao_flyway';
END LOOP;
FOR object IN
SELECT format('%I.%I', sequence_schema, sequence_name) AS name
FROM information_schema.sequences
WHERE sequence_schema = 'public'
LOOP
EXECUTE 'ALTER SEQUENCE ' || object.name || ' OWNER TO yudao_flyway';
END LOOP;
END
$$;
GRANT USAGE ON SCHEMA public TO yudao_runtime;

View File

@@ -58,12 +58,12 @@
<!-- <artifactId>yudao-module-bpm</artifactId>-->
<!-- <version>${revision}</version>-->
<!-- </dependency>-->
<!-- 支付服务。默认注释,保证编译速度 -->
<!-- <dependency>-->
<!-- <groupId>cn.iocoder.boot</groupId>-->
<!-- <artifactId>yudao-module-pay</artifactId>-->
<!-- <version>${revision}</version>-->
<!-- </dependency>-->
<!-- 支付服务:教育商业化直接复用原生 Pay 能力 -->
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-module-pay</artifactId>
<version>${revision}</version>
</dependency>
<!-- 微信公众号模块。默认注释,保证编译速度 -->
<!-- <dependency>-->
@@ -73,21 +73,21 @@
<!-- </dependency>-->
<!-- 商城相关模块。默认注释,保证编译速度-->
<!-- <dependency>-->
<!-- <groupId>cn.iocoder.boot</groupId>-->
<!-- <artifactId>yudao-module-product</artifactId>-->
<!-- <version>${revision}</version>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>cn.iocoder.boot</groupId>-->
<!-- <artifactId>yudao-module-promotion</artifactId>-->
<!-- <version>${revision}</version>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>cn.iocoder.boot</groupId>-->
<!-- <artifactId>yudao-module-trade</artifactId>-->
<!-- <version>${revision}</version>-->
<!-- </dependency>-->
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-module-product</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-module-promotion</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-module-trade</artifactId>
<version>${revision}</version>
</dependency>
<!-- <dependency>-->
<!-- <groupId>cn.iocoder.boot</groupId>-->
<!-- <artifactId>yudao-module-statistics</artifactId>-->
@@ -143,10 +143,24 @@
<!-- <version>${revision}</version>-->
<!-- </dependency>-->
<!-- 本地开发 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-docker-compose</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<!-- 数据库迁移 -->
<dependency>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-core</artifactId>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-flyway</artifactId>
</dependency>
<dependency>
<groupId>org.flywaydb</groupId>

View File

@@ -3,6 +3,10 @@ server:
--- #################### 数据库相关配置 ####################
spring:
docker:
compose:
file: ../compose.yaml
lifecycle-management: start-and-stop
autoconfigure:
# noinspection SpringBootApplicationYaml
exclude:
@@ -26,9 +30,9 @@ spring:
flyway:
enabled: true
url: ${FLYWAY_URL:${spring.datasource.dynamic.datasource.master.url}}
user: ${FLYWAY_USER}
password: ${FLYWAY_PASSWORD}
locations: classpath:db/migration
user: ${FLYWAY_USER:yudao_flyway}
password: ${FLYWAY_PASSWORD:123456}
locations: classpath:db/migration,classpath:db/local
table: flyway_schema_history
baseline-on-migrate: true
baseline-version: 4009
@@ -75,14 +79,14 @@ spring:
primary: master
datasource:
master:
url: jdbc:postgresql://127.0.0.1:5432/ruoyi-vue-pro
username: root
password: 123456
url: ${MASTER_DATASOURCE_URL:jdbc:postgresql://127.0.0.1:5432/ruoyi-vue-pro}
username: ${MASTER_DATASOURCE_USERNAME:yudao_runtime}
password: ${MASTER_DATASOURCE_PASSWORD:123456}
slave: # 模拟从库,可根据自己需要修改
lazy: true # 开启懒加载,保证启动速度
url: jdbc:postgresql://127.0.0.1:5432/ruoyi-vue-pro
username: root
password: 123456
url: ${SLAVE_DATASOURCE_URL:${spring.datasource.dynamic.datasource.master.url}}
username: ${SLAVE_DATASOURCE_USERNAME:${spring.datasource.dynamic.datasource.master.username}}
password: ${SLAVE_DATASOURCE_PASSWORD:${spring.datasource.dynamic.datasource.master.password}}
# tdengine: # IoT 数据库(需要 IoT 物联网再开启噢!)
# lazy: true # 开启懒加载,保证启动速度
# url: jdbc:TAOS-WS://127.0.0.1:6041/ruoyi_vue_pro?varcharAsString=true&enableAutoReconnect=true # 参见https://t.zsxq.com/qaX9c开启 TDengine WebSocket 自动重连

View File

@@ -0,0 +1,10 @@
GRANT USAGE ON SCHEMA public TO yudao_runtime;
GRANT SELECT, INSERT, UPDATE, DELETE, TRUNCATE ON ALL TABLES IN SCHEMA public TO yudao_runtime;
GRANT USAGE, SELECT ON ALL SEQUENCES IN SCHEMA public TO yudao_runtime;
REVOKE ALL ON TABLE
education_question_lifecycle_transition_token,
education_content_node_lifecycle_transition_token,
education_question_collection_lifecycle_transition_token,
education_question_collection_membership_token
FROM yudao_runtime;