Skip to content

Commit b4cf98d

Browse files
committed
feat: [KAN-102] user_profile & user_address
1 parent c2e6344 commit b4cf98d

31 files changed

+1640
-45
lines changed

.github/ci/docker-compose.yml

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,26 @@ services:
1010
networks:
1111
ci-net:
1212
aliases:
13-
- mysql-container # 别名,Go 通过这个名字连接 MySQL
13+
- mysql-container
1414

15+
kafka:
16+
image: confluentinc/cp-kafka:7.5.0
17+
container_name: kafka-container
18+
ports:
19+
- "9092:9092"
20+
environment:
21+
CLUSTER_ID: ohAxBaI7QUuIq7lQBYzRYA
22+
command: >
23+
bash -c "
24+
if [ ! -f /var/lib/kafka/data/meta.properties ]; then
25+
kafka-storage format -t $$CLUSTER_ID -c /etc/kafka/kraft/server.properties;
26+
fi &&
27+
kafka-server-start /etc/kafka/kraft/server.properties
28+
"
29+
networks:
30+
ci-net:
31+
aliases:
32+
- kafka-container
1533
ceramicraft-user-mservice:
1634
build:
1735
context: ../../server
@@ -24,6 +42,7 @@ services:
2442
- JWT_SECRET=${JWT_SECRET}
2543
depends_on:
2644
- mysql
45+
- kafka
2746
networks:
2847
- ci-net
2948
ports:

.github/workflows/deploy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
name: env-file
3838
path: env-file
3939
build:
40-
if: ${{ github.event.inputs.command == 'deploy' }} # ← 仅在 deploy 时构建
40+
if: ${{ github.event.inputs.command == 'deploy' }}
4141
runs-on: ubuntu-latest
4242
env:
4343
DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }}

server/Dockerfile

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Use the official Go image with version 1.24
2-
FROM golang:1.24.0
2+
FROM golang:1.24.0-alpine AS builder
33

44
# Set the working directory inside the container
55
WORKDIR /app
@@ -14,10 +14,12 @@ RUN go mod tidy
1414
COPY . .
1515

1616
# Build the Go application
17-
RUN go build -ldflags="-s -w" -o main main.go
17+
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 \
18+
go build -a -ldflags="-w -s" -o main main.go && \
19+
go clean -cache -modcache
1820

1921
# Create a non-root user and set permissions
20-
RUN useradd -m appuser && \
22+
RUN adduser -D -h /home/appuser appuser && \
2123
mkdir -p logs && \
2224
chown -R appuser:appuser config/ && \
2325
chown -R appuser:appuser logs/ && \

server/config/config.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ type Conf struct {
1616
HttpConfig *HttpConfig `mapstructure:"http"`
1717
MySQLConfig *MySQL `mapstructure:"mysql"`
1818
EmailConfig *EmailConfig `mapstructure:"email"`
19+
KafkaConfig *KafkaConfig `mapstructure:"kafka"`
1920
}
2021

2122
type EmailConfig struct {
@@ -49,6 +50,18 @@ type MySQL struct {
4950
DBName string `mapstructure:"dbName"`
5051
}
5152

53+
type KafkaConfig struct {
54+
Brokers []string `mapstructure:"brokers"`
55+
UserActivatedTopic string `mapstructure:"user_activated_topic"`
56+
ClientID string `mapstructure:"client_id"`
57+
MaxBytes int `mapstructure:"max_bytes"`
58+
Acks int `mapstructure:"acks"`
59+
Retries int `mapstructure:"retries"`
60+
LingMs int `mapstructure:"ling_ms"`
61+
BatchSize int `mapstructure:"batch_size"`
62+
BatchTimeoutMillis int `mapstructure:"batch_timeout_millis"`
63+
}
64+
5265
func Init() {
5366
workDir, _ := os.Getwd()
5467
viper.SetConfigName("config")

0 commit comments

Comments
 (0)