Skip to content

Commit 22851e7

Browse files
Deploy docs for 0818cac
1 parent d8fe5cb commit 22851e7

9 files changed

Lines changed: 133 additions & 83 deletions

404.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
</section>
1515

1616
<nav class="app-nav" aria-label="Docs Sections">
17-
<a class="nav-link " href="index.html">Overview</a><a class="nav-link " href="getting-started.html">Getting Started</a><a class="nav-link " href="api-reference.html">Api Reference</a><a class="nav-link " href="split-host-deployment.html">Split Host Deployment</a><a class="nav-link " href="docker.html">Docker</a><a class="nav-link " href="nginx.html">Nginx</a><a class="nav-link " href="database-production.html">Database Production</a><a class="nav-link " href="troubleshooting.html">Troubleshooting</a>
17+
<a class="nav-link " href="index.html">Overview</a><a class="nav-link " href="getting-started.html">Getting Started</a><a class="nav-link " href="api-reference.html">API Reference</a><a class="nav-link " href="split-host-deployment.html">Split-Host Deployment</a><a class="nav-link " href="docker.html">Docker Deployment</a><a class="nav-link " href="nginx.html">Nginx, Auth &amp; Hardening</a><a class="nav-link " href="database-production.html">Database In Production</a><a class="nav-link " href="troubleshooting.html">Troubleshooting</a>
1818
<a href="https://github.com/tcurrent/gateherald" class="nav-link" target="_blank" rel="noopener noreferrer">Repository</a>
1919
</nav>
2020

api-reference.html

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
</section>
1515

1616
<nav class="app-nav" aria-label="Docs Sections">
17-
<a class="nav-link " href="index.html">Overview</a><a class="nav-link " href="getting-started.html">Getting Started</a><a class="nav-link active" href="api-reference.html">Api Reference</a><a class="nav-link " href="split-host-deployment.html">Split Host Deployment</a><a class="nav-link " href="docker.html">Docker</a><a class="nav-link " href="nginx.html">Nginx</a><a class="nav-link " href="database-production.html">Database Production</a><a class="nav-link " href="troubleshooting.html">Troubleshooting</a>
17+
<a class="nav-link " href="index.html">Overview</a><a class="nav-link " href="getting-started.html">Getting Started</a><a class="nav-link active" href="api-reference.html">API Reference</a><a class="nav-link " href="split-host-deployment.html">Split-Host Deployment</a><a class="nav-link " href="docker.html">Docker Deployment</a><a class="nav-link " href="nginx.html">Nginx, Auth &amp; Hardening</a><a class="nav-link " href="database-production.html">Database In Production</a><a class="nav-link " href="troubleshooting.html">Troubleshooting</a>
1818
<a href="https://github.com/tcurrent/gateherald" class="nav-link" target="_blank" rel="noopener noreferrer">Repository</a>
1919
</nav>
2020

