From 1bec37657e8de773096ab0687e98946b2f8f4ea7 Mon Sep 17 00:00:00 2001 From: myoffice-sync Date: Wed, 5 Aug 2026 14:50:39 +0000 Subject: [PATCH] sync build tree from private myoffice --- README.md | 9 ++++++++- proxmox/README.md | 2 ++ proxmox/install-in-ct.sh | 4 ++-- proxmox/myoffice.sh | 26 +++++++++++++++++++------- 4 files changed, 31 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index fea4383..69a86df 100644 --- a/README.md +++ b/README.md @@ -10,12 +10,19 @@ On the Proxmox host: bash -c "$(curl -fsSL https://mygit.ase.com.ua/alexandr/myoffice_public/raw/branch/master/proxmox/myoffice.sh)" ``` +If the CT cannot reach Gitea by DNS (hairpin), pass the nginx/proxy LAN IP as an argument — it is written into the CT `/etc/hosts` for `mygit.ase.com.ua`: + +```bash +bash -c "$(curl -fsSL https://mygit.ase.com.ua/alexandr/myoffice_public/raw/branch/master/proxmox/myoffice.sh)" 192.168.100.10 +``` + Creates an LXC with PostgreSQL + ASP.NET runtime, downloads the latest release, starts the app on port **9100**. Point your nginx LXC at `http://:9100`. Optional overrides: ```bash export RELEASE_TAG="latest" # or v1.2.3 +export GITEA_HOSTS_IP="192.168.100.10" # same as the trailing arg ``` Details: [proxmox/README.md](proxmox/README.md). @@ -35,7 +42,7 @@ Local development: ```bash dotnet build MyOffice.Web/MyOffice.Web.csproj -cd MyOffice.SPA && npm install && npm start # http://localhost:4300 +cd MyOffice.SPA && npm start # after npm install; http://localhost:4300 # Run MyOffice.Web (API http://localhost:9100); set FrontEnd:Host to the SPA origin ``` diff --git a/proxmox/README.md b/proxmox/README.md index 30ea7bf..7143bef 100644 --- a/proxmox/README.md +++ b/proxmox/README.md @@ -28,6 +28,8 @@ Shown on the **public** repo `README.md` after sync. Example for this instance: ```bash bash -c "$(curl -fsSL https://mygit.ase.com.ua/alexandr/myoffice_public/raw/branch/master/proxmox/myoffice.sh)" +# Optional trailing IP → CT /etc/hosts for mygit (when hairpin DNS fails): +# bash -c "$(curl -fsSL …/proxmox/myoffice.sh)" 192.168.100.10 ``` Optional env before the command: `GITEA_URL`, `GITEA_OWNER`, `GITEA_REPO`, `GITEA_BRANCH`, `RELEASE_TAG` (`latest` or `v1.2.3`). diff --git a/proxmox/install-in-ct.sh b/proxmox/install-in-ct.sh index 9349d88..ac2e549 100644 --- a/proxmox/install-in-ct.sh +++ b/proxmox/install-in-ct.sh @@ -27,7 +27,7 @@ unset LANGUAGE LC_TIME LC_MESSAGES 2>/dev/null || true msg() { echo -e " ==> $*"; } -# TEMPORARY: map Gitea hostname → nginx LAN (override with GITEA_HOSTS_IP= to disable) +# Optional: map Gitea hostname → LAN IP (GITEA_HOSTS_IP); skip if unset. ensure_gitea_hosts() { if [[ -z "${GITEA_HOSTS_IP:-}" ]]; then return 0 @@ -209,7 +209,7 @@ GITEA_HOSTS_IP=${GITEA_HOSTS_IP:-} GITEA_HOSTS_NAME=${GITEA_HOSTS_NAME:-mygit.ase.com.ua} EOF - # TEMPORARY hosts also persisted above in env; already applied at start via ensure_gitea_hosts + # hosts already applied at start via ensure_gitea_hosts when GITEA_HOSTS_IP is set systemctl daemon-reload systemctl enable myoffice-api diff --git a/proxmox/myoffice.sh b/proxmox/myoffice.sh index 762d7a9..6ca3958 100644 --- a/proxmox/myoffice.sh +++ b/proxmox/myoffice.sh @@ -1,7 +1,10 @@ #!/usr/bin/env bash # MyOffice Proxmox LXC installer (community-scripts style). -# One-liner (env optional — defaults match public repo): -# bash -c "$(curl -fsSL https://mygit.ase.com.ua/alexandr/myoffice_public/raw/branch/master/proxmox/myoffice.sh)" +# +# One-liner (optional arg = IP for CT /etc/hosts → mygit hostname, when hairpin DNS fails): +# bash -c "$(curl -fsSL https://mygit.ase.com.ua/alexandr/myoffice_public/raw/branch/master/proxmox/myoffice.sh)" 192.168.100.10 +# Or: curl -fsSL …/myoffice.sh | bash -s -- 192.168.100.10 +# Or: export GITEA_HOSTS_IP=192.168.100.10 then run without arg # # Creates one LXC with PostgreSQL + ASP.NET runtime + app from Gitea Release. # No Docker, no nginx, no git/SDK/Node in the CT (use your existing proxy LXC in front). @@ -15,12 +18,21 @@ GITEA_BRANCH="${GITEA_BRANCH:-master}" RELEASE_TAG="${RELEASE_TAG:-latest}" RELEASE_ASSET_URL="${RELEASE_ASSET_URL:-}" GITEA_TOKEN="${GITEA_TOKEN:-}" - -# TEMPORARY: CT often resolves mygit to a public IP (hairpin fails). Map to nginx LAN. -# Remove when CT DNS/routing reaches Gitea correctly. Override: GITEA_HOSTS_IP= (empty = skip) -GITEA_HOSTS_IP="${GITEA_HOSTS_IP:-192.168.100.10}" GITEA_HOSTS_NAME="${GITEA_HOSTS_NAME:-mygit.ase.com.ua}" +# Optional CT hosts override: env, or positional IP. +# bash -c "…" IP → IP is $0 ; bash -s -- IP → IP is $1 +is_ipv4() { [[ "${1:-}" =~ ^([0-9]{1,3}\.){3}[0-9]{1,3}$ ]]; } +if [[ -z "${GITEA_HOSTS_IP:-}" ]]; then + if is_ipv4 "${1:-}"; then + GITEA_HOSTS_IP="$1" + elif is_ipv4 "${0:-}"; then + GITEA_HOSTS_IP="$0" + else + GITEA_HOSTS_IP="" + fi +fi + if [[ -z "${REPO_RAW_BASE:-}" ]]; then REPO_RAW_BASE="${GITEA_URL%/}/${GITEA_OWNER}/${GITEA_REPO}/raw/branch/${GITEA_BRANCH}" fi @@ -427,7 +439,7 @@ wait_for_network() { exit 1 } -# TEMPORARY hosts override inside CT (see GITEA_HOSTS_IP). +# Optional CT /etc/hosts: GITEA_HOSTS_IP → GITEA_HOSTS_NAME (skip if empty). ensure_ct_gitea_hosts() { if [[ -z "${GITEA_HOSTS_IP}" ]]; then return 0