Files
i-want-to-heal-2/docs/truenas-deploy.md
T

3.0 KiB

I Want To Heal 2 Deployment

Do not hard-code Gitea tokens in repo files. Export GITEA_TOKEN in your shell.

One-Time Local Git Setup

cd /Users/warren/Documents/action-mode

git init
git branch -M main
git remote add origin https://git.whoagland.com/phenom/i-want-to-heal-2.git

If the remote already exists:

cd /Users/warren/Documents/action-mode
git remote set-url origin https://git.whoagland.com/phenom/i-want-to-heal-2.git

Step 1: Build APK For Thor

set -e

cd /Users/warren/Documents/action-mode

VERSION="1.0.0"
scripts/build-thor-apk.sh "$VERSION"

Step 2: Web/Server Build Check

set -e

cd /Users/warren/Documents/action-mode

npm run lint
npm run build

Step 3: Commit And Push Code

set -e

cd /Users/warren/Documents/action-mode

VERSION="1.0.0"

git add .
git commit -m "I Want To Heal 2 build v$VERSION"
git push origin main

Step 4: Create Gitea Release

set -e

cd /Users/warren/Documents/action-mode

export GITEA_URL="https://git.whoagland.com"
export GITEA_OWNER="phenom"
export GITEA_REPO="i-want-to-heal-2"
# export GITEA_TOKEN="paste-current-token-in-shell-only"

VERSION="1.0.0"
APK="IWantToHeal2-Thor-v$VERSION.apk"

RELEASE_JSON=$(curl -sS -X POST "$GITEA_URL/api/v1/repos/$GITEA_OWNER/$GITEA_REPO/releases" \
  -H "Authorization: token $GITEA_TOKEN" \
  -H "Content-Type: application/json" \
  -d "{\"tag_name\":\"v$VERSION\",\"target_commitish\":\"main\",\"name\":\"v$VERSION\",\"body\":\"I Want To Heal 2 Android and web/server build v$VERSION\",\"draft\":false,\"prerelease\":false}")

RELEASE_ID=$(python3 -c 'import sys,json; data=json.load(sys.stdin); print(data.get("id") or data)' <<< "$RELEASE_JSON")
echo "Release ID: $RELEASE_ID"

curl -sS -X POST "$GITEA_URL/api/v1/repos/$GITEA_OWNER/$GITEA_REPO/releases/$RELEASE_ID/assets?name=$APK" \
  -H "Authorization: token $GITEA_TOKEN" \
  -F "attachment=@$APK"

Step 5: First TrueNAS Install

In the TrueNAS shell:

set -e

mkdir -p /mnt/usbssds/apps/iwanttoheal2
cd /mnt/usbssds/apps/iwanttoheal2

git clone https://git.whoagland.com/phenom/i-want-to-heal-2.git app
mkdir -p data db

Create the TrueNAS custom app from docker-compose.truenas.yml, or paste that compose file into the custom app UI.

Set these app environment values:

POSTGRES_PASSWORD=<strong unique password>

Only set this after the reverse proxy/auth layer strips spoofed inbound auth headers and injects trusted user headers:

TRUST_AUTH_HEADERS=1

Step 6: Update TrueNAS

In the TrueNAS shell:

set -e

cd /mnt/usbssds/apps/iwanttoheal2/app
git pull origin main

Then restart the TrueNAS custom app.

Admin Changes

There is no separate admin server yet. Mechanic admin is currently inside the web app under Action Mode settings. This command serves the same app on port 4174 for local admin work:

cd /Users/warren/Documents/action-mode
DATABASE_URL="postgres://iwanttoheal:<password>@127.0.0.1:5432/iwanttoheal" PORT=4174 npm run admin:start