Skip to content

Commit

Permalink
feat(explorer/graphql): dockerize graphql and make commands (#188)
Browse files Browse the repository at this point in the history
creating docker container and graphql in go-releaser and make commands
for ease of use

task: none
  • Loading branch information
DanFlannel authored Jan 30, 2024
1 parent 80c8c77 commit bf67db0
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 14 deletions.
12 changes: 12 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ builds:
goos: [ linux, darwin ]
goarch: [ amd64, arm64 ]

- id: explorer-graphql
main: ./explorer/graphql
binary: /explorer/graphql
env: [ CGO_ENABLED=0 ]
goos: [ linux, darwin ]
goarch: [ amd64, arm64 ]

- id: explorer-indexer
main: ./explorer/indexer
binary: explorer/indexer
Expand Down Expand Up @@ -53,6 +60,11 @@ dockers:
- omniops/explorer-api:{{ if .IsSnapshot }}main{{ else }}latest{{ end }}
- omniops/explorer-api:{{ if .IsSnapshot }}main{{ else }}{{.Tag}}{{ end }}

- ids: [explorer-graphql]
dockerfile: ./explorer/graphql/Dockerfile
image_templates:
- omniops/explorer-graphql:latest

- ids: [explorer-indexer]
dockerfile: ./explorer/indexer/Dockerfile
image_templates:
Expand Down
17 changes: 17 additions & 0 deletions explorer/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,20 @@ gen-api: ## generates our openapi.yaml bindings for the api and ui

gen-db: ## generates our ent orm schemas
make -C ./db gen

open-dev: ## opens all of the local host endpoints
python -m webbrowser "http://localhost:3000"
python -m webbrowser "http://localhost:8080"

build: ## builds our docker images
make -C ../ build-docker

run: ## runs our docker compose up
docker-compose up

stop: ## stops our docker compose
docker-compose down

run-clean: ## docker build and run
make -C ./ build
make -C ./ run
39 changes: 25 additions & 14 deletions explorer/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,43 @@ version: '3.9'
services:
db:
image: postgres:14-alpine
ports:
- 5432:5432
volumes:
- ~/apps/postgres:/var/lib/postgresql/data
container_name: omni-db
environment:
- POSTGRES_PASSWORD=omni_secret
- POSTGRES_USER=omni_user
- POSTGRES_DB=omni_db
POSTGRES_DB: omni_db
POSTGRES_USER: omni
POSTGRES_PASSWORD: password
ports: 5432:5432
healthcheck:
test: [ "CMD-SHELL", "pg_isready -U omni -d omni_db" ]
interval: 3s
timeout: 5s
retries: 5
restart: unless-stopped

ui:
build:
context: ./ui
dockerfile: Dockerfile
ports:
- 3000
- 3000:3000
depends_on:
- db
db:
condition: service_healthy

api:
image: omniops/explorer-api
graphql:
image: omniops/explorer-graphql
ports:
- 8080
- 8080:8080
depends_on:
- db
db:
condition: service_healthy

indexer:
image: omniops/explorer-indexer
expose:
- 8081
ports:
- 8081:8081
depends_on:
- db
db:
condition: service_healthy

0 comments on commit bf67db0

Please sign in to comment.