aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--Makefile52
-rw-r--r--Makefile.prod39
-rw-r--r--compose.local.yaml54
-rw-r--r--compose.prod.yaml (renamed from compose.yaml)29
4 files changed, 124 insertions, 50 deletions
diff --git a/Makefile b/Makefile
index 07f682f..b15a2bb 100644
--- a/Makefile
+++ b/Makefile
@@ -1,42 +1,52 @@
+DOCKER_COMPOSE := docker compose -f compose.local.yaml
+
.PHONY: build
build:
- docker compose build
+ ${DOCKER_COMPOSE} build
+ cd frontend; npm install
.PHONY: up
up:
- docker compose up -d
+ ${DOCKER_COMPOSE} up -d
+ cd frontend; npm run dev
.PHONY: down
down:
- docker compose down
-
-.PHONY: api-server-only-build
-api-server-only-build:
- docker compose build api-server-only
-
-.PHONY: api-server-only-up
-api-server-only-up:
- docker compose up -d api-server-only
+ ${DOCKER_COMPOSE} down
-.PHONY: api-server-only-down
-api-server-only-down:
- docker compose down api-server-only db
+.PHONY: logs
+logs:
+ ${DOCKER_COMPOSE} logs
.PHONY: psql
psql:
- docker compose exec db psql --user=postgres albatross
+ ${DOCKER_COMPOSE} up --wait db
+ ${DOCKER_COMPOSE} exec db psql --user=postgres albatross
+
+.PHONY: psql-query
+psql-query:
+ ${DOCKER_COMPOSE} up --wait db
+ ${DOCKER_COMPOSE} exec --no-TTY db psql --user=postgres albatross
.PHONY: sqldef-dryrun
sqldef-dryrun: down
- docker compose build db
- docker compose up -d db
- docker compose run --no-TTY tools psqldef --dry-run < ./backend/schema.sql
+ ${DOCKER_COMPOSE} build db
+ ${DOCKER_COMPOSE} up --wait db
+ ${DOCKER_COMPOSE} run --no-TTY tools psqldef --dry-run < ./backend/schema.sql
.PHONY: sqldef
sqldef: down
- docker compose build db
- docker compose up -d db
- docker compose run --no-TTY tools psqldef < ./backend/schema.sql
+ ${DOCKER_COMPOSE} build db
+ ${DOCKER_COMPOSE} up --wait db
+ ${DOCKER_COMPOSE} run --no-TTY tools psqldef < ./backend/schema.sql
+
+.PHONY: init
+init: build initdb
+
+.PHONY: initdb
+initdb:
+ make psql-query < ./backend/schema.sql
+ make psql-query < ./backend/fixtures/dev.sql
.PHONY: oapi-codegen
oapi-codegen:
diff --git a/Makefile.prod b/Makefile.prod
new file mode 100644
index 0000000..05901f0
--- /dev/null
+++ b/Makefile.prod
@@ -0,0 +1,39 @@
+DOCKER_COMPOSE := docker compose -f compose.prod.yaml
+
+.PHONY: build
+build:
+ ${DOCKER_COMPOSE} build
+
+.PHONY: up
+up:
+ ${DOCKER_COMPOSE} up -d
+
+.PHONY: down
+down:
+ ${DOCKER_COMPOSE} down
+
+.PHONY: logs
+logs:
+ ${DOCKER_COMPOSE} logs
+
+.PHONY: psql
+psql:
+ ${DOCKER_COMPOSE} up --wait db
+ ${DOCKER_COMPOSE} exec db psql --user=postgres albatross
+
+.PHONY: psql-query
+psql-query:
+ ${DOCKER_COMPOSE} up --wait db
+ ${DOCKER_COMPOSE} exec --no-TTY db psql --user=postgres albatross
+
+.PHONY: sqldef-dryrun
+sqldef-dryrun: down
+ ${DOCKER_COMPOSE} build db
+ ${DOCKER_COMPOSE} up --wait db
+ ${DOCKER_COMPOSE} run --no-TTY tools psqldef --dry-run < ./backend/schema.sql
+
+.PHONY: sqldef
+sqldef: down
+ ${DOCKER_COMPOSE} build db
+ ${DOCKER_COMPOSE} up --wait db
+ ${DOCKER_COMPOSE} run --no-TTY tools psqldef < ./backend/schema.sql
diff --git a/compose.local.yaml b/compose.local.yaml
new file mode 100644
index 0000000..6e5604f
--- /dev/null
+++ b/compose.local.yaml
@@ -0,0 +1,54 @@
+services:
+ api-server:
+ build:
+ context: ./backend
+ ports:
+ - '127.0.0.1:8002:80'
+ depends_on:
+ db:
+ condition: service_healthy
+ environment:
+ ALBATROSS_DB_HOST: db
+ ALBATROSS_DB_PORT: 5432
+ ALBATROSS_DB_USER: postgres
+ ALBATROSS_DB_PASSWORD: eepei5reesoo0ov2ceelahd4Emi0au8ahJa6oochohheiquahweihoovahsee1oo
+ ALBATROSS_DB_NAME: albatross
+ restart: always
+
+ db:
+ image: postgres:16.3
+ environment:
+ POSTGRES_USER: postgres
+ POSTGRES_PASSWORD: eepei5reesoo0ov2ceelahd4Emi0au8ahJa6oochohheiquahweihoovahsee1oo
+ POSTGRES_DB: albatross
+ expose:
+ - 5432
+ healthcheck:
+ test: ["CMD-SHELL", "pg_isready -U postgres"]
+ interval: 10s
+ timeout: 5s
+ retries: 5
+ volumes:
+ - db-data:/var/lib/postgresql/data
+ restart: always
+
+ worker:
+ build:
+ context: ./worker
+ expose:
+ - 80
+ restart: always
+
+ tools:
+ build:
+ context: ./backend
+ dockerfile: ./Dockerfile.tools
+ environment:
+ POSTGRES_USER: postgres
+ POSTGRES_PASSWORD: eepei5reesoo0ov2ceelahd4Emi0au8ahJa6oochohheiquahweihoovahsee1oo
+ POSTGRES_DB: albatross
+ profiles:
+ - tools
+
+volumes:
+ db-data:
diff --git a/compose.yaml b/compose.prod.yaml
index a98b918..a7c64ab 100644
--- a/compose.yaml
+++ b/compose.prod.yaml
@@ -26,24 +26,6 @@ services:
ALBATROSS_DB_NAME: albatross
restart: always
- api-server-only:
- build:
- context: ./backend
- ports:
- - '127.0.0.1:8002:80'
- depends_on:
- db:
- condition: service_healthy
- environment:
- ALBATROSS_DB_HOST: db
- ALBATROSS_DB_PORT: 5432
- ALBATROSS_DB_USER: postgres
- ALBATROSS_DB_PASSWORD: eepei5reesoo0ov2ceelahd4Emi0au8ahJa6oochohheiquahweihoovahsee1oo
- ALBATROSS_DB_NAME: albatross
- restart: always
- profiles:
- - api-server-only
-
app-server:
build:
context: ./frontend
@@ -77,16 +59,5 @@ services:
- 80
restart: always
- tools:
- build:
- context: ./backend
- dockerfile: ./Dockerfile.tools
- environment:
- POSTGRES_USER: postgres
- POSTGRES_PASSWORD: eepei5reesoo0ov2ceelahd4Emi0au8ahJa6oochohheiquahweihoovahsee1oo
- POSTGRES_DB: albatross
- profiles:
- - tools
-
volumes:
db-data: