Skip to content

Commit 78bd272

Browse files
committed
refactor: clean up code
1 parent a148768 commit 78bd272

3 files changed

Lines changed: 26 additions & 18 deletions

File tree

app/gateway/internal/server/http.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import (
1212
"gateway/internal/service"
1313
"io"
1414
"net/http"
15-
"net/url"
1615
"strings"
1716

1817
"github.com/go-kratos/kratos/contrib/middleware/validate/v2"
@@ -53,12 +52,6 @@ func NewHTTPServer(c *conf.Bootstrap, logger log.Logger, consulClient *client.Co
5352
transporthttp.ResponseEncoder(pkg.HttpResponseEncoder),
5453
transporthttp.ErrorEncoder(pkg.HttpErrorEncoder),
5554
}
56-
if c.Server.RegisterAddress != "" {
57-
opts = append(opts, transporthttp.Endpoint(&url.URL{
58-
Scheme: "http",
59-
Host: fmt.Sprintf("%s:%d", c.Server.RegisterAddress, c.Server.Http.Port),
60-
}))
61-
}
6255
if c.Server.Http.Network != "" {
6356
opts = append(opts, transporthttp.Network(c.Server.Http.Network))
6457
}

deploy/infra-compose.yml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@ version: "3.9"
22

33
name: bass-infra
44

5+
# docker network create bass
6+
networks:
7+
bass:
8+
driver: bridge
9+
external: true
10+
511
services:
612
postgres:
713
image: postgres:18.0
@@ -13,6 +19,8 @@ services:
1319
- "5432:5432"
1420
volumes:
1521
- postgres_data:/var/lib/postgresql18/data
22+
networks:
23+
- bass
1624
healthcheck:
1725
test: [ "CMD-SHELL", "pg_isready -U $$POSTGRES_USER" ]
1826
interval: 30s
@@ -30,6 +38,8 @@ services:
3038
- "6379:6379"
3139
volumes:
3240
- redis_data:/data
41+
networks:
42+
- bass
3343
healthcheck:
3444
test: [ "CMD", "redis-cli", "-a", "${REDIS_PASSWORD}", "ping" ]
3545
interval: 30s
@@ -47,14 +57,16 @@ services:
4757
- "15672:15672"
4858
volumes:
4959
- rabbitmq_data:/var/lib/rabbitmq
60+
networks:
61+
- bass
5062
healthcheck:
5163
test: [ "CMD", "rabbitmq-diagnostics", "ping" ]
5264
interval: 30s
5365
timeout: 10s
5466
retries: 5
5567

5668
consul:
57-
image: hashicorp/consul:1.16
69+
image: hashicorp/consul:1.22.3
5870
container_name: consul
5971
restart: always
6072
env_file:
@@ -85,6 +97,8 @@ services:
8597
- "8600:8600/udp"
8698
volumes:
8799
- consul_data:/consul/data
100+
networks:
101+
- bass
88102
healthcheck:
89103
test: [ "CMD", "consul", "info", "-token=${CONSUL_ACL_MASTER_TOKEN}" ]
90104
interval: 10s

deploy/service-compose.yml

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ version: '3.9'
33
name: bass-application
44

55
networks:
6-
microservice:
6+
bass:
77
driver: bridge
8+
external: true
89

910
services:
1011
treble:
@@ -16,7 +17,7 @@ services:
1617
ports:
1718
- "2324:2324"
1819
networks:
19-
- microservice
20+
- bass
2021

2122
gateway:
2223
image: registry.cn-hangzhou.aliyuncs.com/docker-cooooing/gateway:latest
@@ -28,7 +29,7 @@ services:
2829
- "8000:8000"
2930
- "9000:9000"
3031
networks:
31-
- microservice
32+
- bass
3233

3334
infra:
3435
image: registry.cn-hangzhou.aliyuncs.com/docker-cooooing/infra:latest
@@ -40,7 +41,7 @@ services:
4041
- "8001:8000"
4142
- "9001:9000"
4243
networks:
43-
- microservice
44+
- bass
4445

4546
user:
4647
image: registry.cn-hangzhou.aliyuncs.com/docker-cooooing/user:latest
@@ -52,7 +53,7 @@ services:
5253
- "8002:8000"
5354
- "9002:9000"
5455
networks:
55-
- microservice
56+
- bass
5657

5758
content:
5859
image: registry.cn-hangzhou.aliyuncs.com/docker-cooooing/content:latest
@@ -64,7 +65,7 @@ services:
6465
- "8003:8000"
6566
- "9003:9000"
6667
networks:
67-
- microservice
68+
- bass
6869

6970
notify:
7071
image: registry.cn-hangzhou.aliyuncs.com/docker-cooooing/notify:latest
@@ -76,7 +77,7 @@ services:
7677
- "8004:8000"
7778
- "9004:9000"
7879
networks:
79-
- microservice
80+
- bass
8081

8182
im:
8283
image: registry.cn-hangzhou.aliyuncs.com/docker-cooooing/im:latest
@@ -88,7 +89,7 @@ services:
8889
- "8005:8000"
8990
- "9005:9000"
9091
networks:
91-
- microservice
92+
- bass
9293

9394
signal:
9495
image: registry.cn-hangzhou.aliyuncs.com/docker-cooooing/signal:latest
@@ -100,7 +101,7 @@ services:
100101
- "8006:8000"
101102
- "9006:9000"
102103
networks:
103-
- microservice
104+
- bass
104105

105106
connector:
106107
image: registry.cn-hangzhou.aliyuncs.com/docker-cooooing/connector:latest
@@ -112,4 +113,4 @@ services:
112113
- "8007:8000"
113114
- "9007:9000"
114115
networks:
115-
- microservice
116+
- bass

0 commit comments

Comments
 (0)