Skip to content

Commit

Permalink
chore: docker-compose-dev (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tohrusky authored Jul 14, 2024
1 parent e259499 commit fa6ba45
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 30 deletions.
2 changes: 1 addition & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
**/*.jfm
**/bin
**/charts
**/docker-compose*
scripts/docker-compose-dev.yml
**/compose*
**/Dockerfile*
**/node_modules
Expand Down
20 changes: 12 additions & 8 deletions .github/workflows/CI-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,28 +24,32 @@ jobs:
services:
db:
image: mysql:8.4.1
ports:
- "5432:3306"
env:
MYSQL_ROOT_PASSWORD: 123456
MYSQL_DATABASE: nuxbt
ports:
- "5432:3306"
TZ: Asia/Shanghai

redis:
image: redis
image: redis:7.2.5
ports:
- "6379:6379"
options: >- # wait until redis has started
--health-cmd "redis-cli ping"
--health-interval 5s
--health-timeout 3s
--health-retries 10
ports:
- 6379:6379
oss:
image: bitnami/minio:latest
image: bitnami/minio:2024.7.13
ports:
- "9000:9000"
- "9001:9001"
env:
MINIO_ACCESS_KEY: ChYm7ufIwNAOzq6PQPCA
MINIO_SECRET_KEY: udicP52IwRbmo2hf6lFvjUS7NP5BhlAdsGNIuDE5
MINIO_DEFAULT_BUCKETS: nuxbt:public
ports:
- "9000:9000"

steps:
- uses: actions/checkout@v3
Expand Down
5 changes: 2 additions & 3 deletions internal/router/api/v1/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@ import (
func NewAPI() *gin.Engine {
r := gin.New()
r.Use(logger.DefaultLogger(), gin.Recovery()) // 日志中间件
r.Use(middleware_cache.NewRateLimiter(
cache.Clients[cache.IPLimit], config.ServerConfig.RequestLimit, 60*time.Second), // 限流中间件
)
r.Use(middleware_cache.NewRateLimiter(cache.Clients[cache.IPLimit],
config.ServerConfig.RequestLimit, 60*time.Second)) // 限流中间件

r.GET("/", func(c *gin.Context) {
c.JSON(http.StatusOK, gin.H{
Expand Down
18 changes: 0 additions & 18 deletions scripts/README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1 @@
# scripts

MySQL

```bash
docker run --name some-mysql -e MYSQL_ROOT_PASSWORD=123456 -e MYSQL_DATABASE=nuxbt -e TZ=Asia/Shanghai -p 5432:3306 -d mysql:8.4.1
```

Redis

```bash
docker run --name some-redis -d --health-cmd "redis-cli ping" --health-interval 5s --health-timeout 3s --health-retries 10 -p 6379:6379 redis
```

Minio

```bash
docker run --name some-minio -d -e MINIO_ACCESS_KEY=ChYm7ufIwNAOzq6PQPCA -e MINIO_SECRET_KEY=udicP52IwRbmo2hf6lFvjUS7NP5BhlAdsGNIuDE5 -e MINIO_DEFAULT_BUCKETS=nuxbt:public -p 9000:9000 bitnami/minio:latest
```
37 changes: 37 additions & 0 deletions scripts/docker-compose-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
version: "3.8"

services:
db:
image: mysql:8.4.1
container_name: some-mysql
restart: always
ports:
- "5432:3306"
environment:
MYSQL_ROOT_PASSWORD: 123456
MYSQL_DATABASE: nuxbt
TZ: Asia/Shanghai

redis:
image: redis:7.2.5
container_name: some-redis
restart: always
ports:
- "6379:6379"
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 3s
retries: 10

oss:
image: bitnami/minio:2024.7.13
container_name: some-minio
restart: always
ports:
- "9000:9000"
- "9001:9001"
environment:
MINIO_ACCESS_KEY: ChYm7ufIwNAOzq6PQPCA
MINIO_SECRET_KEY: udicP52IwRbmo2hf6lFvjUS7NP5BhlAdsGNIuDE5
MINIO_DEFAULT_BUCKETS: nuxbt:public

0 comments on commit fa6ba45

Please sign in to comment.