Skip to content

Commit 91e8361

Browse files
committed
add mq
1 parent bb6899d commit 91e8361

File tree

3 files changed

+25
-1
lines changed

3 files changed

+25
-1
lines changed

docker-compose.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,24 @@ services:
1313
- ./data/postgres:/var/lib/postgresql/data
1414
networks:
1515
- sec_auto_ban
16+
mq:
17+
image: nats:latest
18+
container_name: mq
19+
restart: always
20+
command: --user sec_auto_ban --pass ${mq_password}
21+
networks:
22+
- sec_auto_ban
1623
sec-auto-ban:
1724
image: secreport/sec-auto-ban:latest
1825
container_name: sec_auto_ban
1926
restart: always
2027
depends_on:
2128
- postgres
29+
- mq
2230
environment:
2331
listen: 0.0.0.0:80
2432
db_dsn: postgres://sec_auto_ban:${db_password}@postgres:5432/sec_auto_ban?sslmode=disable&TimeZone=Asia/Shanghai
33+
mq_url: nats://sec_auto_ban:${mq_password}@mq:4222
2534
networks:
2635
- sec_auto_ban
2736
ports:

docker-compose_cn.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,24 @@ services:
1313
- ./data/postgres:/var/lib/postgresql/data
1414
networks:
1515
- sec_auto_ban
16+
mq:
17+
image: registry.ap-southeast-1.aliyuncs.com/sec-auto-ban/nats:latest
18+
container_name: mq
19+
restart: always
20+
command: --user sec_auto_ban --pass ${mq_password}
21+
networks:
22+
- sec_auto_ban
1623
sec-auto-ban:
1724
image: registry.ap-southeast-1.aliyuncs.com/sec-auto-ban/sec-auto-ban:latest
1825
container_name: sec_auto_ban
1926
restart: always
2027
depends_on:
2128
- postgres
29+
- mq
2230
environment:
2331
listen: 0.0.0.0:80
2432
db_dsn: postgres://sec_auto_ban:${db_password}@postgres:5432/sec_auto_ban?sslmode=disable&TimeZone=Asia/Shanghai
33+
mq_url: nats://sec_auto_ban:${mq_password}@mq:4222
2534
networks:
2635
- sec_auto_ban
2736
ports:

run.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,13 @@ downloadDockerCompose(){
1919

2020
createPassword(){
2121
if [ ! -f ".env" ]; then
22-
echo "db_password=$(uuidgen |sed 's/-//g')" > .env
22+
touch .env
23+
fi
24+
if ! grep -q "db_password=" .env; then
25+
echo "db_password=$(uuidgen | sed 's/-//g')" >> .env
26+
fi
27+
if ! grep -q "mq_password" .env; then
28+
echo "mq_password=$(uuidgen | sed 's/-//g')" >> .env
2329
fi
2430
}
2531

0 commit comments

Comments
 (0)