Skip to content

Commit 6b7ae48

Browse files
committed
Fixes for start-dev and optimisations
1 parent bc3d9ec commit 6b7ae48

File tree

4 files changed

+52
-41
lines changed

4 files changed

+52
-41
lines changed

backend/Taskfile.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,6 @@ tasks:
3838
sh: git log -n 1 --format=%h
3939
VERSION:
4040
sh: cat ../.version
41-
env:
42-
GO111MODULE: on
43-
CGO_ENABLED: 1
4441

4542
lint:
4643
desc: Linting

docker/dev/Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ ENV GOPROXY=$GOPROXY \
1616
ACMESH_HOME=/data/.acme.sh \
1717
CERT_HOME=/data/.acme.sh/certs \
1818
LE_CONFIG_HOME=/data/.acme.sh/config \
19-
LE_WORKING_DIR=/data/.acme.sh
19+
LE_WORKING_DIR=/data/.acme.sh \
20+
CGO_ENABLED=1 \
21+
GO111MODULE=on
2022

2123
RUN echo "fs.file-max = 65535" > /etc/sysctl.conf
2224

docker/docker-compose.dev.yml

Lines changed: 42 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,13 @@ services:
44

55
npm:
66
image: nginxproxymanager:dev
7+
container_name: "npm.dev"
78
build:
8-
context: ./
9-
dockerfile: ./dev/Dockerfile
9+
context: ../
10+
dockerfile: ./docker/dev/Dockerfile
11+
args:
12+
GOPROXY: "${GOPROXY:-}"
13+
GOPRIVATE: "${GOPRIVATE:-}"
1014
ports:
1115
- 3080:80
1216
- 3081:81
@@ -15,26 +19,38 @@ services:
1519
DEVELOPMENT: 'true'
1620
GOPROXY: "${GOPROXY:-}"
1721
GOPRIVATE: "${GOPRIVATE:-}"
18-
YARN_REGISTRY: "${DAB_YARN_REGISTRY:-}"
22+
YARN_REGISTRY: "${YARN_REGISTRY:-}"
1923
NPM_LOG_LEVEL: 'debug'
2024
PUID: 1000
2125
PGID: 1000
2226
volumes:
2327
- /etc/localtime:/etc/localtime:ro
2428
- ../:/app
2529
- ./rootfs/var/www/html:/var/www/html
26-
- ../data:/data
2730
- ./dev/resolv.conf:/etc/resolv.conf:ro
31+
- npm_data_vol:/data
2832
working_dir: /app
2933
networks:
3034
default:
3135
aliases:
3236
- website1.internal
3337
- website2.internal
3438
- website3.internal
39+
restart: unless-stopped
3540

36-
pebble:
41+
npm-stepca:
42+
image: nginxproxymanager/testca
43+
container_name: "npm.stepca"
44+
volumes:
45+
- ./dev/resolv.conf:/etc/resolv.conf:ro
46+
networks:
47+
default:
48+
aliases:
49+
- ca.internal
50+
51+
npm-pebble:
3752
image: letsencrypt/pebble
53+
container_name: "npm.pebble"
3854
command: pebble -config /test/config/pebble-config.json
3955
environment:
4056
PEBBLE_VA_SLEEPTIME: 2
@@ -47,17 +63,20 @@ services:
4763
# required for https cert dns san
4864
- pebble
4965

50-
stepca:
51-
image: nginxproxymanager/testca
52-
volumes:
53-
- ./dev/resolv.conf:/etc/resolv.conf:ro
54-
networks:
55-
default:
56-
aliases:
57-
- ca.internal
66+
npm-swagger:
67+
image: swaggerapi/swagger-ui:latest
68+
container_name: "npm.swagger"
69+
ports:
70+
- 3001:80
71+
environment:
72+
URL: "http://${SWAGGER_PUBLIC_DOMAIN:-127.0.0.1:3081}/api/schema"
73+
PORT: '80'
74+
depends_on:
75+
- npm
5876

59-
pdns:
77+
npm-pdns:
6078
image: pschiffe/pdns-mysql
79+
container_name: "npm.pdns"
6180
volumes:
6281
- '/etc/localtime:/etc/localtime:ro'
6382
environment:
@@ -71,45 +90,38 @@ services:
7190
PDNS_version_string: 'anonymous'
7291
PDNS_default_ttl: 1500
7392
PDNS_allow_axfr_ips: '127.0.0.0/8,192.0.0.0/8,10.0.0.0/8,172.0.0.0/8'
74-
PDNS_gmysql_host: pdns-db
93+
PDNS_gmysql_host: npm-pdns-db
7594
PDNS_gmysql_port: 3306
7695
PDNS_gmysql_user: pdns
7796
PDNS_gmysql_password: pdns
7897
PDNS_gmysql_dbname: pdns
7998
depends_on:
80-
- pdns-db
99+
- npm-pdns-db
81100
networks:
82101
default:
83102
aliases:
84103
- ns1.pdns
85104
- ns2.pdns
86105

