Skip to content

Commit

Permalink
1434-docker-compose - backend selection on startup
Browse files Browse the repository at this point in the history
Signed-off-by: desmax74 <[email protected]>
  • Loading branch information
desmax74 committed Oct 27, 2023
1 parent 83b892c commit cb4bafc
Show file tree
Hide file tree
Showing 10 changed files with 180 additions and 67 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ start-service: check-docker-compose-tool-check
# not handle that well.
#
# if container images are missing, run `make container` first
$(CONTAINER) compose up --force-recreate
$(CONTAINER) compose -f docker-compose.yml -f container_files/mem.yaml up --force-recreate

# to flush state, service-stop must be used else state is taken from old containers
.PHONY: stop-service
Expand Down
6 changes: 3 additions & 3 deletions arango.docker-compose.yaml → container_files/arango.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: "3.8"
version: "3.9"

volumes:
arangodb_data_container:
Expand All @@ -19,7 +19,7 @@ services:
ports:
- "$GUAC_API_PORT:8080"
volumes:
- ./container_files/guac:/guac
- ./container_files/arango:/guac
healthcheck:
test: ["CMD", "wget", "--spider", "http://localhost:8080"]
interval: 10s
Expand All @@ -41,4 +41,4 @@ services:
interval: 10s
timeout: 10s
retries: 3
start_period: 1s
start_period: 1s
26 changes: 26 additions & 0 deletions container_files/arango/guac.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# nats
nats-addr: nats://nats:4222

# collect-sub
csub-addr: guac-collectsub:2782
csub-listen-port: 2782

# graphql
gql-backend: arango
gql-listen-port: 8080
gql-debug: true
gql-test-data: false
gql-addr: http://guac-graphql:8080/query

# collector polling
service-poll: true
use-csub: true

# certifier polling
poll: true
interval: 5m

# arangodb
arango-user: root
arango-pass: test123
arango-addr: http://arangodb:8529
36 changes: 36 additions & 0 deletions container_files/ent.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
version: "3.9"

services:

postgres:
image: docker.io/library/postgres:16
environment:
POSTGRES_USER: guac
POSTGRES_PASSWORD: guac
POSTGRES_HOST_AUTH_METHOD: trust
networks: [frontend]
ports:
- "5432:5432"
volumes:
- ./container_files/pg:/var/lib/postgresql/data


guac-graphql:
networks: [frontend]
image: $GUAC_IMAGE
command: "/opt/guac/guacgql"
working_dir: /guac
restart: on-failure
depends_on:
nats:
condition: service_healthy
ports:
- "$GUAC_API_PORT:8080"
volumes:
- ./container_files/ent:/guac:z
healthcheck:
test: ["CMD", "wget", "--spider", "http://localhost:8080"]
interval: 10s
timeout: 10s
retries: 3
start_period: 5s
26 changes: 26 additions & 0 deletions container_files/ent/guac.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# nats
nats-addr: nats://nats:4222

# collect-sub
csub-addr: guac-collectsub:2782
csub-listen-port: 2782

# graphql
gql-backend: ent
gql-listen-port: 8080
gql-debug: true
gql-test-data: false
gql-addr: http://guac-graphql:8080/query

# collector polling
service-poll: true
use-csub: true

# certifier polling
poll: true
interval: 5m

# Ent config
db-driver: postgres
db-address: postgres://guac:guac@postgres:5432/guac?sslmode=disable
db-migrate: true
18 changes: 1 addition & 17 deletions container_files/guac/guac.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,3 @@
# arangodb
arango-user: root
arango-pass: test123
arango-addr: http://arangodb:8529

# neo4j
neo4j-user: neo4j
neo4j-pass: s3cr3t
neo4j-addr: neo4j://neo4j:7687
neo4j-realm: neo4j

# nats
nats-addr: nats://nats:4222

Expand All @@ -28,9 +17,4 @@ use-csub: true

# certifier polling
poll: true
interval: 5m

# Ent config
db-driver: postgres
db-address: postgres://guac:guac@postgres:5432/guac?sslmode=disable
db-migrate: true
interval: 5m
23 changes: 23 additions & 0 deletions container_files/mem.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
version: "3.9"

