mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-05-24 15:25:43 +00:00
.
This commit is contained in:
committed by
Adnan Zahir
parent
d41e16cab9
commit
ad815b3412
@@ -1,23 +1,18 @@
|
||||
# --- Load .env kalau ada, dan export ke shell child ---
|
||||
ifneq (,$(wildcard .env))
|
||||
include .env
|
||||
export
|
||||
endif
|
||||
# ===============================
|
||||
# LTI-API Makefile (Docker Setup)
|
||||
# ===============================
|
||||
|
||||
# --- Konfigurasi umum ---
|
||||
COMPOSE ?= docker compose -f docker-compose.local.yml
|
||||
NETWORK ?= lti-api_go-network
|
||||
MIGRATE_IMAGE ?= migrate/migrate
|
||||
MIGRATIONS_DIR := $(PWD)/internal/database/migrations
|
||||
APP_NAME := lti-api
|
||||
COMPOSE := docker compose -f docker-compose.yaml
|
||||
NETWORK := lti-network
|
||||
ENV_FILE := .env.lti-api
|
||||
|
||||
# Fallback agar tetap jalan meski .env kosong
|
||||
DB_HOST ?= postgresdb
|
||||
DB_PORT ?= 5432
|
||||
DB_USER ?= postgres
|
||||
DB_PASSWORD ?= postgres
|
||||
DB_NAME ?= db_lti_erp
|
||||
include $(ENV_FILE)
|
||||
export $(shell sed 's/=.*//' $(ENV_FILE))
|
||||
|
||||
DB_URL := postgres://$(DB_USER):$(DB_PASSWORD)@$(DB_HOST):$(DB_PORT)/$(DB_NAME)?sslmode=disable
|
||||
MIGRATIONS_DIR := ./migrations
|
||||
MIGRATE_IMAGE := migrate/migrate:v4.15.2
|
||||
DB_URL := postgres://$(DB_USER):$(DB_PASSWORD)@lti-postgres:5432/$(DB_NAME)?sslmode=disable
|
||||
|
||||
# Tunggu DB ready memakai pg_isready dari image postgres
|
||||
WAIT_DB := docker run --rm --network $(NETWORK) postgres:alpine \
|
||||
@@ -106,15 +101,11 @@ docker-nuke:
|
||||
docker-cache:
|
||||
@docker builder prune -f
|
||||
|
||||
# --- PSQL shell ke DB di container ---
|
||||
psql: db-up
|
||||
@$(COMPOSE) exec -it postgresdb psql -U $(DB_USER) -d $(DB_NAME)
|
||||
logs:
|
||||
@$(COMPOSE) logs -f app
|
||||
|
||||
# Single feature
|
||||
# example: make gen feat=product-category
|
||||
restart:
|
||||
@$(COMPOSE) restart
|
||||
|
||||
# Sub feature
|
||||
# make gen feat=master/area
|
||||
gen:
|
||||
@go run tools/gen.go $(feat)
|
||||
# @goimports -w internal
|
||||
status:
|
||||
@$(COMPOSE) ps
|
||||
|
||||
Reference in New Issue
Block a user