mirror of
https://github.com/furyhawk/lta_datamall_api.git
synced 2026-07-21 10:16:52 +00:00
Add support for Podman by creating separate configuration files and updating Makefile
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
CONTAINER_ENGINE:=$(shell if command -v podman >/dev/null 2>&1; then echo podman; elif command -v docker >/dev/null 2>&1; then echo docker; else echo ""; fi)
|
||||
COMPOSE_CMD:=$(shell if command -v podman >/dev/null 2>&1; then if podman compose version >/dev/null 2>&1; then echo "podman compose"; elif command -v podman-compose >/dev/null 2>&1; then echo podman-compose; fi; elif command -v docker >/dev/null 2>&1; then echo "docker compose"; else echo ""; fi)
|
||||
COMPOSE_FILE:=$(if $(filter podman,$(CONTAINER_ENGINE)),podman-compose.yml,docker-compose.yml)
|
||||
|
||||
.DEFAULT_GOAL := help
|
||||
|
||||
@@ -11,7 +13,9 @@ help:
|
||||
@echo " logs Follow APISIX logs"
|
||||
@echo " ps Show gateway containers"
|
||||
@echo ""
|
||||
@echo "Detected container engine: $(if $(CONTAINER_ENGINE),$(CONTAINER_ENGINE),none)"
|
||||
@echo "Detected compose command: $(if $(COMPOSE_CMD),$(COMPOSE_CMD),none)"
|
||||
@echo "Selected compose file: $(COMPOSE_FILE)"
|
||||
|
||||
check-compose:
|
||||
@if [ -z "$(COMPOSE_CMD)" ]; then \
|
||||
@@ -20,13 +24,13 @@ check-compose:
|
||||
fi
|
||||
|
||||
up: check-compose
|
||||
$(COMPOSE_CMD) up --build -d
|
||||
$(COMPOSE_CMD) -f $(COMPOSE_FILE) up --build -d
|
||||
|
||||
down: check-compose
|
||||
$(COMPOSE_CMD) down
|
||||
$(COMPOSE_CMD) -f $(COMPOSE_FILE) down
|
||||
|
||||
logs: check-compose
|
||||
$(COMPOSE_CMD) logs -f
|
||||
$(COMPOSE_CMD) -f $(COMPOSE_FILE) logs -f
|
||||
|
||||
ps: check-compose
|
||||
$(COMPOSE_CMD) ps
|
||||
$(COMPOSE_CMD) -f $(COMPOSE_FILE) ps
|
||||
|
||||
@@ -13,7 +13,12 @@ This project runs Apache APISIX as an API gateway in front of the LTA DataMall F
|
||||
- Docker or Podman with compose support
|
||||
- The backend service running on `http://host.docker.internal:8068` on macOS
|
||||
|
||||
If your backend runs on a different host or port, update the upstream target in [conf/apisix.yaml](conf/apisix.yaml).
|
||||
Docker uses `host.docker.internal`.
|
||||
Podman uses `host.containers.internal`.
|
||||
|
||||
This project keeps separate compose wiring for each runtime and the gateway `Makefile` selects the right file automatically.
|
||||
|
||||
If your backend runs on a different host or port, update the upstream target in [conf/apisix.yaml](conf/apisix.yaml) for Docker or [conf/apisix.podman.yaml](conf/apisix.podman.yaml) for Podman.
|
||||
|
||||
## Run
|
||||
|
||||
@@ -39,6 +44,8 @@ make logs
|
||||
make ps
|
||||
```
|
||||
|
||||
`make up`, `make down`, `make logs`, and `make ps` automatically choose `docker-compose.yml` for Docker and `podman-compose.yml` for Podman.
|
||||
|
||||
## Ports
|
||||
|
||||
- `9080` - APISIX proxy listener
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
routes:
|
||||
- id: 1
|
||||
uri: /healthz
|
||||
upstream_id: 1
|
||||
|
||||
- id: 2
|
||||
uri: /readyz
|
||||
upstream_id: 1
|
||||
|
||||
- id: 3
|
||||
uri: /openapi.json
|
||||
upstream_id: 1
|
||||
|
||||
- id: 4
|
||||
uri: /docs
|
||||
upstream_id: 1
|
||||
|
||||
- id: 5
|
||||
uri: /redoc
|
||||
upstream_id: 1
|
||||
|
||||
- id: 6
|
||||
uri: /api/v1/*
|
||||
upstream_id: 1
|
||||
|
||||
upstreams:
|
||||
- id: 1
|
||||
type: roundrobin
|
||||
nodes:
|
||||
"host.containers.internal:8068": 1
|
||||
|
||||
#END
|
||||
@@ -27,6 +27,6 @@ upstreams:
|
||||
- id: 1
|
||||
type: roundrobin
|
||||
nodes:
|
||||
"host.containers.internal:8068": 1
|
||||
"host.docker.internal:8068": 1
|
||||
|
||||
#END
|
||||
|
||||
@@ -8,5 +8,3 @@ services:
|
||||
ports:
|
||||
- "9080:9080"
|
||||
restart: unless-stopped
|
||||
extra_hosts:
|
||||
- "host.docker.internal:10.0.2.2" # Standard podman default gateway
|
||||
@@ -0,0 +1,10 @@
|
||||
services:
|
||||
apisix:
|
||||
image: apache/apisix:3.11.0-debian
|
||||
container_name: lta-datamall-apisix
|
||||
volumes:
|
||||
- ./conf/config.yaml:/usr/local/apisix/conf/config.yaml:ro
|
||||
- ./conf/apisix.podman.yaml:/usr/local/apisix/conf/apisix.yaml:ro
|
||||
ports:
|
||||
- "9080:9080"
|
||||
restart: unless-stopped
|
||||
Reference in New Issue
Block a user