ia_dev/deploy/_lib/env-map.sh
Nicolas Cantu 907807f4d6 Generic project config, deploy scripts, gitea-issues, no reverse dependency
**Motivations:**
- Single config file per project (projects/<id>/conf.json)
- Project must not depend on ia_dev; only ia_dev solicits the project

**Root causes:**
- N/A (evolution)

**Correctifs:**
- N/A

**Evolutions:**
- lib/project_config.sh: resolve PROJECT_SLUG from IA_PROJECT, .ia_project, ai_project_id; PROJECT_CONFIG_PATH = projects/<id>/conf.json
- projects/lecoffreio.json moved to projects/lecoffreio/conf.json; projects/ia_dev/conf.json added
- deploy: branch-align, bump-version, change-to-all-branches, pousse, deploy-by-script-to use PROJECT_ROOT/IA_DEV_ROOT and project_config.sh; SCRIPT_REAL for symlink-safe paths
- deploy/_lib: shared colors, env-map, ssh, git-flow
- gitea-issues: mail list/mark-read/get-thread/send-reply, thread log, agent-loop, wiki scripts; lib.sh loads project config
- README: principle no dependency from host project; invoke ./ia_dev/deploy/bump-version.sh etc. from repo root

**Pages affectées:**
- README.md, projects/README.md, lib/, deploy/, gitea-issues/, projects/lecoffreio/, projects/ia_dev/
2026-03-12 22:35:15 +01:00

67 lines
1.5 KiB
Bash

#!/usr/bin/env bash
set -euo pipefail
#
# Environment mapping for LeCoffre.io v2 deployments (proxy-based infra).
# - Proxy (jump/orchestrator): 192.168.1.100 (4nk.myftp.biz)
# - Targets: test=192.168.1.101, pprod=192.168.1.102, prod=192.168.1.103, services=192.168.1.104
#
get_env_target_ip() {
local env="$1"
case "$env" in
test) echo "192.168.1.101" ;;
pprod) echo "192.168.1.102" ;;
prod) echo "192.168.1.103" ;;
services) echo "192.168.1.104" ;;
*) return 1 ;;
esac
}
get_env_domain() {
local env="$1"
case "$env" in
test) echo "test.lecoffreio.4nkweb.com" ;;
pprod) echo "pprod.lecoffreio.4nkweb.com" ;;
prod) echo "prod.lecoffreio.4nkweb.com" ;;
*) return 1 ;;
esac
}
# Repository path on each target host (infra standard: /srv/4NK/<domain>/)
get_env_remote_app_root() {
local env="$1"
local domain
domain="$(get_env_domain "$env")"
echo "/srv/4NK/${domain}"
}
# Public service port (proxied by nginx on proxy).
# This port is reserved for LeCoffre.io in the infra ports map.
get_env_service_port() {
local env="$1"
case "$env" in
test|pprod|prod) echo "3009" ;;
*) return 1 ;;
esac
}
# Internal frontend port (served by Next.js, proxied by local router).
get_env_frontend_internal_port() {
local env="$1"
case "$env" in
test|pprod|prod) echo "3100" ;;
*) return 1 ;;
esac
}
# Internal backend port (served by Express, proxied by local router).
get_env_backend_internal_port() {
local env="$1"
case "$env" in
test|pprod|prod) echo "3101" ;;
*) return 1 ;;
esac
}