@ductape/cli 0.5.0 → 0.5.3
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.
- package/dist/commands/app-webhooks.d.ts +16 -0
- package/dist/commands/app-webhooks.js +60 -0
- package/dist/commands/apps.d.ts +6 -0
- package/dist/commands/apps.js +20 -4
- package/dist/commands/cloud.d.ts +8 -0
- package/dist/commands/cloud.js +40 -1
- package/dist/commands/deploy-builds.d.ts +3 -1
- package/dist/commands/deploy-builds.js +11 -3
- package/dist/commands/deploy-remote.d.ts +34 -1
- package/dist/commands/deploy-remote.js +109 -3
- package/dist/commands/deploy-worker.d.ts +30 -0
- package/dist/commands/deploy-worker.js +85 -0
- package/dist/commands/install.d.ts +28 -1
- package/dist/commands/install.js +72 -24
- package/dist/commands/platform.js +9 -3
- package/dist/commands/secrets-scan.d.ts +49 -0
- package/dist/commands/secrets-scan.js +113 -0
- package/dist/index.js +108 -17
- package/dist/lib/api-client.js +4 -2
- package/dist/lib/app-import.d.ts +1 -0
- package/dist/lib/app-import.js +8 -1
- package/dist/lib/cloud-connection.d.ts +89 -1
- package/dist/lib/cloud-connection.js +417 -5
- package/dist/lib/env-scan.d.ts +57 -0
- package/dist/lib/env-scan.js +161 -0
- package/dist/lib/platform-api.js +3 -9
- package/package.json +1 -1
- package/templates/api-gateway.conf +53 -34
- package/templates/docker-compose.backend.yml +7 -0
- package/templates/docker-compose.release.yml +122 -103
- package/templates/docker-compose.workbench.yml +58 -0
- package/templates/platform.env +65 -7
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reading a project's .env file to find the values that are secrets, so they can be saved to the workspace's secrets (and then used as
|
|
3
|
+
* `{ "secret": "NAME" }` in a release's configuration). Everything here is pure and works on text; nothing here prints, logs or returns a
|
|
4
|
+
* value except `parseDotenv`, whose output stays inside the command and goes only to the workspace. A result meant for a person or an
|
|
5
|
+
* assistant (`describePlan`) carries names, reasons and lengths, never any part of a value.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Reads dotenv text: `NAME=value`, an optional `export `, single and double quotes (a double-quoted value may span lines and uses \n, \t and \"
|
|
9
|
+
* escapes), `#` comments on their own line or after an unquoted value, and blank lines. A name that is not a valid variable name is skipped.
|
|
10
|
+
* When a name appears more than once the last one wins, as in every dotenv loader.
|
|
11
|
+
*/
|
|
12
|
+
export function parseDotenv(text) {
|
|
13
|
+
const entries = new Map();
|
|
14
|
+
const lines = text.replace(/^\uFEFF/, '').split(/\r?\n/);
|
|
15
|
+
for (let i = 0; i < lines.length; i += 1) {
|
|
16
|
+
const raw = lines[i];
|
|
17
|
+
const match = /^\s*(?:export\s+)?([A-Za-z_][A-Za-z0-9_.-]*)\s*=\s*(.*)$/.exec(raw);
|
|
18
|
+
if (!match || /^\s*#/.test(raw))
|
|
19
|
+
continue;
|
|
20
|
+
const [, name, rest] = match;
|
|
21
|
+
let value;
|
|
22
|
+
const start = i + 1;
|
|
23
|
+
if (rest.startsWith('"')) {
|
|
24
|
+
// A double-quoted value runs to the closing quote, across lines if it has to.
|
|
25
|
+
let body = rest.slice(1);
|
|
26
|
+
let closed = false;
|
|
27
|
+
let result = '';
|
|
28
|
+
for (;;) {
|
|
29
|
+
let j = 0;
|
|
30
|
+
for (; j < body.length; j += 1) {
|
|
31
|
+
if (body[j] === '\\' && j + 1 < body.length) {
|
|
32
|
+
result += body[j] + body[j + 1];
|
|
33
|
+
j += 1;
|
|
34
|
+
continue;
|
|
35
|
+
}
|
|
36
|
+
if (body[j] === '"') {
|
|
37
|
+
closed = true;
|
|
38
|
+
break;
|
|
39
|
+
}
|
|
40
|
+
result += body[j];
|
|
41
|
+
}
|
|
42
|
+
if (closed || i + 1 >= lines.length)
|
|
43
|
+
break;
|
|
44
|
+
i += 1;
|
|
45
|
+
result += '\n';
|
|
46
|
+
body = lines[i];
|
|
47
|
+
}
|
|
48
|
+
value = result.replace(/\\(["\\nrt])/g, (_m, c) => (c === 'n' ? '\n' : c === 'r' ? '\r' : c === 't' ? '\t' : c));
|
|
49
|
+
}
|
|
50
|
+
else if (rest.startsWith("'")) {
|
|
51
|
+
const end = rest.indexOf("'", 1);
|
|
52
|
+
value = end === -1 ? rest.slice(1) : rest.slice(1, end);
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
// Unquoted: a ` #` starts a comment.
|
|
56
|
+
value = rest.replace(/\s+#.*$/, '').trim();
|
|
57
|
+
}
|
|
58
|
+
const previous = entries.get(name);
|
|
59
|
+
entries.set(name, { name, value, line: start, ...(previous ? { duplicate: true } : {}) });
|
|
60
|
+
}
|
|
61
|
+
return [...entries.values()];
|
|
62
|
+
}
|
|
63
|
+
const SECRET_NAME = /(^|_)(SECRET|TOKEN|PASSWORD|PASSWD|PWD|PASS|PRIVATE|CREDENTIAL|CREDENTIALS|AUTH|BEARER|COOKIE|SALT|SIGNATURE|SIGNING|WEBHOOK|DSN|CERT|PEM)(_|$)|API_?KEY|ACCESS_?KEY|SECRET_?KEY|PRIVATE_?KEY|CLIENT_?SECRET|CONNECTION_?STRING|ENCRYPTION_?KEY|(^|_)KEY$|(^|_)KEYS$/i;
|
|
64
|
+
const CONFIG_NAME = /^(NODE_ENV|ENV|ENVIRONMENT|PORT|HOST|HOSTNAME|REGION|LOG_?LEVEL|DEBUG|TZ|LANG|TIMEZONE|APP_?NAME|APP_?ENV|VERSION|BASE_?URL|PUBLIC_.*|NEXT_PUBLIC_.*|VITE_.*|REACT_APP_.*)$|(^|_)(PORT|HOST|REGION|ENABLED|DISABLED|TIMEOUT|LIMIT|URL|URI|ENDPOINT|DOMAIN|BUCKET|NAMESPACE|LEVEL|MODE|NAME)$/i;
|
|
65
|
+
const PLACEHOLDER = /^(changeme|change_me|change-me|todo|tbd|xxx+|\*+|your[-_ ].*|<.*>|\[.*\]|replace[-_ ]?me.*|example.*|placeholder.*|none|null|undefined|secret|password)$/i;
|
|
66
|
+
const VALUE_SHAPES = [
|
|
67
|
+
[/^-----BEGIN [A-Z ]*PRIVATE KEY-----/, 'a private key'],
|
|
68
|
+
[/^(sk|rk)_(live|test)_[A-Za-z0-9]{10,}$/, 'a payment provider secret key'],
|
|
69
|
+
[/^(AKIA|ASIA)[A-Z0-9]{16}$/, 'an AWS access key id'],
|
|
70
|
+
[/^gh[pousr]_[A-Za-z0-9]{20,}$/, 'a GitHub token'],
|
|
71
|
+
[/^xox[abprs]-[A-Za-z0-9-]{10,}$/, 'a Slack token'],
|
|
72
|
+
[/^eyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{5,}$/, 'a signed token'],
|
|
73
|
+
[/^[a-z][a-z0-9+.-]*:\/\/[^\s/:@]+:[^\s/@]+@/, 'a URL with a password in it'],
|
|
74
|
+
];
|
|
75
|
+
const entropy = (value) => {
|
|
76
|
+
const counts = new Map();
|
|
77
|
+
for (const ch of value)
|
|
78
|
+
counts.set(ch, (counts.get(ch) ?? 0) + 1);
|
|
79
|
+
let bits = 0;
|
|
80
|
+
for (const n of counts.values())
|
|
81
|
+
bits -= (n / value.length) * Math.log2(n / value.length);
|
|
82
|
+
return bits;
|
|
83
|
+
};
|
|
84
|
+
/**
|
|
85
|
+
* Decides whether an entry looks like a secret, from its name and the shape of its value. It is a guide, not a judgement: the person (or the
|
|
86
|
+
* assistant, with the person) chooses what to save, with `--only` and `--all`. A value is only ever looked at, never kept or shown.
|
|
87
|
+
*/
|
|
88
|
+
export function classifyEntry(entry) {
|
|
89
|
+
const { name, value } = entry;
|
|
90
|
+
if (value === '')
|
|
91
|
+
return { name, classification: 'skip', reason: 'it has no value' };
|
|
92
|
+
if (PLACEHOLDER.test(value.trim()))
|
|
93
|
+
return { name, classification: 'skip', reason: 'the value is a placeholder, not a real value' };
|
|
94
|
+
if (/\$\{[A-Za-z_][A-Za-z0-9_]*\}|\$[A-Za-z_][A-Za-z0-9_]*/.test(value) && !/^-----BEGIN/.test(value)) {
|
|
95
|
+
return { name, classification: 'skip', reason: 'it refers to another variable, so the text on its own is not the value' };
|
|
96
|
+
}
|
|
97
|
+
for (const [pattern, what] of VALUE_SHAPES)
|
|
98
|
+
if (pattern.test(value))
|
|
99
|
+
return { name, classification: 'secret', reason: `the value looks like ${what}` };
|
|
100
|
+
// These prefixes mean the value is put into code that runs in a browser, so it is public by design whatever else the name says.
|
|
101
|
+
if (/^(NEXT_PUBLIC_|VITE_|REACT_APP_|PUBLIC_|EXPO_PUBLIC_)/i.test(name))
|
|
102
|
+
return { name, classification: 'config', reason: 'the name says it is sent to browsers, so it is public' };
|
|
103
|
+
if (SECRET_NAME.test(name))
|
|
104
|
+
return { name, classification: 'secret', reason: 'the name says it is a credential' };
|
|
105
|
+
if (CONFIG_NAME.test(name))
|
|
106
|
+
return { name, classification: 'config', reason: 'the name says it is configuration' };
|
|
107
|
+
if (/^(true|false|yes|no|on|off|\d+(\.\d+)?)$/i.test(value))
|
|
108
|
+
return { name, classification: 'config', reason: 'the value is a flag or a number' };
|
|
109
|
+
if (value.length >= 24 && !/\s/.test(value) && entropy(value) >= 3.5)
|
|
110
|
+
return { name, classification: 'secret', reason: 'the value is a long, random-looking string' };
|
|
111
|
+
return { name, classification: 'config', reason: 'nothing about the name or the value says it is a secret' };
|
|
112
|
+
}
|
|
113
|
+
const KEY = /^[A-Za-z_][A-Za-z0-9_.-]{0,254}$/;
|
|
114
|
+
/** What would be saved, and why each of the rest is not. Pure: no value leaves this function except as a length. */
|
|
115
|
+
export function planScan(entries, existingKeys, options = {}) {
|
|
116
|
+
const only = options.only ? new Set(options.only) : undefined;
|
|
117
|
+
const exclude = new Set(options.exclude ?? []);
|
|
118
|
+
const known = new Set(entries.map((e) => e.name));
|
|
119
|
+
for (const name of only ?? [])
|
|
120
|
+
if (!known.has(name))
|
|
121
|
+
throw new Error(`"${name}" is not in the file, so it cannot be saved. The names in it: ${[...known].sort().join(', ') || '(none)'}`);
|
|
122
|
+
const prefix = options.prefix ?? '';
|
|
123
|
+
if (prefix && !/^[A-Za-z_][A-Za-z0-9_.-]*$/.test(prefix))
|
|
124
|
+
throw new Error('--prefix must start with a letter or underscore and use letters, digits, underscores, dots or hyphens');
|
|
125
|
+
return entries.map((entry) => {
|
|
126
|
+
const verdict = classifyEntry(entry);
|
|
127
|
+
const key = `${prefix}${entry.name}`;
|
|
128
|
+
const base = { ...verdict, key, length: entry.value.length, ...(entry.duplicate ? { duplicate: true } : {}) };
|
|
129
|
+
if (!KEY.test(key))
|
|
130
|
+
return { ...base, classification: 'skip', action: 'skip', reason: 'the name cannot be used as a secret key' };
|
|
131
|
+
if (exclude.has(entry.name))
|
|
132
|
+
return { ...base, action: 'excluded' };
|
|
133
|
+
const forced = only?.has(entry.name) ?? false;
|
|
134
|
+
// A name asked for is saved unless there is nothing to save; an empty value or a reference to another variable never is.
|
|
135
|
+
if (verdict.classification === 'skip' && !(forced && /placeholder/.test(verdict.reason)))
|
|
136
|
+
return { ...base, action: 'skip' };
|
|
137
|
+
const wanted = only ? forced : options.all ? true : verdict.classification === 'secret';
|
|
138
|
+
if (!wanted)
|
|
139
|
+
return { ...base, action: 'config' };
|
|
140
|
+
if (existingKeys.has(key))
|
|
141
|
+
return { ...base, action: options.overwrite ? 'update' : 'exists' };
|
|
142
|
+
return { ...base, action: 'create' };
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
/** What a person or an assistant is shown. Names, the decision, the reason and a length: never any part of a value. */
|
|
146
|
+
export function describePlan(rows, source, applied) {
|
|
147
|
+
const count = (action) => rows.filter((r) => r.action === action).length;
|
|
148
|
+
return {
|
|
149
|
+
source,
|
|
150
|
+
applied,
|
|
151
|
+
summary: {
|
|
152
|
+
found: rows.length, [applied ? 'created' : 'would_create']: count('create'), [applied ? 'updated' : 'would_update']: count('update'),
|
|
153
|
+
already_in_workspace: count('exists'), left_as_configuration: count('config'), skipped: count('skip'), excluded: count('excluded'),
|
|
154
|
+
},
|
|
155
|
+
variables: rows.map((r) => ({ name: r.name, key: r.key, decision: r.action, classified_as: r.classification, reason: r.reason, value_length: r.length, ...(r.duplicate ? { duplicate_in_file: true } : {}) })),
|
|
156
|
+
use_in_configuration: rows.filter((r) => r.action === 'create' || r.action === 'update' || r.action === 'exists').map((r) => ({ [r.name]: { secret: r.key } })),
|
|
157
|
+
note: applied
|
|
158
|
+
? 'The values were read from the file on this machine and sent to the workspace. They are not shown here, and are not in this output.'
|
|
159
|
+
: 'Nothing was saved. Run again with --apply to save the variables marked create or update. The values are never printed.',
|
|
160
|
+
};
|
|
161
|
+
}
|
package/dist/lib/platform-api.js
CHANGED
|
@@ -429,21 +429,15 @@ export async function createApp(ctx, body) {
|
|
|
429
429
|
return unwrapOne(result);
|
|
430
430
|
}
|
|
431
431
|
export async function updateApp(ctx, appId, body) {
|
|
432
|
-
const q =
|
|
433
|
-
|
|
434
|
-
public_key: ctx.credentials.public_key,
|
|
435
|
-
};
|
|
436
|
-
const result = await client(ctx).put(`/apps/v1/${appId}?${new URLSearchParams(q).toString()}`, body);
|
|
432
|
+
const q = workspaceAuthQuery(ctx);
|
|
433
|
+
const result = await client(ctx).put(`/apps/v1/${appId}?${new URLSearchParams(q).toString()}`, { component: 'app', ...body });
|
|
437
434
|
return unwrapOne(result);
|
|
438
435
|
}
|
|
439
436
|
export async function updateAppViaProxy(ctx, tag, body) {
|
|
440
437
|
return proxy(ctx).execute('app', 'update', [tag, body]);
|
|
441
438
|
}
|
|
442
439
|
export async function deleteApp(ctx, appId) {
|
|
443
|
-
const q =
|
|
444
|
-
user_id: ctx.credentials.user_id,
|
|
445
|
-
public_key: ctx.credentials.public_key,
|
|
446
|
-
};
|
|
440
|
+
const q = workspaceAuthQuery(ctx);
|
|
447
441
|
return client(ctx).delete(`/apps/v1/${appId}?${new URLSearchParams(q).toString()}`);
|
|
448
442
|
}
|
|
449
443
|
// —— App actions (sdk-proxy — admin op, requires access key) ——
|
package/package.json
CHANGED
|
@@ -1,26 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
upstream nest_apps { server apps:8004; }
|
|
5
|
-
upstream nest_marketplace { server marketplace:8007; }
|
|
6
|
-
upstream nest_logs { server logs:8008; }
|
|
7
|
-
upstream nest_integrations { server integrations:8009; }
|
|
8
|
-
upstream nest_webhooks { server webhooks:8012; }
|
|
9
|
-
upstream nest_notifications { server notifications:8013; }
|
|
10
|
-
upstream nest_partnerships { server partnerships:8014; }
|
|
11
|
-
upstream nest_jobs { server jobs:8015; }
|
|
12
|
-
upstream nest_pricing { server pricing:8011; }
|
|
13
|
-
upstream nest_admins { server admins:8018; }
|
|
14
|
-
upstream nest_proxy { server proxy:8020; }
|
|
15
|
-
upstream nest_tickets { server tickets:9002; }
|
|
16
|
-
upstream nest_realtime { server realtime:3030; }
|
|
17
|
-
|
|
1
|
+
# Upstream names are resolved when a request arrives (Docker's resolver, short cache), not when nginx starts.
|
|
2
|
+
# Otherwise a restarted service gets a new address that nginx never learns, and one missing service stops the
|
|
3
|
+
# whole gateway from starting.
|
|
18
4
|
server {
|
|
19
5
|
listen 8000;
|
|
6
|
+
resolver 127.0.0.11 valid=5s ipv6=off;
|
|
20
7
|
client_max_body_size 50m;
|
|
21
8
|
|
|
22
9
|
location /users/ {
|
|
23
|
-
|
|
10
|
+
set $upstream http://users:8002;
|
|
11
|
+
proxy_pass $upstream;
|
|
24
12
|
proxy_http_version 1.1;
|
|
25
13
|
proxy_set_header Host $host;
|
|
26
14
|
proxy_set_header X-Real-IP $remote_addr;
|
|
@@ -29,7 +17,8 @@ server {
|
|
|
29
17
|
}
|
|
30
18
|
|
|
31
19
|
location /workspaces/ {
|
|
32
|
-
|
|
20
|
+
set $upstream http://workspaces:8001;
|
|
21
|
+
proxy_pass $upstream;
|
|
33
22
|
proxy_http_version 1.1;
|
|
34
23
|
proxy_set_header Host $host;
|
|
35
24
|
proxy_set_header X-Real-IP $remote_addr;
|
|
@@ -38,7 +27,8 @@ server {
|
|
|
38
27
|
}
|
|
39
28
|
|
|
40
29
|
location /emails/ {
|
|
41
|
-
|
|
30
|
+
set $upstream http://emails:8003;
|
|
31
|
+
proxy_pass $upstream;
|
|
42
32
|
proxy_http_version 1.1;
|
|
43
33
|
proxy_set_header Host $host;
|
|
44
34
|
proxy_set_header X-Real-IP $remote_addr;
|
|
@@ -47,7 +37,8 @@ server {
|
|
|
47
37
|
}
|
|
48
38
|
|
|
49
39
|
location /apps/ {
|
|
50
|
-
|
|
40
|
+
set $upstream http://apps:8004;
|
|
41
|
+
proxy_pass $upstream;
|
|
51
42
|
proxy_http_version 1.1;
|
|
52
43
|
proxy_set_header Host $host;
|
|
53
44
|
proxy_set_header X-Real-IP $remote_addr;
|
|
@@ -56,7 +47,8 @@ server {
|
|
|
56
47
|
}
|
|
57
48
|
|
|
58
49
|
location /marketplace/ {
|
|
59
|
-
|
|
50
|
+
set $upstream http://marketplace:8007;
|
|
51
|
+
proxy_pass $upstream;
|
|
60
52
|
proxy_http_version 1.1;
|
|
61
53
|
proxy_set_header Host $host;
|
|
62
54
|
proxy_set_header X-Real-IP $remote_addr;
|
|
@@ -65,7 +57,19 @@ server {
|
|
|
65
57
|
}
|
|
66
58
|
|
|
67
59
|
location /logs/ {
|
|
68
|
-
|
|
60
|
+
set $upstream http://logs:8008;
|
|
61
|
+
proxy_pass $upstream;
|
|
62
|
+
proxy_http_version 1.1;
|
|
63
|
+
proxy_set_header Host $host;
|
|
64
|
+
proxy_set_header X-Real-IP $remote_addr;
|
|
65
|
+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
66
|
+
proxy_set_header X-Forwarded-Proto $scheme;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
# The Workbench and the SDK call the logs service under /log/v1, so it is routed as well as /logs/.
|
|
70
|
+
location /log/ {
|
|
71
|
+
set $upstream http://logs:8008;
|
|
72
|
+
proxy_pass $upstream;
|
|
69
73
|
proxy_http_version 1.1;
|
|
70
74
|
proxy_set_header Host $host;
|
|
71
75
|
proxy_set_header X-Real-IP $remote_addr;
|
|
@@ -74,7 +78,8 @@ server {
|
|
|
74
78
|
}
|
|
75
79
|
|
|
76
80
|
location /integrations/ {
|
|
77
|
-
|
|
81
|
+
set $upstream http://integrations:8009;
|
|
82
|
+
proxy_pass $upstream;
|
|
78
83
|
proxy_http_version 1.1;
|
|
79
84
|
proxy_set_header Host $host;
|
|
80
85
|
proxy_set_header X-Real-IP $remote_addr;
|
|
@@ -87,7 +92,8 @@ server {
|
|
|
87
92
|
}
|
|
88
93
|
|
|
89
94
|
location /webhooks/ {
|
|
90
|
-
|
|
95
|
+
set $upstream http://webhooks:8012;
|
|
96
|
+
proxy_pass $upstream;
|
|
91
97
|
proxy_http_version 1.1;
|
|
92
98
|
proxy_set_header Host $host;
|
|
93
99
|
proxy_set_header X-Real-IP $remote_addr;
|
|
@@ -96,7 +102,8 @@ server {
|
|
|
96
102
|
}
|
|
97
103
|
|
|
98
104
|
location /notifications/ {
|
|
99
|
-
|
|
105
|
+
set $upstream http://notifications:8013;
|
|
106
|
+
proxy_pass $upstream;
|
|
100
107
|
proxy_http_version 1.1;
|
|
101
108
|
proxy_set_header Host $host;
|
|
102
109
|
proxy_set_header X-Real-IP $remote_addr;
|
|
@@ -105,7 +112,8 @@ server {
|
|
|
105
112
|
}
|
|
106
113
|
|
|
107
114
|
location /partnerships/ {
|
|
108
|
-
|
|
115
|
+
set $upstream http://partnerships:8014;
|
|
116
|
+
proxy_pass $upstream;
|
|
109
117
|
proxy_http_version 1.1;
|
|
110
118
|
proxy_set_header Host $host;
|
|
111
119
|
proxy_set_header X-Real-IP $remote_addr;
|
|
@@ -114,7 +122,8 @@ server {
|
|
|
114
122
|
}
|
|
115
123
|
|
|
116
124
|
location /jobs/ {
|
|
117
|
-
|
|
125
|
+
set $upstream http://jobs:8015;
|
|
126
|
+
proxy_pass $upstream;
|
|
118
127
|
proxy_http_version 1.1;
|
|
119
128
|
proxy_set_header Host $host;
|
|
120
129
|
proxy_set_header X-Real-IP $remote_addr;
|
|
@@ -123,7 +132,8 @@ server {
|
|
|
123
132
|
}
|
|
124
133
|
|
|
125
134
|
location /pricing/ {
|
|
126
|
-
|
|
135
|
+
set $upstream http://pricing:8011;
|
|
136
|
+
proxy_pass $upstream;
|
|
127
137
|
proxy_http_version 1.1;
|
|
128
138
|
proxy_set_header Host $host;
|
|
129
139
|
proxy_set_header X-Real-IP $remote_addr;
|
|
@@ -132,7 +142,8 @@ server {
|
|
|
132
142
|
}
|
|
133
143
|
|
|
134
144
|
location /admins/ {
|
|
135
|
-
|
|
145
|
+
set $upstream http://admins:8018;
|
|
146
|
+
proxy_pass $upstream;
|
|
136
147
|
proxy_http_version 1.1;
|
|
137
148
|
proxy_set_header Host $host;
|
|
138
149
|
proxy_set_header X-Real-IP $remote_addr;
|
|
@@ -141,7 +152,8 @@ server {
|
|
|
141
152
|
}
|
|
142
153
|
|
|
143
154
|
location /proxy/ {
|
|
144
|
-
|
|
155
|
+
set $upstream http://proxy:8020;
|
|
156
|
+
proxy_pass $upstream;
|
|
145
157
|
proxy_http_version 1.1;
|
|
146
158
|
proxy_set_header Host $host;
|
|
147
159
|
proxy_set_header X-Real-IP $remote_addr;
|
|
@@ -153,7 +165,8 @@ server {
|
|
|
153
165
|
}
|
|
154
166
|
|
|
155
167
|
location /tickets/ {
|
|
156
|
-
|
|
168
|
+
set $upstream http://tickets:9002;
|
|
169
|
+
proxy_pass $upstream;
|
|
157
170
|
proxy_http_version 1.1;
|
|
158
171
|
proxy_set_header Host $host;
|
|
159
172
|
proxy_set_header X-Real-IP $remote_addr;
|
|
@@ -161,8 +174,10 @@ server {
|
|
|
161
174
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
162
175
|
}
|
|
163
176
|
|
|
164
|
-
|
|
165
|
-
|
|
177
|
+
# Realtime is served by the proxy service (WebSocket, at /realtime). Both /realtime and /realtime/ are accepted.
|
|
178
|
+
location ~ ^/realtime/?$ {
|
|
179
|
+
set $upstream http://proxy:8020;
|
|
180
|
+
proxy_pass $upstream;
|
|
166
181
|
proxy_http_version 1.1;
|
|
167
182
|
proxy_set_header Upgrade $http_upgrade;
|
|
168
183
|
proxy_set_header Connection "upgrade";
|
|
@@ -170,6 +185,10 @@ server {
|
|
|
170
185
|
proxy_set_header X-Real-IP $remote_addr;
|
|
171
186
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
172
187
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
188
|
+
# A connection may sit idle for a long time between messages; the server pings it every 30 seconds.
|
|
189
|
+
proxy_connect_timeout 60s;
|
|
190
|
+
proxy_send_timeout 3600s;
|
|
191
|
+
proxy_read_timeout 3600s;
|
|
173
192
|
}
|
|
174
193
|
|
|
175
194
|
location / {
|