services:

guac-graphql:
networks: [frontend]
image: $GUAC_IMAGE
command: "/opt/guac/guacgql"
working_dir: /guac
restart: on-failure
depends_on:
nats:
condition: service_healthy
ports:
- "$GUAC_API_PORT:8080"
volumes:
- ./container_files/guac:/guac:z
healthcheck:
test: ["CMD", "wget", "--spider", "http://localhost:8080"]
interval: 10s
timeout: 10s
retries: 3
start_period: 5s
37 changes: 37 additions & 0 deletions container_files/neo4j.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
version: "3.9"

services:

neo4j:
image: "neo4j:4.4.9-community"
environment:
NEO4J_AUTH: "neo4j/s3cr3t"
NEO4J_apoc_export_file_enabled: true
NEO4J_apoc_import_file_enabled: true
NEO4J_apoc_import_file_use__neo4j__config: true
NEO4JLABS_PLUGINS: '["apoc"]'
ports:
- "7474:7474"
- "7687:7687"
restart: on-failure


guac-graphql:
networks: [frontend]
image: $GUAC_IMAGE
command: "/opt/guac/guacgql"
working_dir: /guac
restart: on-failure
depends_on:
nats:
condition: service_healthy
ports:
- "$GUAC_API_PORT:8080"
volumes:
- ./container_files/neo4j:/guac:z
healthcheck:
test: ["CMD", "wget", "--spider", "http://localhost:8080"]
interval: 10s
timeout: 10s
retries: 3
start_period: 5s
27 changes: 27 additions & 0 deletions container_files/neo4j/guac.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# nats
nats-addr: nats://nats:4222

# collect-sub
csub-addr: guac-collectsub:2782
csub-listen-port: 2782

# graphql
gql-backend: neo4j
gql-listen-port: 8080
gql-debug: true
gql-test-data: false
gql-addr: http://guac-graphql:8080/query

# collector polling
service-poll: true
use-csub: true

# certifier polling
poll: true
interval: 5m

# Neo4j details
neo4j-user: neo4j
neo4j-pass: s3cr3t
neo4j-addr: neo4j://localhost:7687
neo4j-realm: neo4j
46 changes: 0 additions & 46 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,6 @@
version: "3.9"

services:
# Neo4j is turned down for now since we are currently only using the in memory backend
# neo4j:
# image: "neo4j:4.4.9-community"
# environment:
# NEO4J_AUTH: "neo4j/s3cr3t"
# NEO4J_apoc_export_file_enabled: true
# NEO4J_apoc_import_file_enabled: true
# NEO4J_apoc_import_file_use__neo4j__config: true
# NEO4JLABS_PLUGINS: '["apoc"]'
# ports:
# - "7474:7474"
# - "7687:7687"
# restart: on-failure

# Ent on postgres is turned down for now since we are currently only using the in memory backend
# postgres:
# image: docker.io/library/postgres:16
# environment:
# POSTGRES_USER: guac
# POSTGRES_PASSWORD: guac
# POSTGRES_HOST_AUTH_METHOD: trust
# networks: [frontend]
# ports:
# - "5432:5432"
# volumes:
# - ./container_files/pg:/var/lib/postgresql/data

nats:
networks: [frontend]
Expand Down Expand Up @@ -66,26 +40,6 @@ services:
retries: 3
start_period: 5s

guac-graphql:
networks: [frontend]
image: $GUAC_IMAGE
command: "/opt/guac/guacgql"
working_dir: /guac
restart: on-failure
depends_on:
nats:
condition: service_healthy
ports:
- "$GUAC_API_PORT:8080"
volumes:
- ./container_files/guac:/guac:z
healthcheck:
test: ["CMD", "wget", "--spider", "http://localhost:8080"]
interval: 10s
timeout: 10s
retries: 3
start_period: 5s

guac-ingestor:
networks: [frontend]
image: $GUAC_IMAGE
Expand Down

0 comments on commit cb4bafc

Please sign in to comment.