Skip to content

Commit 3ef2411

Browse files
authored
Merge pull request #7 from lost-rob0t/docker-compose-fixes
fix(docker): extra_hosts fixes the host not found
2 parents 769e0d7 + a56d212 commit 3ef2411

File tree

5 files changed

+149
-13
lines changed

5 files changed

+149
-13
lines changed

Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ FROM build as star-server
2727

2828
VOLUME /config
2929
EXPOSE 5000
30+
EXPOSE 4009 # NOTE Debug port do not expose in production.
3031
RUN echo '#!/bin/sh\n\
3132
set -e\n\
3233
# Check if /config/init.lisp exists; if not, use /root/init.lisp\n\

docker-compose.override.dev.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
version: '3.8'
2+
# This is the compose to be used for hacking on gserver
3+
# No state is set just restart to get to a blank state
4+
services:
5+
couchdb:
6+
container_name: "couchdb"
7+
hostname: couchdb
8+
volumes: !reset []
9+
image: ibmcom/couchdb3
10+
environment:
11+
COUCHDB_USER: admin
12+
COUCHDB_PASSWORD: password
13+
ports:
14+
- "5984:5984"
15+
networks:
16+
- star
17+
18+
rabbitmq:
19+
image: rabbitmq:management
20+
hostname: rabbitmq
21+
container_name: "rabbitmq"
22+
environment:
23+
RABBITMQ_DEFAULT_USER: guest
24+
RABBITMQ_DEFAULT_PASS: guest
25+
volumes: !reset []
26+
ports:
27+
- "5672:5672"
28+
- "15672:15672"
29+
networks:
30+
- star
31+
32+
star-server:
33+
hostname: star-server
34+
container_name: "star-server"
35+
restart: always
36+
build: .
37+
volumes:
38+
- ./config:/config
39+
environment:
40+
BUILD_MODE: DEV
41+
ports:
42+
- "4009:4009"
43+
- "5000:5000"
44+
networks:
45+
- star
46+
- default
47+
depends_on:
48+
- couchdb
49+
- rabbitmq
50+
extra_hosts:
51+
- host.docker.internal:host-gateway
52+
53+
networks:
54+
star:
55+
name: star
56+
default:

docker-compose.override.prod.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
version: '3.8'
2+
# This is an example production compose file
3+
# instead of using a named volume this bind mounds the state for couchdb and rabbitmq to a dir
4+
# TODO Nginx rev proxy
5+
services:
6+
couchdb:
7+
container_name: "couchdb"
8+
hostname: couchdb
9+
image: ibmcom/couchdb3
10+
volumes:
11+
- ./state/couchdb:/opt/couchdb/data
12+
environment:
13+
#NOTE CHANGE ME
14+
COUCHDB_USER: admin
15+
COUCHDB_PASSWORD: password
16+
ports:
17+
- "5984:5984"
18+
networks:
19+
- star
20+
21+
rabbitmq:
22+
image: rabbitmq:management
23+
hostname: rabbitmq
24+
container_name: "rabbitmq"
25+
environment:
26+
#NOTE CHANGEME
27+
RABBITMQ_DEFAULT_USER: guest
28+
RABBITMQ_DEFAULT_PASS: guest
29+
ports:
30+
- "5672:5672"
31+
- "15672:15672"
32+
volumes:
33+
- ./state/rabbitmq:/var/lib/rabbitmq
34+
networks:
35+
- star
36+
star-server:
37+
hostname: star-server
38+
container_name: "star-server"
39+
restart: always
40+
build: .
41+
volumes:
42+
# You can copy example_configs to ./config in order to configure star-server
43+
- ./config:/config
44+
ports:
45+
# port 4009 is a debugging port and you MUST disable it during prod use
46+
- "5000:5000"
47+
networks:
48+
- star
49+
- default
50+
depends_on:
51+
- couchdb
52+
- rabbitmq
53+
extra_hosts:
54+
- host.docker.internal:host-gateway
55+
56+
57+
58+
networks:
59+
star:
60+
name: star
61+
default:
62+
volumes:
63+
couchdb:
64+
rabbitmq:

docker-compose.yml

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ services:
66
hostname: couchdb
77
image: ibmcom/couchdb3
88
volumes:
9-
- couchdb_data:/opt/couchdb/data
9+
- couchdb:/opt/couchdb/data
1010
environment:
1111
#NOTE CHANGE ME
1212
COUCHDB_USER: admin
@@ -27,30 +27,38 @@ services:
2727
ports:
2828
- "5672:5672"
2929
- "15672:15672"
30+
volumes:
31+
- rabbitmq:/var/lib/rabbitmq
3032
networks:
3133
- star
3234
star-server:
35+
hostname: star-server
3336
container_name: "star-server"
3437
restart: always
35-
image: star-server:latest
36-
hostname: star-server
38+
build: .
3739
volumes:
38-
- ./init.lisp:/root/init.lisp
40+
# You can copy example_configs to ./config in order to configure star-server
41+
- ./config:/config
3942
environment:
4043
BUILD_MODE: DEV
4144
ports:
45+
# port 4009 is a debugging port and you MUST disable it during prod use
4246
- "5000:5000"
4347
networks:
4448
- star
49+
- default
4550
depends_on:
4651
- couchdb
4752
- rabbitmq
53+
extra_hosts:
54+
- host.docker.internal:host-gateway
4855

4956

5057

51-
volumes:
52-
couchdb_data:
53-
5458
networks:
5559
star:
5660
name: star
61+
default:
62+
volumes:
63+
couchdb:
64+
rabbitmq:

example_configs/init.lisp

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,21 @@
11
;; Example config
22
(in-package :star)
3-
(format t "Starting starintel....")
4-
(setq *rabbit-address* "rabbitmq")
5-
(setq *couchdb-host* "couchdb")
6-
(setq *couchdb-default-database* "starintel")
3+
(format t "Starting starintel....~%")
4+
(log:info "RabbitMQ Service: ~a~%" (setf *rabbit-address* "rabbitmq"))
5+
(log:info "Couchdb Service: ~a~%" (setf *couchdb-host* "couchdb"))
6+
(log:info "Listening On ~a : ~a~%" (setf *http-scheme* "http") (setf *http-api-address* "0.0.0.0"))
7+
78
;; You can invoke sylnk like so
89
;; (start-debugger)
910
;; Set log config path to logs
10-
(log:config :daily "logs/gserver.log"
11+
;; here it defaults to the /config/logs/star-server.log
12+
;; Just uncomment this if you want to not use docker the docker volumne
13+
;; TODO Make a docker vol for logs, instead of writing to the config dir SECURITY risk
14+
;; (log:config :daily "./logs/gserver.log"
15+
;; :file2
16+
;; :sane)
17+
(log:config :daily "/config/logs/gserver.log"
1118
:file2
1219
:sane)
1320

14-
;;
21+

0 commit comments

Comments
 (0)