local-development-gateway 0.3.1 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +99 -137
- data/docs/architecture/local-tcp-routing.md +20 -40
- data/examples/database-aliases/compose.rb +11 -5
- data/examples/database-aliases/compose.yml +62 -38
- data/examples/database-aliases/gateway.yml +9 -15
- data/lib/local_development_gateway/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7f0a5f0cfc9ee162744f1742ae6044d46b3eacb541d926b97a9f60a5b11a03d0
|
|
4
|
+
data.tar.gz: db6595c9180e1b24b02c1a6974b1dff3e33ec6fdd1d20c50f2cdd020b6745aad
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8009f7e342b851084b05e63a4a66b3b12be1af2cd6dc151114081a4fcc8c3391cc5e3cc260555c9e64c84b4eb5902dbe08adcdbce328e9bfcc3fb7a5d42e9cd1
|
|
7
|
+
data.tar.gz: 5969417f6c99b607171706b03729f3769da59d97409417d3385bbe45afda200403ad550b85daba376d9b2f99eb570f8e122a6ff1933bf4da22b32c85e3bb1915
|
data/README.md
CHANGED
|
@@ -8,23 +8,19 @@ It lets several local projects use stable hostnames instead of competing for bro
|
|
|
8
8
|
|
|
9
9
|
Without a gateway, two projects commonly both try to publish a web service on port `8080` and a backend service on port `3000`. Only one can start.
|
|
10
10
|
|
|
11
|
-
With this gateway running, a project routes its internal web service through a
|
|
12
|
-
checkout-derived hostname instead:
|
|
11
|
+
With this gateway running, a project routes its internal web service through a checkout-derived hostname instead:
|
|
13
12
|
|
|
14
13
|
```text
|
|
15
|
-
http://
|
|
14
|
+
http://example.localhost
|
|
16
15
|
|
|
|
17
16
|
v
|
|
18
17
|
Local Development Gateway on 127.0.0.1:80
|
|
19
18
|
|
|
|
20
19
|
v
|
|
21
|
-
|
|
20
|
+
Example web container on internal port 8080
|
|
22
21
|
```
|
|
23
22
|
|
|
24
|
-
The checkout folder identifies the project. A separately named worktree such as
|
|
25
|
-
`issue-123` uses `http://issue-123.traditional-knowledge.localhost`; the browser
|
|
26
|
-
reaches the web service through the gateway on port `80`, not a published
|
|
27
|
-
application port.
|
|
23
|
+
The checkout folder identifies the project. A separately named worktree such as `issue-123` uses `http://issue-123.example.localhost`; the browser reaches the web service through the gateway on port `80`, not a published application port.
|
|
28
24
|
|
|
29
25
|
These local `*.localhost` hostnames resolve to loopback and do not require a
|
|
30
26
|
public domain, external DNS provider, or internet-facing listener.
|
|
@@ -134,11 +130,7 @@ connections. No host agent, DNS server, administrator privileges, or
|
|
|
134
130
|
| Desktop client, such as DBeaver | `db.<worktree>.<project>.localhost` | Encrypted, hostname-labelled gateway endpoint on loopback |
|
|
135
131
|
| Database-local console, backup, clone command | `localhost` | Explicitly select the intended database container first |
|
|
136
132
|
|
|
137
|
-
Do not use bare
|
|
138
|
-
gateway topology. An API attached to both `default` and `local-gateway` can see
|
|
139
|
-
other projects' database service aliases on the shared network. Docker DNS or
|
|
140
|
-
network ordering cannot reliably choose its own database. Separate database
|
|
141
|
-
volumes do not prevent connecting to the wrong server.
|
|
133
|
+
Do not use bare database service names for application connections in the current gateway topology. An API attached to both `default` and `local-gateway` can see other projects' database service aliases on the shared network. Docker DNS or network ordering cannot reliably choose its own database. Separate database volumes do not prevent connecting to the wrong server.
|
|
142
134
|
|
|
143
135
|
The qualified alias belongs **only on the private `default` network**. Compose
|
|
144
136
|
project names must be distinct for concurrent checkouts. `.localhost` desktop
|
|
@@ -156,12 +148,12 @@ require "local_development_gateway"
|
|
|
156
148
|
|
|
157
149
|
LocalDevelopmentGateway.database_alias(
|
|
158
150
|
project_name: "issue-123-example",
|
|
159
|
-
service_name: "
|
|
151
|
+
service_name: "db_reporting"
|
|
160
152
|
)
|
|
161
|
-
# => "issue-123-example-
|
|
153
|
+
# => "issue-123-example-db_reporting"
|
|
162
154
|
```
|
|
163
155
|
|
|
164
|
-
The pure public function preserves the **entire** `<project-name>-<service-name>` string when it fits, including an exact 63-byte fit. A 60-character project plus `-db` fits; 61 characters needs shortening. For `-
|
|
156
|
+
The pure public function preserves the **entire** `<project-name>-<service-name>` string when it fits, including an exact 63-byte fit. A 60-character project plus `-db` fits; 61 characters needs shortening. For `-db_reporting`, the corresponding boundary is 50/51 characters. Longer aliases become the first 38 characters of the full alias, a hyphen, and the first 24 hexadecimal characters of SHA256 over `project_name + "\0" + service_name`. The NUL separator distinguishes identities whose hyphen-joined forms could otherwise be ambiguous. The 96-bit digest suffix provides collision resistance, not a mathematical guarantee that collisions are impossible. No persistent or random state is involved.
|
|
165
157
|
|
|
166
158
|
Inputs must be nonempty ASCII strings. Project names start with a lowercase letter or digit and otherwise contain lowercase letters, digits, hyphens, or underscores. Service names start with an ASCII letter or digit and otherwise contain ASCII letters, digits, hyphens, or underscores; case is preserved. Legacy underscores remain supported, even though they are not strict DNS hostname characters. Invalid inputs raise `ArgumentError`; the API does not normalize names.
|
|
167
159
|
|
|
@@ -171,174 +163,150 @@ Derive each database alias from that name and its service name, then use the ide
|
|
|
171
163
|
|
|
172
164
|
### Runnable disposable consumer example
|
|
173
165
|
|
|
174
|
-
[`examples/database-aliases`](examples/database-aliases) supplies
|
|
166
|
+
[`examples/database-aliases`](examples/database-aliases) supplies a port-free base Compose file, an optional gateway overlay, and a Ruby wrapper. It models a PostgreSQL primary (`db`) plus two SQL Server external-source simulators (`db_reporting` and `db_archive`). A SQL-only project can select just a SQL Server service. The native `postgres_client`, `reporting_client`, and `archive_client` services are diagnostic stand-ins, not application APIs, jobs, or test runners. Real consumers map their own driver settings to the corresponding server aliases and choose a logical database for each context.
|
|
175
167
|
|
|
176
|
-
|
|
168
|
+
Development and tests use the **same server for each role**, not a different server or driver for tests: `app_development`/`app_test` on `db`, `reporting_development`/`reporting_test` on `db_reporting`, and `archive_development`/`archive_test` on `db_archive`. Separate logical test databases protect development data only when the application's test configuration actually selects them. These disposable clients do not demonstrate a consumer's migrations, permissions, or test isolation policy.
|
|
169
|
+
|
|
170
|
+
Run the following commands from `examples/database-aliases`. With a compatible gem in your bundle, use `bundle exec ruby compose.rb`; outside Bundler, use `ruby compose.rb`. To exercise this checkout's source, use `bundle exec ruby -I../../lib compose.rb`. The wrapper command shape is:
|
|
177
171
|
|
|
178
172
|
```text
|
|
179
173
|
ruby compose.rb [native Compose global options] -- COMMAND [args]
|
|
180
174
|
```
|
|
181
175
|
|
|
182
|
-
Only the `--` delimiter is interpreted by the wrapper. Put native global options such as `-p`, `--project-name`, `--project-directory`, `--env-file`, `--profile`, and `-f` before it; put the Compose command and its arguments after it. With no globals, Compose uses its normal environment and defaults. Keep the same globals/environment for
|
|
176
|
+
Only the `--` delimiter is interpreted by the wrapper. Put native global options such as `-p`, `--project-name`, `--project-directory`, `--env-file`, `--profile`, and `-f` before it; put the Compose command and its arguments after it. With no globals, Compose uses its normal environment and defaults. Keep the same globals/environment for every lifecycle command so they select the same resources.
|
|
177
|
+
|
|
178
|
+
#### SQL Server-only subset
|
|
179
|
+
|
|
180
|
+
A SQL-only API, job, and test runner can all use the alias for `db_reporting`, selecting `reporting_development` for development and `reporting_test` for tests. Start only that server; explicitly running its diagnostic client does not start PostgreSQL or the archive server:
|
|
181
|
+
|
|
182
|
+
```sh
|
|
183
|
+
bundle exec ruby compose.rb -- up -d --wait db_reporting
|
|
184
|
+
bundle exec ruby compose.rb -- run --rm reporting_client -Q 'CREATE DATABASE reporting_development; CREATE DATABASE reporting_test;'
|
|
185
|
+
bundle exec ruby compose.rb -- run --rm reporting_client -d reporting_development -Q 'SELECT @@SERVERNAME AS server_name, DB_NAME() AS database_name;'
|
|
186
|
+
bundle exec ruby compose.rb -- run --rm reporting_client -d reporting_test -Q 'SELECT @@SERVERNAME AS server_name, DB_NAME() AS database_name;'
|
|
187
|
+
bundle exec ruby compose.rb -- down
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
#### Full mixed-driver setup
|
|
191
|
+
|
|
192
|
+
The PostgreSQL image creates `app_development` on its first volume initialization. Create the remaining logical databases once on fresh disposable volumes, then query both development and test selections:
|
|
183
193
|
|
|
184
194
|
```sh
|
|
185
|
-
# Base-only: Compose chooses the project identity; only the databases start.
|
|
186
195
|
bundle exec ruby compose.rb -- config
|
|
187
196
|
bundle exec ruby compose.rb -- up -d --wait
|
|
188
|
-
bundle exec ruby compose.rb -- run --rm
|
|
189
|
-
bundle exec ruby compose.rb -- run --rm
|
|
190
|
-
bundle exec ruby compose.rb -- run --rm
|
|
197
|
+
bundle exec ruby compose.rb -- run --rm postgres_client -d postgres -c 'CREATE DATABASE app_test;'
|
|
198
|
+
bundle exec ruby compose.rb -- run --rm reporting_client -Q 'CREATE DATABASE reporting_development; CREATE DATABASE reporting_test;'
|
|
199
|
+
bundle exec ruby compose.rb -- run --rm archive_client -Q 'CREATE DATABASE archive_development; CREATE DATABASE archive_test;'
|
|
200
|
+
|
|
201
|
+
bundle exec ruby compose.rb -- run --rm postgres_client -c 'SELECT current_database(), current_user, inet_server_addr();'
|
|
202
|
+
bundle exec ruby compose.rb -- run --rm postgres_client -d app_test -c 'SELECT current_database(), current_user, inet_server_addr();'
|
|
203
|
+
bundle exec ruby compose.rb -- run --rm reporting_client -d reporting_development -Q 'SELECT @@SERVERNAME AS server_name, DB_NAME() AS database_name;'
|
|
204
|
+
bundle exec ruby compose.rb -- run --rm reporting_client -d reporting_test -Q 'SELECT @@SERVERNAME AS server_name, DB_NAME() AS database_name;'
|
|
205
|
+
bundle exec ruby compose.rb -- run --rm archive_client -d archive_development -Q 'SELECT @@SERVERNAME AS server_name, DB_NAME() AS database_name;'
|
|
206
|
+
bundle exec ruby compose.rb -- run --rm archive_client -d archive_test -Q 'SELECT @@SERVERNAME AS server_name, DB_NAME() AS database_name;'
|
|
191
207
|
bundle exec ruby compose.rb -- down
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
Creation commands intentionally fail if those databases already exist; skip creation when reusing initialized volumes, including after the SQL-only subset. PostgreSQL uses synthetic user `example` and password `development-only`. Both SQL Server instances use `sa` and synthetic password `Example-Only_Strong9!`. These credentials are only for this disposable stack and must not be reused elsewhere. Native clients use standard `PG*`/`SQLCMD*` environment variables; their entrypoints are `psql` and `sqlcmd`, so arguments above are passed directly without repeating the executable. SQL clients initially select `master` to permit database creation; subsequent `-d` arguments select the intended logical database.
|
|
211
|
+
|
|
212
|
+
Clients belong to the `clients` profile, so ordinary `up --wait` starts only databases. `run` explicitly selects a client without enabling unrelated services. The overlay adds shared ingress while preserving mapping-form private networks. Start the shared gateway first, then use a distinct checkout-derived desktop hostname:
|
|
192
213
|
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
# stack's project identity just to shorten its aliases.
|
|
196
|
-
export GATEWAY_HOSTNAME=issue-123.database-aliases.localhost
|
|
214
|
+
```sh
|
|
215
|
+
export GATEWAY_HOSTNAME=issue-123.example.localhost
|
|
197
216
|
bundle exec ruby compose.rb -f compose.yml -f gateway.yml -- config
|
|
198
217
|
bundle exec ruby compose.rb -f compose.yml -f gateway.yml -- up -d --wait
|
|
199
|
-
bundle exec ruby compose.rb -f compose.yml -f gateway.yml -- run --rm
|
|
218
|
+
bundle exec ruby compose.rb -f compose.yml -f gateway.yml -- run --rm postgres_client -d app_test -c 'SELECT current_database();'
|
|
219
|
+
bundle exec ruby compose.rb -f compose.yml -f gateway.yml -- run --rm reporting_client -d reporting_test -Q 'SELECT DB_NAME();'
|
|
220
|
+
bundle exec ruby compose.rb -f compose.yml -f gateway.yml -- run --rm archive_client -d archive_test -Q 'SELECT DB_NAME();'
|
|
200
221
|
bundle exec ruby compose.rb -f compose.yml -f gateway.yml -- down
|
|
201
222
|
```
|
|
202
223
|
|
|
203
|
-
|
|
224
|
+
Desktop routes are `db.${GATEWAY_HOSTNAME}:5432`, `reporting.${GATEWAY_HOSTNAME}:1433`, and `archive.${GATEWAY_HOSTNAME}:1433`; container clients continue using private aliases and internal ports. Base-only use needs no gateway.
|
|
225
|
+
|
|
226
|
+
The wrapper first renders `docker compose [exact globals] config --format json` with discovery-only `POSTGRES_HOST`, `REPORTING_HOST`, and `ARCHIVE_HOST` placeholders. It never starts that configuration. After reading the native `name`, it execs the requested command with derived aliases and exactly the same globals, files, and inherited environment. It does not force a project name, change `COMPOSE_PROJECT_NAME`, or read `.env` itself. Keep project identity independent of these reserved wrapper outputs. Configuration errors stop execution; direct Compose invocation without the required alias variables fails closed.
|
|
204
227
|
|
|
205
|
-
|
|
228
|
+
`down` stops this example's containers and removes its networks while retaining named database volumes. To erase **only disposable example data**, deliberately use `bundle exec ruby compose.rb -- down -v`, adding the exact same global options used to start it. Never remove a consumer's volumes as an alias-adoption step. The creation commands above require fresh volumes or logical databases that do not already exist.
|
|
206
229
|
|
|
207
230
|
### Canonical development and test Compose pattern
|
|
208
231
|
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
232
|
+
Apply the runnable example's network and alias patterns to the consumer's existing topology; do not replace its database architecture. Preserve its service names, images, credentials, volumes, migrations, and application commands. In this example, the wrapper derives aliases from the effective Compose project name and exports `POSTGRES_HOST` for `db`, `REPORTING_HOST` for `db_reporting`, and `ARCHIVE_HOST` for `db_archive`. These are example interpolation outputs, not prescribed application configuration names.
|
|
233
|
+
|
|
234
|
+
| Consumer architecture | Development contexts | Test contexts |
|
|
235
|
+
| --- | --- | --- |
|
|
236
|
+
| SQL Server only | API and jobs select `reporting_development` through `REPORTING_HOST` | Tests select `reporting_test` through the same `REPORTING_HOST` |
|
|
237
|
+
| PostgreSQL plus two external SQL Server sources | API and jobs select `app_development` through `POSTGRES_HOST`, `reporting_development` through `REPORTING_HOST`, and `archive_development` through `ARCHIVE_HOST` | Tests use those same three hosts with `app_test`, `reporting_test`, and `archive_test` respectively |
|
|
215
238
|
|
|
216
|
-
For
|
|
239
|
+
For an application using libpq's standard settings, the primary connection mapping can look like this. Its test service changes the logical database, not the server:
|
|
217
240
|
|
|
218
241
|
```yaml
|
|
219
|
-
# docker-compose.development.yml: also safe without the gateway overlay.
|
|
220
242
|
services:
|
|
221
243
|
api:
|
|
222
244
|
environment:
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
jobs:
|
|
226
|
-
environment:
|
|
227
|
-
AZURE_SQL_HOST: "${DB_HOST:?derive with database_alias}"
|
|
228
|
-
PGHOST: "${DB_TRAV_COM_HOST:?derive with database_alias}"
|
|
245
|
+
PGHOST: "${POSTGRES_HOST:?derive with database_alias}"
|
|
246
|
+
PGDATABASE: app_development
|
|
229
247
|
test_api:
|
|
230
248
|
environment:
|
|
231
|
-
|
|
232
|
-
|
|
249
|
+
PGHOST: "${POSTGRES_HOST:?derive with database_alias}"
|
|
250
|
+
PGDATABASE: app_test
|
|
233
251
|
db:
|
|
234
252
|
networks:
|
|
235
253
|
default:
|
|
236
254
|
aliases:
|
|
237
|
-
- "${
|
|
238
|
-
db_trav_com:
|
|
239
|
-
networks:
|
|
240
|
-
default:
|
|
241
|
-
aliases:
|
|
242
|
-
- "${DB_TRAV_COM_HOST:?derive with database_alias}"
|
|
255
|
+
- "${POSTGRES_HOST:?derive with database_alias}"
|
|
243
256
|
```
|
|
244
257
|
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
must use the alias derived for `db`, and its SQL Server host setting must use the alias derived for `db_trav_com`, with labels/ports matching those drivers.
|
|
249
|
-
Apply the rule separately to **every** database service, even when two services
|
|
250
|
-
use the same driver. Preserve each context's existing credentials, internal
|
|
251
|
-
port, and database name; tests must still select the test database rather than
|
|
252
|
-
development data.
|
|
258
|
+
Map SQL Server connections to the application's existing driver configuration in the same way: the reporting connection uses `REPORTING_HOST` and the archive connection uses `ARCHIVE_HOST`, with port `1433` and the context's intended logical database. Apply each connection to API, job, and test contexts that use it. `SQLCMD*` belongs to the diagnostic client, not a universal application interface. A SQL-only consumer does not need PostgreSQL settings.
|
|
259
|
+
|
|
260
|
+
The gateway overlay adds labels appropriate to each actual server. For example, this fragment exposes the reporting SQL Server, not the PostgreSQL primary:
|
|
253
261
|
|
|
254
262
|
```yaml
|
|
255
|
-
# docker-compose.development.gateway.yml
|
|
256
263
|
services:
|
|
257
|
-
|
|
258
|
-
networks:
|
|
259
|
-
- default
|
|
260
|
-
- local-gateway
|
|
261
|
-
db:
|
|
264
|
+
db_reporting:
|
|
262
265
|
networks:
|
|
263
266
|
default: {}
|
|
264
267
|
local-gateway: {}
|
|
265
268
|
labels:
|
|
266
269
|
- "local-gateway.tcp.driver=sql_server"
|
|
267
|
-
- "local-gateway.tcp.hostname=
|
|
270
|
+
- "local-gateway.tcp.hostname=reporting.${GATEWAY_HOSTNAME}"
|
|
268
271
|
- "local-gateway.tcp.port=1433"
|
|
269
|
-
db_trav_com:
|
|
270
|
-
networks:
|
|
271
|
-
default: {}
|
|
272
|
-
local-gateway: {}
|
|
273
|
-
labels:
|
|
274
|
-
- "local-gateway.tcp.driver=postgresql"
|
|
275
|
-
- "local-gateway.tcp.hostname=db.${GATEWAY_HOSTNAME}"
|
|
276
|
-
- "local-gateway.tcp.port=5432"
|
|
277
|
-
|
|
278
|
-
networks:
|
|
279
|
-
local-gateway:
|
|
280
|
-
external: true
|
|
281
|
-
name: local-gateway
|
|
282
272
|
```
|
|
283
273
|
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
network list can lose the private alias.
|
|
287
|
-
`local-gateway`. Jobs/tests need only `default` unless they themselves expose a
|
|
288
|
-
routed service; qualified database names remain safe if an existing overlay
|
|
289
|
-
also attaches them to the shared network.
|
|
274
|
+
The primary uses driver `postgresql`, hostname `db.${GATEWAY_HOSTNAME}`, and port `5432`; the second SQL Server uses driver `sql_server`, hostname `archive.${GATEWAY_HOSTNAME}`, and port `1433`. The runnable overlay declares the external `local-gateway` network. Each same-driver service needs its own desktop hostname.
|
|
275
|
+
|
|
276
|
+
Use **mapping-form** database networks in both files. Compose merges `default: {}` with the base's `default.aliases`; replacing that mapping with a network list can lose the private alias. Advertise qualified aliases only on `default`, never on `local-gateway`. Jobs/tests need only `default` unless they themselves expose a routed service; qualified database names remain safe if an existing overlay also attaches them to shared ingress.
|
|
290
277
|
|
|
291
|
-
The shared router owns `127.0.0.1:1433` and `127.0.0.1:5432`. No participating
|
|
292
|
-
database publishes either port, so multiple development/test stacks can start
|
|
293
|
-
concurrently. Internal connections use each server's internal port and existing
|
|
294
|
-
encryption policy; they do not pass through the router or require a published
|
|
295
|
-
port.
|
|
278
|
+
The shared router owns `127.0.0.1:1433` and `127.0.0.1:5432`. No participating database publishes either port, so multiple development/test stacks can start concurrently. Internal connections use each server's internal port and existing encryption policy; they do not pass through the router or require a published port.
|
|
296
279
|
|
|
297
280
|
### Explicit non-gateway fallback
|
|
298
281
|
|
|
299
|
-
Container-only development/tests work with the base alone. If desktop access
|
|
300
|
-
without the gateway is required, select a separate, project-local publishing
|
|
301
|
-
overlay **instead of** the gateway overlay:
|
|
282
|
+
Container-only development/tests work with the base alone. If desktop access without the gateway is required, select a separate, project-local publishing overlay **instead of** the gateway overlay:
|
|
302
283
|
|
|
303
284
|
```yaml
|
|
304
285
|
# docker-compose.development.ports.yml: opt-in, non-gateway mode only.
|
|
305
286
|
services:
|
|
306
287
|
db:
|
|
307
|
-
ports:
|
|
308
|
-
- "127.0.0.1:1433:1433"
|
|
309
|
-
db_trav_com:
|
|
310
288
|
ports:
|
|
311
289
|
- "127.0.0.1:5432:5432"
|
|
290
|
+
db_reporting:
|
|
291
|
+
ports:
|
|
292
|
+
- "127.0.0.1:1433:1433"
|
|
312
293
|
```
|
|
313
294
|
|
|
314
|
-
These fallback ports must be free; this mode does not promise parallel desktop
|
|
315
|
-
access. Do not combine it with the gateway or leave these publications in the
|
|
316
|
-
base/test files. When migrating a project that retains base publications, its
|
|
317
|
-
gateway overlay must explicitly clear each database's ports with
|
|
318
|
-
`ports: !reset []` (Docker Compose 2.24.4 or newer); simply omitting `ports` or
|
|
319
|
-
setting `ports: []` does not remove inherited publications. Prefer the
|
|
320
|
-
port-free base plus explicit fallback above.
|
|
295
|
+
These fallback ports must be free; this mode does not promise parallel desktop access. The archive SQL Server is intentionally not published in this fragment because the reporting server already occupies port `1433`. Do not combine fallback publications with the gateway or leave them in base/test files. When migrating a project that retains base publications, its gateway overlay must explicitly clear each database's ports with `ports: !reset []` (Docker Compose 2.24.4 or newer); simply omitting `ports` or setting `ports: []` does not remove inherited publications. Prefer the port-free base plus an explicit fallback.
|
|
321
296
|
|
|
322
|
-
Use the project's documented development wrapper to select Compose modes and
|
|
323
|
-
start/test/stop services. Inspect its rendered `config`: gateway mode must have
|
|
324
|
-
no database host publications and must retain the private aliases. A base-only
|
|
325
|
-
test wrapper must use the same qualified hosts.
|
|
297
|
+
Use the project's documented development wrapper to select Compose modes and start/test/stop services. Inspect its rendered `config`: gateway mode must have no database host publications and must retain the private aliases. A base-only test wrapper must use the same qualified hosts.
|
|
326
298
|
|
|
327
299
|
### Desktop database clients
|
|
328
300
|
|
|
329
|
-
For `GATEWAY_HOSTNAME=issue-123.example.localhost`,
|
|
330
|
-
`db.issue-123.example.localhost` on the driver's standard port:
|
|
301
|
+
For `GATEWAY_HOSTNAME=issue-123.example.localhost`, the runnable mixed-driver example exposes these desktop endpoints:
|
|
331
302
|
|
|
332
|
-
| Driver label | Host port | Client requirement |
|
|
333
|
-
| --- | ---: | --- |
|
|
334
|
-
| `
|
|
335
|
-
| `
|
|
303
|
+
| Desktop hostname | Driver label | Host port | Client requirement |
|
|
304
|
+
| --- | --- | ---: | --- |
|
|
305
|
+
| `db.issue-123.example.localhost` | `postgresql` | `5432` | SSL mode `require`, SNI enabled, development certificate accepted |
|
|
306
|
+
| `reporting.issue-123.example.localhost` | `sql_server` | `1433` | Encryption enabled and **Trust server certificate** selected |
|
|
307
|
+
| `archive.issue-123.example.localhost` | `sql_server` | `1433` | Encryption enabled and **Trust server certificate** selected |
|
|
336
308
|
|
|
337
|
-
Use the database container's actual internal port in
|
|
338
|
-
`local-gateway.tcp.port`; it need not match the host listener. Different drivers
|
|
339
|
-
can share a hostname because their listeners differ. Two databases using the
|
|
340
|
-
same driver need distinct labels, for example `db.${GATEWAY_HOSTNAME}` and
|
|
341
|
-
`db_trav_com.${GATEWAY_HOSTNAME}`.
|
|
309
|
+
Use the database container's actual internal port in `local-gateway.tcp.port`; it need not match the host listener. Different drivers can share a hostname because their listeners differ. Two databases using the same driver need distinct hostname labels, such as `reporting.${GATEWAY_HOSTNAME}` and `archive.${GATEWAY_HOSTNAME}`.
|
|
342
310
|
|
|
343
311
|
All `.localhost` names resolve to loopback. The gateway publishes loopback-only
|
|
344
312
|
listeners, discovers labelled containers through Docker, and uses the database
|
|
@@ -405,14 +373,11 @@ bundle exec ruby "$(bundle show syntax_tree)/exe/stree" check \
|
|
|
405
373
|
rake test
|
|
406
374
|
```
|
|
407
375
|
|
|
408
|
-
## Use case:
|
|
376
|
+
## Use case: concurrent application checkouts
|
|
377
|
+
|
|
378
|
+
Each participating project installs the published gem through its existing dependency and development-wrapper workflow. Its wrapper can start or reuse the shared gateway before starting application services. A primary checkout can use `http://example.localhost`, while a separate worktree uses `http://issue-123.example.localhost`. Routed API or mail services can use corresponding `api.` or `mail.` prefixes when the consumer supplies those labels.
|
|
409
379
|
|
|
410
|
-
|
|
411
|
-
2. Run `bundle install` in Traditional Knowledge so the published gateway gem is available.
|
|
412
|
-
3. Run `dev up --watch` in Traditional Knowledge. The gateway is the browser entrypoint; the base checkout uses `http://traditional-knowledge.localhost`, with the API at `http://api.traditional-knowledge.localhost` and MailDev at `http://mail.traditional-knowledge.localhost`.
|
|
413
|
-
4. A separately named checkout or worktree derives its own hostname, such as `http://issue-123.traditional-knowledge.localhost`. The API and MailDev hosts use the corresponding `api.` and `mail.` prefixes.
|
|
414
|
-
5. Run `dev down` to stop the application services. It stops the shared gateway only when no other project is attached.
|
|
415
|
-
6. When WRAP adopts the same contract, it can use its own checkout-derived hostnames through this shared gateway.
|
|
380
|
+
Application shutdown stops that checkout's services. A wrapper using the gateway lifecycle helper removes the shared gateway only when no other running consumer needs it. Hostname derivation and application lifecycle commands remain consumer responsibilities; the gem does not prescribe a particular application wrapper or rewrite its settings.
|
|
416
381
|
|
|
417
382
|
The gateway owns the single browser port on `127.0.0.1:80`. Participating projects keep service ports internal to Docker and route browser traffic with explicit Traefik labels.
|
|
418
383
|
|
|
@@ -458,17 +423,9 @@ and add gateway labels without publishing host ports. The
|
|
|
458
423
|
explains why a future HTTP/database ingress split requires coordinated consumer
|
|
459
424
|
migration rather than a transparent gem update.
|
|
460
425
|
|
|
461
|
-
##
|
|
426
|
+
## Application-owned integrations
|
|
462
427
|
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
```text
|
|
466
|
-
Allowed Callback URLs: http://*.traditional-knowledge.localhost/callback
|
|
467
|
-
Allowed Logout URLs: http://*.traditional-knowledge.localhost
|
|
468
|
-
Allowed Web Origins: http://*.traditional-knowledge.localhost
|
|
469
|
-
```
|
|
470
|
-
|
|
471
|
-
Keep existing production and staging entries. Verify that the identity provider accepts wildcard hostnames in each field before relying on this pattern.
|
|
428
|
+
Consumers configure their own public application URLs, browser origins, and identity-provider registrations to match their selected local hostnames. The gateway routes labelled services; it does not register callbacks, configure authentication, or guarantee an identity provider's wildcard policy. Keep production and staging registrations independent of local development settings.
|
|
472
429
|
|
|
473
430
|
## Security boundary
|
|
474
431
|
|
|
@@ -483,7 +440,12 @@ It mounts the Docker socket so it can discover labelled containers. A read-only
|
|
|
483
440
|
| Gateway will not start | Confirm `127.0.0.1:80` is free. |
|
|
484
441
|
| Generated hostname returns `404` | Confirm the web container has the route labels and is attached to `local-gateway`. |
|
|
485
442
|
| A project uses normal ports unexpectedly | Confirm the gateway container is running and has `local-gateway=true`. |
|
|
486
|
-
| Authentication rejects
|
|
443
|
+
| Authentication rejects a local URL | Check the consumer's configured application URL and identity-provider registration for the selected hostname. |
|
|
444
|
+
|
|
445
|
+
## Release 0.3.2
|
|
446
|
+
|
|
447
|
+
- Replace consumer-specific examples with a generic PostgreSQL primary and two SQL Server external-source simulators, plus a SQL-only subset and native diagnostic clients.
|
|
448
|
+
- Document same-server development/test database selection, real initialization/query commands, and safe disposable-data cleanup. The library runtime, routing, alias API, and consumer configurations are unchanged; no shared gateway restart is required.
|
|
487
449
|
|
|
488
450
|
## Release 0.3.1
|
|
489
451
|
|
|
@@ -5,31 +5,21 @@ validated on Linux. Windows Docker Desktop validation remains outstanding.
|
|
|
5
5
|
|
|
6
6
|
## Request
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
expose hostname-routed database services with the same simple declarative
|
|
10
|
-
integration it already uses for HTTP services.
|
|
8
|
+
Participating Docker Compose projects expose hostname-routed database services through the same declarative integration used for HTTP services. A consumer adds routing metadata and network membership to its existing gateway overlay; it does not implement address allocation, DNS, host-file management, route startup orchestration, or cleanup.
|
|
11
9
|
|
|
12
|
-
For
|
|
13
|
-
`docker-compose.development.gateway.yml`. WRAP must not implement address
|
|
14
|
-
allocation, routing, DNS, host-file management, startup orchestration, or
|
|
15
|
-
cleanup.
|
|
16
|
-
|
|
17
|
-
The initial endpoints are:
|
|
10
|
+
For a generic checkout with `GATEWAY_HOSTNAME=issue-123.example.localhost`, the mixed-driver example exposes:
|
|
18
11
|
|
|
19
12
|
```text
|
|
20
|
-
db
|
|
21
|
-
|
|
13
|
+
db.issue-123.example.localhost:5432 # PostgreSQL primary
|
|
14
|
+
reporting.issue-123.example.localhost:1433 # SQL Server external source
|
|
15
|
+
archive.issue-123.example.localhost:1433 # SQL Server external source
|
|
22
16
|
```
|
|
23
17
|
|
|
24
|
-
Each
|
|
18
|
+
Each endpoint connects a desktop client such as DBeaver to that checkout's labelled server. A SQL-only consumer can expose just the reporting server. Consumer service names and credentials remain application-owned; these generic roles are examples rather than required application architecture.
|
|
25
19
|
|
|
26
20
|
## Consumer Contract
|
|
27
21
|
|
|
28
|
-
A participating project keeps its databases on its private `default` network
|
|
29
|
-
and adds the existing `local-gateway` network plus three gateway-owned labels:
|
|
30
|
-
driver, desktop hostname, and internal port. The copyable SQL Server and
|
|
31
|
-
PostgreSQL base/overlay examples live in the README's
|
|
32
|
-
[canonical Compose pattern](../../README.md#canonical-development-and-test-compose-pattern).
|
|
22
|
+
A participating project keeps its databases on its private `default` network and adds the existing `local-gateway` network plus three gateway-owned labels: driver, desktop hostname, and internal port. The README's [canonical Compose pattern](../../README.md#canonical-development-and-test-compose-pattern) explains the mapping; [`examples/database-aliases`](../../examples/database-aliases) owns the runnable base and overlay.
|
|
33
23
|
|
|
34
24
|
| Connection path | Destination selection |
|
|
35
25
|
| --- | --- |
|
|
@@ -37,12 +27,11 @@ PostgreSQL base/overlay examples live in the README's
|
|
|
37
27
|
| Desktop database client | Encrypted `db.<worktree>.<project>.localhost` endpoint; driver/hostname labels select the backend |
|
|
38
28
|
| Database-local console, backup, clone | Explicitly selected container, then `localhost`; not gateway routing |
|
|
39
29
|
|
|
40
|
-
Each concurrent checkout has a distinct Compose project name. Each database
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
test contexts still select their own test database.
|
|
30
|
+
Each concurrent checkout has a distinct Compose project name. Each database advertises its qualified alias only on that project's `default` network. Use mapping-form database networks in the base and gateway overlay so Compose preserves `default.aliases`. Configure every API, job, and test context with the alias for its actual database server and that context's existing credentials and logical database name.
|
|
31
|
+
|
|
32
|
+
The generic mixed-driver example has PostgreSQL `db` and SQL Server `db_reporting`/`db_archive`; its wrapper exports their private aliases as `POSTGRES_HOST`, `REPORTING_HOST`, and `ARCHIVE_HOST`. Development and tests share those servers while selecting distinct logical databases: `app_development`/`app_test`, `reporting_development`/`reporting_test`, and `archive_development`/`archive_test`. A SQL-only application follows the same rule for its single server. Tests do not select a different driver or external-source server merely because they are tests.
|
|
33
|
+
|
|
34
|
+
The example's native `psql`/`sqlcmd` clients are diagnostic stand-ins. Real APIs, jobs, and test runners translate these aliases into their own driver configuration; standard `PG*`/`SQLCMD*` variables configure only clients that actually support them. The README owns database creation, identity-query, and disposable-volume cleanup commands. This example does not change consumer migrations, authorization, or test-reset policy.
|
|
46
35
|
|
|
47
36
|
The README's [private-alias length contract](../../README.md#private-database-alias-length) defines the opt-in 0.3.0 API: preserve full aliases through 63 bytes, otherwise retain a 38-character prefix and append a 96-bit SHA256 suffix over the NUL-separated project/service identity. Native Compose project selection and existing data identities remain authoritative; only private aliases shorten, never project names or volumes. Consumers must adopt the derived aliases in their own configuration; a gem upgrade alone does not repair them, and adoption requires no shared router restart.
|
|
48
37
|
|
|
@@ -124,7 +113,7 @@ All implementation belongs in this repository. The gateway must:
|
|
|
124
113
|
1. Discover participating containers and their routing metadata through Docker.
|
|
125
114
|
2. Derive or read the requested hostname and target internal port.
|
|
126
115
|
3. Distinguish concurrent worktrees even when they expose the same internal TCP port.
|
|
127
|
-
4. Make `db
|
|
116
|
+
4. Make checkout-specific endpoints such as `db.issue-123.example.localhost` connect to the correct local route.
|
|
128
117
|
5. Forward the raw TCP stream to the labelled container.
|
|
129
118
|
6. Add, update, and remove routes automatically as containers start, restart, and stop.
|
|
130
119
|
7. Preserve stable routing for a worktree while it remains active.
|
|
@@ -140,7 +129,7 @@ supported database handshake:
|
|
|
140
129
|
|
|
141
130
|
```text
|
|
142
131
|
DBeaver
|
|
143
|
-
-> db
|
|
132
|
+
-> db.issue-123.example.localhost:<driver port>
|
|
144
133
|
-> Docker publishes the database router on loopback
|
|
145
134
|
-> driver reads the encrypted handshake hostname
|
|
146
135
|
-> router selects the matching Docker label
|
|
@@ -196,16 +185,9 @@ instead of sharing a generic fixture layer.
|
|
|
196
185
|
|
|
197
186
|
## Hostname Contract
|
|
198
187
|
|
|
199
|
-
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
- `api.<worktree>.wrap.localhost`
|
|
203
|
-
- `mail.<worktree>.wrap.localhost`
|
|
204
|
-
- SQL Server is:
|
|
205
|
-
- `db.<worktree>.wrap.localhost`
|
|
206
|
-
- PostgreSQL uses the same hostname on port `5432`.
|
|
207
|
-
- Do not migrate consumers to `.test`, `.alt`, `.local`, `home.arpa`, or an externally registered domain as part of this issue.
|
|
208
|
-
- Do not require host resolver configuration; `.localhost` must retain its native loopback behavior.
|
|
188
|
+
Consumers choose checkout-derived `.localhost` hostnames without requiring a resolver change. A generic HTTP family can use `example.localhost`, `api.example.localhost`, and `mail.example.localhost`, with `issue-123.` inserted before `example.localhost` for a separate worktree. Existing consumers retain their established hostname families; adopting private aliases does not rename desktop routes.
|
|
189
|
+
|
|
190
|
+
Database labels independently identify each server. In the mixed-driver example, `db.<worktree>.example.localhost` selects PostgreSQL and `reporting.<worktree>.example.localhost`/`archive.<worktree>.example.localhost` select the two SQL Server instances. Different drivers may share a hostname because their listeners differ; same-driver servers must have distinct hostname identities. Do not migrate consumers to `.test`, `.alt`, `.local`, `home.arpa`, or an externally registered domain as part of alias adoption. `.localhost` retains native loopback behavior without host resolver configuration.
|
|
209
191
|
|
|
210
192
|
## Security Boundary
|
|
211
193
|
|
|
@@ -246,8 +228,7 @@ instead of sharing a generic fixture layer.
|
|
|
246
228
|
|
|
247
229
|
## Compatibility
|
|
248
230
|
|
|
249
|
-
- DBeaver connects to
|
|
250
|
-
or `5432` for PostgreSQL.
|
|
231
|
+
- DBeaver connects to the selected labelled `.localhost` endpoint on port `1433` for SQL Server or `5432` for PostgreSQL.
|
|
251
232
|
- SQL Server clients must enable encryption and trust the development server
|
|
252
233
|
certificate.
|
|
253
234
|
- PostgreSQL clients must use SSL mode `require`, send SNI, and permit the
|
|
@@ -270,9 +251,8 @@ instead of sharing a generic fixture layer.
|
|
|
270
251
|
1. Start worktree A and worktree B with the same database driver and internal
|
|
271
252
|
port.
|
|
272
253
|
2. Connect a DBeaver-equivalent client to
|
|
273
|
-
`db.<A>.
|
|
274
|
-
3. Connect to `db.<B>.
|
|
275
|
-
only B.
|
|
254
|
+
`db.<A>.example.localhost:<driver port>`; observe bytes reaching only A.
|
|
255
|
+
3. Connect to `db.<B>.example.localhost:<driver port>`; observe bytes reaching only B.
|
|
276
256
|
4. Repeat the routing check for both `sql_server` and `postgresql`.
|
|
277
257
|
5. Keep both connections possible concurrently without alternate host ports.
|
|
278
258
|
6. Recreate A's database container; the same hostname routes to its replacement.
|
|
@@ -13,8 +13,9 @@ global_options = ARGV.take(delimiter)
|
|
|
13
13
|
command = ARGV.drop(delimiter + 1)
|
|
14
14
|
compose = ["docker", "compose", *global_options]
|
|
15
15
|
discovery_environment = {
|
|
16
|
-
"
|
|
17
|
-
"
|
|
16
|
+
"POSTGRES_HOST" => "alias-discovery-only",
|
|
17
|
+
"REPORTING_HOST" => "alias-discovery-only",
|
|
18
|
+
"ARCHIVE_HOST" => "alias-discovery-only"
|
|
18
19
|
}
|
|
19
20
|
|
|
20
21
|
# Render only: never create services with discovery placeholders. Compose owns
|
|
@@ -26,15 +27,20 @@ exit(status.exitstatus || 1) unless status.success?
|
|
|
26
27
|
|
|
27
28
|
project_name = JSON.parse(configuration).fetch("name")
|
|
28
29
|
host_environment = {
|
|
29
|
-
"
|
|
30
|
+
"POSTGRES_HOST" =>
|
|
30
31
|
LocalDevelopmentGateway.database_alias(
|
|
31
32
|
project_name: project_name,
|
|
32
33
|
service_name: "db"
|
|
33
34
|
),
|
|
34
|
-
"
|
|
35
|
+
"REPORTING_HOST" =>
|
|
35
36
|
LocalDevelopmentGateway.database_alias(
|
|
36
37
|
project_name: project_name,
|
|
37
|
-
service_name: "
|
|
38
|
+
service_name: "db_reporting"
|
|
39
|
+
),
|
|
40
|
+
"ARCHIVE_HOST" =>
|
|
41
|
+
LocalDevelopmentGateway.database_alias(
|
|
42
|
+
project_name: project_name,
|
|
43
|
+
service_name: "db_archive"
|
|
38
44
|
)
|
|
39
45
|
}
|
|
40
46
|
|
|
@@ -1,81 +1,105 @@
|
|
|
1
1
|
services:
|
|
2
2
|
db:
|
|
3
3
|
image: postgres:17-alpine
|
|
4
|
-
hostname: primary-db
|
|
5
4
|
environment:
|
|
6
5
|
POSTGRES_USER: example
|
|
7
6
|
POSTGRES_PASSWORD: development-only
|
|
8
|
-
POSTGRES_DB:
|
|
7
|
+
POSTGRES_DB: app_development
|
|
9
8
|
volumes:
|
|
10
|
-
-
|
|
9
|
+
- postgres-data:/var/lib/postgresql/data
|
|
11
10
|
networks:
|
|
12
11
|
default:
|
|
13
12
|
aliases:
|
|
14
|
-
- "${
|
|
13
|
+
- "${POSTGRES_HOST:?run compose.rb}"
|
|
15
14
|
healthcheck:
|
|
16
|
-
test: ["CMD-SHELL", "pg_isready -U example -d
|
|
15
|
+
test: ["CMD-SHELL", "pg_isready -U example -d app_development"]
|
|
17
16
|
interval: 2s
|
|
18
17
|
timeout: 2s
|
|
19
18
|
retries: 30
|
|
20
19
|
|
|
21
|
-
|
|
22
|
-
image:
|
|
23
|
-
hostname: secondary-db
|
|
20
|
+
db_reporting:
|
|
21
|
+
image: mcr.microsoft.com/mssql/server:2022-CU14-ubuntu-22.04
|
|
24
22
|
environment:
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
ACCEPT_EULA: "Y"
|
|
24
|
+
MSSQL_PID: Developer
|
|
25
|
+
MSSQL_SA_PASSWORD: "Example-Only_Strong9!"
|
|
28
26
|
volumes:
|
|
29
|
-
-
|
|
27
|
+
- reporting-data:/var/opt/mssql
|
|
30
28
|
networks:
|
|
31
29
|
default:
|
|
32
30
|
aliases:
|
|
33
|
-
- "${
|
|
31
|
+
- "${REPORTING_HOST:?run compose.rb}"
|
|
34
32
|
healthcheck:
|
|
35
|
-
test:
|
|
36
|
-
|
|
37
|
-
|
|
33
|
+
test:
|
|
34
|
+
- CMD-SHELL
|
|
35
|
+
- /opt/mssql-tools18/bin/sqlcmd -S localhost -U sa -P "$$MSSQL_SA_PASSWORD" -C -b -Q "SELECT 1"
|
|
36
|
+
interval: 5s
|
|
37
|
+
timeout: 5s
|
|
38
38
|
retries: 30
|
|
39
|
+
start_period: 20s
|
|
39
40
|
|
|
40
|
-
|
|
41
|
+
db_archive:
|
|
42
|
+
image: mcr.microsoft.com/mssql/server:2022-CU14-ubuntu-22.04
|
|
43
|
+
environment:
|
|
44
|
+
ACCEPT_EULA: "Y"
|
|
45
|
+
MSSQL_PID: Developer
|
|
46
|
+
MSSQL_SA_PASSWORD: "Example-Only_Strong9!"
|
|
47
|
+
volumes:
|
|
48
|
+
- archive-data:/var/opt/mssql
|
|
49
|
+
networks:
|
|
50
|
+
default:
|
|
51
|
+
aliases:
|
|
52
|
+
- "${ARCHIVE_HOST:?run compose.rb}"
|
|
53
|
+
healthcheck:
|
|
54
|
+
test:
|
|
55
|
+
- CMD-SHELL
|
|
56
|
+
- /opt/mssql-tools18/bin/sqlcmd -S localhost -U sa -P "$$MSSQL_SA_PASSWORD" -C -b -Q "SELECT 1"
|
|
57
|
+
interval: 5s
|
|
58
|
+
timeout: 5s
|
|
59
|
+
retries: 30
|
|
60
|
+
start_period: 20s
|
|
61
|
+
|
|
62
|
+
postgres_client:
|
|
41
63
|
image: postgres:17-alpine
|
|
42
64
|
profiles: [clients]
|
|
43
|
-
|
|
65
|
+
entrypoint: ["psql"]
|
|
66
|
+
command: []
|
|
44
67
|
environment:
|
|
45
|
-
PGHOST: "${
|
|
68
|
+
PGHOST: "${POSTGRES_HOST:?run compose.rb}"
|
|
46
69
|
PGPORT: "5432"
|
|
47
70
|
PGUSER: example
|
|
48
71
|
PGPASSWORD: development-only
|
|
49
|
-
PGDATABASE:
|
|
72
|
+
PGDATABASE: app_development
|
|
50
73
|
networks:
|
|
51
74
|
default: {}
|
|
52
75
|
|
|
53
|
-
|
|
54
|
-
image:
|
|
76
|
+
reporting_client:
|
|
77
|
+
image: mcr.microsoft.com/mssql/server:2022-CU14-ubuntu-22.04
|
|
55
78
|
profiles: [clients]
|
|
56
|
-
|
|
79
|
+
entrypoint: ["/opt/mssql-tools18/bin/sqlcmd", "-C", "-b"]
|
|
80
|
+
command: []
|
|
57
81
|
environment:
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
PGDATABASE: app_data
|
|
82
|
+
SQLCMDSERVER: "tcp:${REPORTING_HOST:?run compose.rb},1433"
|
|
83
|
+
SQLCMDUSER: sa
|
|
84
|
+
SQLCMDPASSWORD: "Example-Only_Strong9!"
|
|
85
|
+
SQLCMDDBNAME: master
|
|
63
86
|
networks:
|
|
64
87
|
default: {}
|
|
65
88
|
|
|
66
|
-
|
|
67
|
-
image:
|
|
89
|
+
archive_client:
|
|
90
|
+
image: mcr.microsoft.com/mssql/server:2022-CU14-ubuntu-22.04
|
|
68
91
|
profiles: [clients]
|
|
69
|
-
|
|
92
|
+
entrypoint: ["/opt/mssql-tools18/bin/sqlcmd", "-C", "-b"]
|
|
93
|
+
command: []
|
|
70
94
|
environment:
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
PGDATABASE: test_data
|
|
95
|
+
SQLCMDSERVER: "tcp:${ARCHIVE_HOST:?run compose.rb},1433"
|
|
96
|
+
SQLCMDUSER: sa
|
|
97
|
+
SQLCMDPASSWORD: "Example-Only_Strong9!"
|
|
98
|
+
SQLCMDDBNAME: master
|
|
76
99
|
networks:
|
|
77
100
|
default: {}
|
|
78
101
|
|
|
79
102
|
volumes:
|
|
80
|
-
|
|
81
|
-
|
|
103
|
+
postgres-data: {}
|
|
104
|
+
reporting-data: {}
|
|
105
|
+
archive-data: {}
|
|
@@ -8,29 +8,23 @@ services:
|
|
|
8
8
|
local-gateway.tcp.hostname: "db.${GATEWAY_HOSTNAME:?set a unique checkout-derived GATEWAY_HOSTNAME}"
|
|
9
9
|
local-gateway.tcp.port: "5432"
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
db_reporting:
|
|
12
12
|
networks:
|
|
13
13
|
default: {}
|
|
14
14
|
local-gateway: {}
|
|
15
15
|
labels:
|
|
16
|
-
local-gateway.tcp.driver:
|
|
17
|
-
local-gateway.tcp.hostname: "
|
|
18
|
-
local-gateway.tcp.port: "
|
|
19
|
-
|
|
20
|
-
api:
|
|
21
|
-
networks:
|
|
22
|
-
default: {}
|
|
23
|
-
local-gateway: {}
|
|
16
|
+
local-gateway.tcp.driver: sql_server
|
|
17
|
+
local-gateway.tcp.hostname: "reporting.${GATEWAY_HOSTNAME:?set a unique checkout-derived GATEWAY_HOSTNAME}"
|
|
18
|
+
local-gateway.tcp.port: "1433"
|
|
24
19
|
|
|
25
|
-
|
|
26
|
-
networks:
|
|
27
|
-
default: {}
|
|
28
|
-
local-gateway: {}
|
|
29
|
-
|
|
30
|
-
test_api:
|
|
20
|
+
db_archive:
|
|
31
21
|
networks:
|
|
32
22
|
default: {}
|
|
33
23
|
local-gateway: {}
|
|
24
|
+
labels:
|
|
25
|
+
local-gateway.tcp.driver: sql_server
|
|
26
|
+
local-gateway.tcp.hostname: "archive.${GATEWAY_HOSTNAME:?set a unique checkout-derived GATEWAY_HOSTNAME}"
|
|
27
|
+
local-gateway.tcp.port: "1433"
|
|
34
28
|
|
|
35
29
|
networks:
|
|
36
30
|
local-gateway:
|