87-
pdns-db:
106+
npm-pdns-db:
88107
image: mariadb:10.7.1
108+
container_name: "npm.pdns.db"
89109
environment:
90110
MYSQL_ROOT_PASSWORD: 'pdns'
91111
MYSQL_DATABASE: 'pdns'
92112
MYSQL_USER: 'pdns'
93113
MYSQL_PASSWORD: 'pdns'
94114
volumes:
95-
- pdns_mysql_vol:/var/lib/mysql
115+
- npm_pdns_mysql_vol:/var/lib/mysql
96116
- /etc/localtime:/etc/localtime:ro
97117
- ./dev/pdns-db.sql:/docker-entrypoint-initdb.d/01_init.sql:ro
98118

99-
dnsrouter:
119+
npm-dnsrouter:
100120
image: jc21/dnsrouter
121+
container_name: "npm.dnsrouter"
101122
volumes:
102123
- ./dev/dnsrouter-config.json.tmp:/dnsrouter-config.json:ro
103124

104-
swagger:
105-
image: swaggerapi/swagger-ui:latest
106-
ports:
107-
- 3001:80
108-
environment:
109-
URL: "http://${SWAGGER_PUBLIC_DOMAIN:-127.0.0.1:3081}/api/schema"
110-
PORT: '80'
111-
depends_on:
112-
- npm
113-
114125
volumes:
115-
pdns_mysql_vol:
126+
npm_data_vol:
127+
npm_pdns_mysql_vol:

scripts/start-dev

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ if hash docker-compose 2>/dev/null; then
1919
echo -e "${BLUE}${CYAN}Starting Dev Stack ...${RESET}"
2020

2121
# Bring up a stack, in steps so we can inject IPs everywhere
22-
docker-compose up -d pdns pdns-db
23-
PDNS_IP=$(get_container_ip "pdns")
22+
docker-compose up -d npm-pdns npm-pdns-db
23+
PDNS_IP=$(get_container_ip 'npm-pdns')
2424
echo -e "${BLUE}${YELLOW}PDNS IP is ${PDNS_IP}${RESET}"
2525

2626
# adjust the dnsrouter config
@@ -30,8 +30,8 @@ if hash docker-compose 2>/dev/null; then
3030
jq --arg a "$PDNS_IP" '.servers[0].upstreams[1].upstream = $a' "$LOCAL_DNSROUTER_CONFIG" > "$LOCAL_DNSROUTER_CONFIG.tmp"
3131

3232
# dnsrouter
33-
docker-compose up -d dnsrouter
34-
DNSROUTER_IP=$(get_container_ip 'dnsrouter')
33+
docker-compose up -d npm-dnsrouter
34+
DNSROUTER_IP=$(get_container_ip 'npm-dnsrouter')
3535
echo -e "${BLUE}${YELLOW}DNS Router IP is ${DNSROUTER_IP}${RESET}"
3636

3737
# mount the resolver
@@ -40,14 +40,14 @@ if hash docker-compose 2>/dev/null; then
4040
printf "nameserver %s\noptions ndots:0" "${DNSROUTER_IP}" > "${LOCAL_RESOLVE}"
4141

4242
# bring things up, but only what we haven't already created
43-
docker-compose up -d --remove-orphans --force-recreate --build npm pebble stepca swagger
43+
docker-compose up -d --remove-orphans --force-recreate --build npm npm-pebble npm-stepca npm-swagger
4444

4545
if [ "$1" == "-f" ]; then
4646
echo -e "${BLUE}${YELLOW}Following Backend Container:${RESET}"
47-
docker logs -f npmdev-npm-1
47+
docker logs -f npm.dev
4848
else
4949
echo -e "${YELLOW}Tip:${RESET} You can follow the output of some of the containers with:"
50-
echo " docker logs -f npmdev-npm-1"
50+
echo " docker logs -f npm.dev"
5151
echo -e "${YELLOW}Tip:${RESET} Open a database terminal with:"
5252
echo " ./scripts/sqlite"
5353
fi

0 commit comments

Comments
 (0)