@@ -63,7 +63,27 @@ <h2 id="webhook-ingress">Webhook Ingress</h2>
6363
<ul>
6464
<li><code>ALL /webhook/*</code></li>
6565
</ul>
66-
<p>Configured paths can include multiple segments (for example <code>/webhook/sample/01J0Z8X3GWBD9117Q9H4M2KCFP</code>).</p>
66+
<p>Configured paths must start with <code>/webhook/</code>. Typical format used by the UI:</p>
67+
<pre><code class="language-text">/webhook/{routeName}/{ULID}
68+
</code></pre>
69+
<p>Multiple path segments are supported (for example <code>/webhook/sample/01J0Z8X3GWBD9117Q9H4M2KCFP</code>).</p>
70+
<h2 id="data-model">Data Model</h2>
71+
<p>Primary tables:</p>
72+
<ul>
73+
<li><code>ingress</code></li>
74+
<li><code>egress</code></li>
75+
<li><code>templates</code></li>
76+
<li><code>route_configs</code></li>
77+
</ul>
78+
<p>Default local database file: <code>gateherald.db</code></p>
79+
<h2 id="migration-and-seeding-behavior">Migration And Seeding Behavior</h2>
80+
<p>On app startup:</p>
81+
<ol>
82+
<li>Migration scripts run.</li>
83+
<li>Previously applied migrations are skipped using an internal script-run tracking table.</li>
84+
<li>Templates and route configs are loaded into runtime memory.</li>
85+
<li>Route config validation runs before server start.</li>
86+
</ol>
6787
</div>
6888
</div>
6989
</section>

database-production.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
</section>
1515

1616
<nav class="app-nav" aria-label="Docs Sections">
17-
<a class="nav-link " href="index.html">Overview</a><a class="nav-link " href="getting-started.html">Getting Started</a><a class="nav-link " href="api-reference.html">Api Reference</a><a class="nav-link " href="split-host-deployment.html">Split Host Deployment</a><a class="nav-link " href="docker.html">Docker</a><a class="nav-link " href="nginx.html">Nginx</a><a class="nav-link active" href="database-production.html">Database Production</a><a class="nav-link " href="troubleshooting.html">Troubleshooting</a>
17+
<a class="nav-link " href="index.html">Overview</a><a class="nav-link " href="getting-started.html">Getting Started</a><a class="nav-link " href="api-reference.html">API Reference</a><a class="nav-link " href="split-host-deployment.html">Split-Host Deployment</a><a class="nav-link " href="docker.html">Docker Deployment</a><a class="nav-link " href="nginx.html">Nginx, Auth &amp; Hardening</a><a class="nav-link active" href="database-production.html">Database In Production</a><a class="nav-link " href="troubleshooting.html">Troubleshooting</a>
1818
<a href="https://github.com/tcurrent/gateherald" class="nav-link" target="_blank" rel="noopener noreferrer">Repository</a>
1919
</nav>
2020

docker.html

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
</section>
1515

1616
<nav class="app-nav" aria-label="Docs Sections">
17-
<a class="nav-link " href="index.html">Overview</a><a class="nav-link " href="getting-started.html">Getting Started</a><a class="nav-link " href="api-reference.html">Api Reference</a><a class="nav-link " href="split-host-deployment.html">Split Host Deployment</a><a class="nav-link active" href="docker.html">Docker</a><a class="nav-link " href="nginx.html">Nginx</a><a class="nav-link " href="database-production.html">Database Production</a><a class="nav-link " href="troubleshooting.html">Troubleshooting</a>
17+
<a class="nav-link " href="index.html">Overview</a><a class="nav-link " href="getting-started.html">Getting Started</a><a class="nav-link " href="api-reference.html">API Reference</a><a class="nav-link " href="split-host-deployment.html">Split-Host Deployment</a><a class="nav-link active" href="docker.html">Docker Deployment</a><a class="nav-link " href="nginx.html">Nginx, Auth &amp; Hardening</a><a class="nav-link " href="database-production.html">Database In Production</a><a class="nav-link " href="troubleshooting.html">Troubleshooting</a>
1818
<a href="https://github.com/tcurrent/gateherald" class="nav-link" target="_blank" rel="noopener noreferrer">Repository</a>
1919
</nav>
2020

@@ -24,8 +24,8 @@
2424
<h2 id="architecture">Architecture</h2>
2525
<p>Two containers share an internal Docker bridge network:</p>
2626
<ul>
27-
<li><strong><code>backend</code></strong> Node.js app in API-only mode (<code>SERVE_UI=false</code>, <code>FRONTEND_ONLY_API=true</code>). Publishes port 3000 for external webhook ingress.</li>
28-
<li><strong><code>frontend</code></strong> nginx serving the static UI and proxying admin API requests to the backend over the internal network. No published port for the backend API means direct external access to <code>/api/*</code> is blocked at the network level.</li>
27+
<li><strong><code>backend</code></strong> Node.js app in API-only mode (<code>SERVE_UI=false</code>, <code>FRONTEND_ONLY_API=true</code>). Publishes port 3000 for external webhook ingress.</li>
28+
<li><strong><code>frontend</code></strong> nginx serving the static UI and proxying admin API requests to the backend over the internal network. No published port for the backend API means direct external access to <code>/api/*</code> is blocked at the network level.</li>
2929
</ul>
3030
<p>Traffic flow:</p>
3131
<ul>
@@ -35,19 +35,19 @@ <h2 id="architecture">Architecture</h2>
3535
<h2 id="files-to-create">Files To Create</h2>
3636
<p>The following files are referenced throughout these steps:</p>
3737
<ul>
38-
<li><code>Dockerfile</code> backend container image</li>
39-
<li><code>docker-compose.yml</code> service definitions</li>
40-
<li><code>deploy/docker/nginx.conf</code> nginx config for the frontend container</li>
41-
<li><code>.dockerignore</code> excludes <code>.env.*</code> files, the database, and other unnecessary paths from the build context so secrets are not baked into the image</li>
38+
<li><code>Dockerfile</code> backend container image</li>
39+
<li><code>docker-compose.yml</code> service definitions</li>
40+
<li><code>deploy/docker/nginx.conf</code> nginx config for the frontend container</li>
41+
<li><code>.dockerignore</code> excludes <code>.env.*</code> files, the database, and other unnecessary paths from the build context so secrets are not baked into the image</li>
4242
</ul>
4343
<p>All are included in the repo under their respective paths.</p>
44-
<h2 id="step-1--build-the-ui-css">Step 1 Build The UI CSS</h2>
44+
<h2 id="step-1-build-the-ui-css">Step 1) Build The UI CSS</h2>
4545
<p>The frontend container serves static files. Build the CSS before starting the stack:</p>
4646
<pre><code class="language-bash">npm install
4747
npm run build:css
4848
</code></pre>
4949
<p>This outputs <code>ui/dist/styles.css</code>, which the nginx container will serve directly.</p>
50-
<h2 id="step-2--configure-the-nginx-auth-snippet">Step 2 Configure The nginx Auth Snippet</h2>
50+
<h2 id="step-2-configure-the-nginx-auth-snippet">Step 2) Configure The nginx Auth Snippet</h2>
5151
<p>The frontend nginx config includes an auth snippet at <code>/etc/nginx/snippets/gateherald-admin-auth.conf</code>, mounted from <code>deploy/nginx/snippets/</code>. Choose one:</p>
5252
<ul>
5353
<li><strong>Basic Auth</strong>: copy <code>gateherald-admin-auth-basic.conf</code><code>gateherald-admin-auth.conf</code></li>
@@ -59,15 +59,15 @@ <h2 id="step-2--configure-the-nginx-auth-snippet">Step 2 — Configure The nginx
5959
<pre><code class="language-bash">htpasswd -c deploy/docker/.htpasswd-gateherald &lt;username&gt;
6060
</code></pre>
6161
<p>The <code>docker-compose.yml</code> mounts this file into the frontend container at <code>/etc/nginx/.htpasswd-gateherald</code>.</p>
62-
<h2 id="step-3--set-the-shared-secret">Step 3 Set The Shared Secret</h2>
62+
<h2 id="step-3-set-the-shared-secret">Step 3) Set The Shared Secret</h2>
6363
<p><code>ADMIN_PROXY_SHARED_SECRET</code> is the shared credential between the nginx frontend and the Node backend. The frontend injects it as a request header; the backend verifies it before accepting any admin API call.</p>
6464
<p>Generate a strong random value:</p>
6565
<pre><code class="language-bash">node -e &quot;console.log(require(&#39;crypto&#39;).randomBytes(32).toString(&#39;hex&#39;))&quot;
6666
</code></pre>
6767
<p>Set <code>ADMIN_PROXY_SHARED_SECRET</code> to this value in your <code>.env.production</code> file (see Step 4). That is the only place it needs to go.</p>
68-
<p><code>deploy/docker/nginx.conf</code> uses <code>${ADMIN_PROXY_SHARED_SECRET}</code> as a placeholder. At startup, the nginx container reads the value from the environment and substitutes it before the config is loaded the secret is never written into any file in the repository.</p>
68+
<p><code>deploy/docker/nginx.conf</code> uses <code>${ADMIN_PROXY_SHARED_SECRET}</code> as a placeholder. At startup, the nginx container reads the value from the environment and substitutes it before the config is loaded; the secret is never written into any file in the repository.</p>
6969
<p>The frontend nginx container only receives <code>ADMIN_PROXY_SHARED_SECRET</code> from the environment. Other backend secrets (<code>DB_PASSWORD</code>, <code>API_TOKEN</code>, etc.) are passed only to the backend service via <code>env_file: .env.production</code> and are not exposed to the nginx container.</p>
70-
<h2 id="step-4--configure-backend-environment">Step 4 Configure Backend Environment</h2>
70+
<h2 id="step-4-configure-backend-environment">Step 4) Configure Backend Environment</h2>
7171
<p>Create a <code>.env.production</code> file in the project root (or pass variables directly to Compose). A minimal production config:</p>
7272
<pre><code class="language-env">NODE_ENV=production
7373
PORT=3000
@@ -78,11 +78,11 @@ <h2 id="step-4--configure-backend-environment">Step 4 — Configure Backend Envi
7878
</code></pre>
7979
<p>Set <code>ALLOWED_ORIGINS</code> to the external URL where the frontend nginx is reachable. This controls CORS for browser-initiated API requests.</p>
8080
<p>For SQLite the default database location is used; it will be persisted via the named volume defined in <code>docker-compose.yml</code>. If using Postgres or MySQL instead, add the <code>DATABASE_URL</code> / <code>DB_*</code> vars from <code>.env.production.example</code>.</p>
81-
<h2 id="step-5--run-migrations">Step 5 Run Migrations</h2>
81+
<h2 id="step-5-run-migrations">Step 5) Run Migrations</h2>
8282
<p>Run database migrations once before starting the app for the first time, or after any upgrade that includes new migrations:</p>
8383
<pre><code class="language-bash">docker compose run --rm backend node scripts/db-migrate.js
8484
</code></pre>
85-
<h2 id="step-6--start-the-stack">Step 6 Start The Stack</h2>
85+
<h2 id="step-6-start-the-stack">Step 6) Start The Stack</h2>
8686
<pre><code class="language-bash">docker compose up -d
8787
</code></pre>
8888
<ul>
@@ -92,23 +92,23 @@ <h2 id="step-6--start-the-stack">Step 6 — Start The Stack</h2>
9292
<p>To follow logs:</p>
9393
<pre><code class="language-bash">docker compose logs -f
9494
</code></pre>
95-
<h2 id="step-7--tls">Step 7 TLS</h2>
95+
<h2 id="step-7-tls">Step 7) TLS</h2>
9696
<p>The <code>docker-compose.yml</code> exposes the frontend on HTTP port 8080. For HTTPS, put a TLS-terminating reverse proxy (another nginx, Caddy, Traefik, etc.) in front of port 8080 and set the appropriate <code>X-Forwarded-Proto</code> header. The app already reads this header for cookie <code>Secure</code> flag decisions.</p>
97-
<p>Do not expose the backend container&#39;s port 3000 through TLS termination intended for admin users keep that path for webhook ingress only.</p>
98-
<h2 id="optional--postgresmysql-database-container">Optional Postgres/MySQL Database Container</h2>
97+
<p>Do not expose the backend container&#39;s port 3000 through TLS termination intended for admin users; keep that path for webhook ingress only.</p>
98+
<h2 id="optional---postgresmysql-database-container">Optional - Postgres/MySQL Database Container</h2>
9999
<p>By default the backend uses SQLite, persisted via a named Docker volume. This is sufficient for a single-node deployment. If you want a proper relational database with concurrent write support and a fully independent data lifecycle, add a <code>db</code> service to the Compose stack.</p>
100-
<h3 id="1--install-the-driver">1 Install The Driver</h3>
100+
<h3 id="1-install-the-driver">1) Install The Driver</h3>
101101
<p>The Postgres or MySQL driver must be present in the image. Add it as a production dependency before building:</p>
102102
<pre><code class="language-bash"># Postgres
103103
npm install pg pg-hstore
104104

105105
# MySQL
106106
npm install mysql2
107107
</code></pre>
108-
<h3 id="2--add-the-db-service-to-docker-composeyml">2 Add The db Service To docker-compose.yml</h3>
108+
<h3 id="2-add-the-db-service-to-docker-composeyml">2) Add The db Service To docker-compose.yml</h3>
109109
<p>Add a <code>db</code> service on the same internal network, with its own named volume. Update <code>backend</code> to depend on it:</p>
110110
<pre><code class="language-yaml">volumes:
111-
gateherald-data: # remove or repurpose no longer used for SQLite
111+
gateherald-data: # remove or repurpose; no longer used for SQLite
112112
gateherald-db: # postgres data directory
113113

114114
services:
@@ -123,7 +123,7 @@ <h3 id="2--add-the-db-service-to-docker-composeyml">2 — Add The db Service To
123123
volumes:
124124
- gateherald-db:/var/lib/postgresql/data
125125
restart: unless-stopped
126-
# No &#39;ports&#39; not reachable from outside Docker
126+
# No &#39;ports&#39; - not reachable from outside Docker
127127

128128
backend:
129129
build: .
@@ -137,7 +137,7 @@ <h3 id="2--add-the-db-service-to-docker-composeyml">2 — Add The db Service To
137137
restart: unless-stopped
138138
</code></pre>
139139
<p>Do not publish the <code>db</code> container&#39;s port. It only needs to be reachable from <code>backend</code> on the internal network.</p>
140-
<h3 id="3--update-backend-environment">3 Update Backend Environment</h3>
140+
<h3 id="3-update-backend-environment">3) Update Backend Environment</h3>
141141
<p>Remove the SQLite volume mount from <code>backend</code> and add database connection vars to <code>.env.production</code>:</p>
142142
<pre><code class="language-env">DB_DIALECT=postgres
143143
DB_HOST=db
@@ -148,7 +148,7 @@ <h3 id="3--update-backend-environment">3 — Update Backend Environment</h3>
148148
DB_SSL=false
149149
</code></pre>
150150
<p><code>DB_HOST=db</code> resolves to the <code>db</code> container via Docker&#39;s internal DNS. <code>DB_SSL=false</code> is appropriate here because the connection stays on the internal bridge network; enable it if your setup routes through a TLS-capable proxy.</p>
151-
<h3 id="4--run-migrations">4 Run Migrations</h3>
151+
<h3 id="4-run-migrations">4) Run Migrations</h3>
152152
<p>Wait for Postgres to be ready before migrating. A simple one-off approach:</p>
153153
<pre><code class="language-bash">docker compose up -d db
154154
# wait a few seconds for Postgres to initialise, then:

getting-started.html

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
</section>
1515

1616
<nav class="app-nav" aria-label="Docs Sections">
17-
<a class="nav-link " href="index.html">Overview</a><a class="nav-link active" href="getting-started.html">Getting Started</a><a class="nav-link " href="api-reference.html">Api Reference</a><a class="nav-link " href="split-host-deployment.html">Split Host Deployment</a><a class="nav-link " href="docker.html">Docker</a><a class="nav-link " href="nginx.html">Nginx</a><a class="nav-link " href="database-production.html">Database Production</a><a class="nav-link " href="troubleshooting.html">Troubleshooting</a>
17+
<a class="nav-link " href="index.html">Overview</a><a class="nav-link active" href="getting-started.html">Getting Started</a><a class="nav-link " href="api-reference.html">API Reference</a><a class="nav-link " href="split-host-deployment.html">Split-Host Deployment</a><a class="nav-link " href="docker.html">Docker Deployment</a><a class="nav-link " href="nginx.html">Nginx, Auth &amp; Hardening</a><a class="nav-link " href="database-production.html">Database In Production</a><a class="nav-link " href="troubleshooting.html">Troubleshooting</a>
1818
<a href="https://github.com/tcurrent/gateherald" class="nav-link" target="_blank" rel="noopener noreferrer">Repository</a>
1919
</nav>
2020

@@ -109,33 +109,6 @@ <h2 id="ui-access">UI Access</h2>
109109
<li><code>./template-builder.html</code></li>
110110
<li><code>./dist/styles.css</code></li>
111111
</ul>
112-
<h2 id="route-format">Route Format</h2>
113-
<p>Configured route paths must start with:</p>
114-
<pre><code class="language-text">/webhook/
115-
</code></pre>
116-
<p>Typical format used by the UI:</p>
117-
<pre><code class="language-text">/webhook/{routeName}/{ULID}
118-
</code></pre>
119-
<h2 id="data-model">Data Model</h2>
120-
<p>Primary tables:</p>
121-
<ul>
122-
<li><code>ingress</code></li>
123-
<li><code>egress</code></li>
124-
<li><code>templates</code></li>
125-
<li><code>route_configs</code></li>
126-
</ul>
127-
<p>Default local database file:</p>
128-
<ul>
129-
<li><code>gateherald.db</code></li>
130-
</ul>
131-
<h2 id="migration-and-seeding-behavior">Migration And Seeding Behavior</h2>
132-
<p>On app startup:</p>
133-
<ol>
134-
<li>Migration scripts run</li>
135-
<li>Previously applied migrations are skipped using an internal script-run tracking table</li>
136-
<li>Templates and route configs are loaded into runtime memory</li>
137-
<li>Route config validation runs before server start</li>
138-
</ol>
139112
<p>Seeder scripts are applied only when explicitly running:</p>
140113
<pre><code class="language-bash">npm run db:seed
141114
</code></pre>

0 commit comments

Comments
 (0)