stoobly-agent 1.10.0__py3-none-any.whl → 1.10.1__py3-none-any.whl
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.
- stoobly_agent/__init__.py +1 -1
- stoobly_agent/app/api/application_http_request_handler.py +5 -2
- stoobly_agent/app/cli/scaffold/constants.py +1 -3
- stoobly_agent/app/cli/scaffold/docker/service/build_decorator.py +2 -2
- stoobly_agent/app/cli/scaffold/docker/service/builder.py +17 -6
- stoobly_agent/app/cli/scaffold/docker/workflow/builder.py +0 -9
- stoobly_agent/app/cli/scaffold/docker/workflow/command_decorator.py +2 -1
- stoobly_agent/app/cli/scaffold/service_config.py +1 -25
- stoobly_agent/app/cli/scaffold/service_docker_compose.py +3 -3
- stoobly_agent/app/cli/scaffold/service_workflow_validate_command.py +10 -7
- stoobly_agent/app/cli/scaffold/templates/app/build/.docker-compose.base.yml +2 -2
- stoobly_agent/app/cli/scaffold/templates/app/build/mock/bin/configure +1 -1
- stoobly_agent/app/cli/scaffold/templates/app/build/record/bin/configure +26 -1
- stoobly_agent/app/cli/scaffold/templates/app/build/test/bin/configure +1 -1
- stoobly_agent/app/cli/scaffold/templates/app/entrypoint/.docker-compose.base.yml +2 -2
- stoobly_agent/app/cli/scaffold/templates/app/entrypoint/mock/bin/configure +1 -1
- stoobly_agent/app/cli/scaffold/templates/app/entrypoint/record/bin/configure +1 -1
- stoobly_agent/app/cli/scaffold/templates/app/entrypoint/test/bin/configure +1 -1
- stoobly_agent/app/cli/scaffold/templates/build/workflows/record/.configure +21 -1
- stoobly_agent/app/cli/scaffold/templates/workflow/mock/bin/configure +2 -10
- stoobly_agent/app/cli/scaffold/templates/workflow/record/bin/configure +19 -45
- stoobly_agent/app/cli/scaffold/templates/workflow/test/bin/configure +2 -10
- stoobly_agent/app/cli/scaffold_cli.py +21 -23
- stoobly_agent/app/proxy/intercept_settings.py +1 -1
- stoobly_agent/app/proxy/record/upload_request_service.py +3 -6
- stoobly_agent/app/proxy/utils/publish_change_service.py +20 -23
- stoobly_agent/app/settings/__init__.py +10 -7
- stoobly_agent/config/data_dir.py +1 -0
- stoobly_agent/public/index.html +1 -1
- stoobly_agent/public/main-es2015.5a9aa16433404c3f423a.js +1 -0
- stoobly_agent/public/main-es5.5a9aa16433404c3f423a.js +1 -0
- stoobly_agent/test/app/cli/scaffold/cli_invoker.py +2 -2
- stoobly_agent/test/app/cli/scaffold/cli_test.py +3 -3
- stoobly_agent/test/app/cli/scaffold/e2e_test.py +11 -11
- {stoobly_agent-1.10.0.dist-info → stoobly_agent-1.10.1.dist-info}/METADATA +1 -1
- {stoobly_agent-1.10.0.dist-info → stoobly_agent-1.10.1.dist-info}/RECORD +39 -39
- stoobly_agent/public/main-es2015.089b46f303768fbe864f.js +0 -1
- stoobly_agent/public/main-es5.089b46f303768fbe864f.js +0 -1
- {stoobly_agent-1.10.0.dist-info → stoobly_agent-1.10.1.dist-info}/LICENSE +0 -0
- {stoobly_agent-1.10.0.dist-info → stoobly_agent-1.10.1.dist-info}/WHEEL +0 -0
- {stoobly_agent-1.10.0.dist-info → stoobly_agent-1.10.1.dist-info}/entry_points.txt +0 -0
stoobly_agent/__init__.py
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
COMMAND = 'stoobly-agent'
|
2
|
-
VERSION = '1.10.
|
2
|
+
VERSION = '1.10.1'
|
@@ -104,11 +104,14 @@ class ApplicationHTTPRequestHandler(SimpleHTTPRequestHandler):
|
|
104
104
|
headers.CLIENT.title(),
|
105
105
|
custom_headers.DO_PROXY.title(),
|
106
106
|
headers.EXPIRY.title(),
|
107
|
+
custom_headers.REQUEST_ORIGIN.title(),
|
108
|
+
headers.TOKEN_TYPE.title(),
|
109
|
+
headers.UID.title(),
|
110
|
+
|
111
|
+
# ProxyController headers
|
107
112
|
headers.PROXY_HEADERS.title(),
|
108
113
|
headers.REQUEST_PATH.title(),
|
109
114
|
custom_headers.SERVICE_URL.title(),
|
110
|
-
headers.TOKEN_TYPE.title(),
|
111
|
-
headers.UID.title(),
|
112
115
|
])
|
113
116
|
self.send_header(header, allowed_headers)
|
114
117
|
rendered_headers.append(header)
|
@@ -18,7 +18,6 @@ CERTS_DIR_ENV = 'CERTS_DIR'
|
|
18
18
|
COMPOSE_TEMPLATE = '.docker-compose.{workflow}.yml'
|
19
19
|
CONFIG_FILE = '.config.yml'
|
20
20
|
CONTEXT_DIR_ENV = 'CONTEXT_DIR'
|
21
|
-
DOCKER_NAMESPACE = 'docker'
|
22
21
|
DOTENV_FILE = '.env'
|
23
22
|
DOTENV_PATH_ENV = 'STOOBLY_DOTENV_PATH'
|
24
23
|
NAMESERVERS_FILE = '.nameservers'
|
@@ -37,8 +36,6 @@ SERVICE_ID_ENV = 'SERVICE_ID'
|
|
37
36
|
SERVICE_LOCAL_ENV = 'SERVICE_LOCAL'
|
38
37
|
SERVICE_NAME = '${SERVICE_NAME}'
|
39
38
|
SERVICE_NAME_ENV = 'SERVICE_NAME'
|
40
|
-
SERVICE_PROXY_MODE = '${SERVICE_PROXY_MODE}'
|
41
|
-
SERVICE_PROXY_MODE_ENV = 'SERVICE_PROXY_MODE'
|
42
39
|
SERVICE_SCHEME = '${SERVICE_SCHEME}'
|
43
40
|
SERVICE_SCHEME_ENV = 'SERVICE_SCHEME'
|
44
41
|
SERVICE_PORT = '${SERVICE_PORT}'
|
@@ -53,6 +50,7 @@ SERVICE_UPSTREAM_PORT = '${SERVICE_UPSTREAM_PORT}'
|
|
53
50
|
SERVICE_UPSTREAM_PORT_ENV = 'SERVICE_UPSTREAM_PORT'
|
54
51
|
SERVICE_UPSTREAM_SCHEME = '${SERVICE_UPSTREAM_SCHEME}'
|
55
52
|
SERVICE_UPSTREAM_SCHEME_ENV = 'SERVICE_UPSTREAM_SCHEME'
|
53
|
+
SERVICES_NAMESPACE = 'services'
|
56
54
|
STOOBLY_HOME_DIR = '/home/stoobly'
|
57
55
|
STOOBLY_DATA_DIR = os.path.join(STOOBLY_HOME_DIR, DATA_DIR_NAME)
|
58
56
|
STOOBLY_CERTS_DIR = os.path.join(STOOBLY_DATA_DIR, CERTS_DIR_NAME)
|
@@ -2,7 +2,7 @@ import pdb
|
|
2
2
|
|
3
3
|
from typing import TypedDict
|
4
4
|
|
5
|
-
from ...constants import
|
5
|
+
from ...constants import SERVICES_NAMESPACE
|
6
6
|
from ..constants import DOCKERFILE_SERVICE
|
7
7
|
from .builder import ServiceBuilder
|
8
8
|
from .types import BuildDecoratorOptions
|
@@ -16,7 +16,7 @@ class BuildDecorator():
|
|
16
16
|
service_builder = self.__service_builder
|
17
17
|
build = {
|
18
18
|
'context': '../..', # Assumes app root is 2 levels up
|
19
|
-
'dockerfile': f"./{
|
19
|
+
'dockerfile': f"./{SERVICES_NAMESPACE}/{service_builder.service_name}/{DOCKERFILE_SERVICE}"
|
20
20
|
}
|
21
21
|
|
22
22
|
if 'build_args' in kwargs:
|
@@ -7,12 +7,13 @@ from stoobly_agent.config.data_dir import DATA_DIR_NAME
|
|
7
7
|
|
8
8
|
from ...app_config import AppConfig
|
9
9
|
from ...constants import (
|
10
|
-
APP_DIR,
|
10
|
+
APP_DIR, SERVICES_NAMESPACE,
|
11
11
|
SERVICE_HOSTNAME, SERVICE_HOSTNAME_ENV,
|
12
12
|
SERVICE_NAME, SERVICE_NAME_ENV,
|
13
13
|
SERVICE_ID,
|
14
14
|
SERVICE_PORT, SERVICE_PORT_ENV,
|
15
|
-
SERVICE_SCHEME, SERVICE_SCHEME_ENV,
|
15
|
+
SERVICE_SCHEME, SERVICE_SCHEME_ENV,
|
16
|
+
SERVICE_UPSTREAM_HOSTNAME, SERVICE_UPSTREAM_HOSTNAME_ENV, SERVICE_UPSTREAM_PORT, SERVICE_UPSTREAM_PORT_ENV, SERVICE_UPSTREAM_SCHEME, SERVICE_UPSTREAM_SCHEME_ENV,
|
16
17
|
STOOBLY_HOME_DIR, STOOBLY_HOME_DIR,
|
17
18
|
WORKFLOW_NAME, WORKFLOW_NAME_ENV, WORKFLOW_SCRIPTS, WORKFLOW_TEMPLATE
|
18
19
|
)
|
@@ -37,7 +38,7 @@ class ServiceBuilder(Builder):
|
|
37
38
|
self.__env = [SERVICE_NAME_ENV, WORKFLOW_NAME_ENV]
|
38
39
|
self.__service_name = os.path.basename(service_path)
|
39
40
|
self.__working_dir = os.path.join(
|
40
|
-
STOOBLY_HOME_DIR, DATA_DIR_NAME,
|
41
|
+
STOOBLY_HOME_DIR, DATA_DIR_NAME, SERVICES_NAMESPACE, SERVICE_NAME, WORKFLOW_NAME
|
41
42
|
)
|
42
43
|
|
43
44
|
@property
|
@@ -220,13 +221,23 @@ class ServiceBuilder(Builder):
|
|
220
221
|
volumes.append(f"{self.service_name}:{STOOBLY_HOME_DIR}/{DATA_DIR_NAME}")
|
221
222
|
|
222
223
|
# Mount docker folder
|
223
|
-
volumes.append(f"../:{STOOBLY_HOME_DIR}/{DATA_DIR_NAME}/{
|
224
|
+
volumes.append(f"../:{STOOBLY_HOME_DIR}/{DATA_DIR_NAME}/{SERVICES_NAMESPACE}")
|
224
225
|
|
225
226
|
def __with_url_environment(self, environment):
|
226
|
-
|
227
|
+
if self.config.hostname:
|
228
|
+
environment[SERVICE_HOSTNAME_ENV] = SERVICE_HOSTNAME
|
227
229
|
|
228
230
|
if self.config.scheme:
|
229
231
|
environment[SERVICE_SCHEME_ENV] = SERVICE_SCHEME
|
230
232
|
|
231
233
|
if self.config.port:
|
232
|
-
environment[SERVICE_PORT_ENV] = SERVICE_PORT
|
234
|
+
environment[SERVICE_PORT_ENV] = SERVICE_PORT
|
235
|
+
|
236
|
+
if self.config.upstream_hostname:
|
237
|
+
environment[SERVICE_UPSTREAM_HOSTNAME_ENV] = SERVICE_UPSTREAM_HOSTNAME
|
238
|
+
|
239
|
+
if self.config.upstream_port:
|
240
|
+
environment[SERVICE_UPSTREAM_PORT_ENV] = SERVICE_UPSTREAM_PORT
|
241
|
+
|
242
|
+
if self.config.upstream_scheme:
|
243
|
+
environment[SERVICE_UPSTREAM_SCHEME_ENV] = SERVICE_UPSTREAM_SCHEME
|
@@ -165,12 +165,3 @@ class WorkflowBuilder(Builder):
|
|
165
165
|
compose['volumes'] = self.volumes
|
166
166
|
|
167
167
|
super().write(compose)
|
168
|
-
|
169
|
-
def __with_url_environment(self, environment):
|
170
|
-
environment[SERVICE_HOSTNAME_ENV] = SERVICE_HOSTNAME
|
171
|
-
|
172
|
-
if self.config.scheme:
|
173
|
-
environment[SERVICE_SCHEME_ENV] = SERVICE_SCHEME
|
174
|
-
|
175
|
-
if self.config.port:
|
176
|
-
environment[SERVICE_PORT_ENV] = SERVICE_PORT
|
@@ -1,5 +1,5 @@
|
|
1
1
|
from ...constants import (
|
2
|
-
|
2
|
+
SERVICE_UPSTREAM_HOSTNAME, SERVICE_UPSTREAM_PORT, SERVICE_UPSTREAM_SCHEME,
|
3
3
|
)
|
4
4
|
from .builder import WorkflowBuilder
|
5
5
|
|
@@ -15,6 +15,7 @@ class CommandDecorator():
|
|
15
15
|
@property
|
16
16
|
def proxy_mode(self):
|
17
17
|
config = self.workflow_builder.config
|
18
|
+
|
18
19
|
if config.upstream_hostname == 'host.docker.internal':
|
19
20
|
return f"upstream:{SERVICE_UPSTREAM_SCHEME}://{SERVICE_UPSTREAM_HOSTNAME}:{SERVICE_UPSTREAM_PORT}"
|
20
21
|
|
@@ -12,7 +12,6 @@ from .constants import (
|
|
12
12
|
SERVICE_NAME_ENV,
|
13
13
|
SERVICE_PRIORITY_ENV,
|
14
14
|
SERVICE_PORT_ENV,
|
15
|
-
SERVICE_PROXY_MODE_ENV,
|
16
15
|
SERVICE_SCHEME_ENV,
|
17
16
|
SERVICE_UPSTREAM_HOSTNAME_ENV,
|
18
17
|
SERVICE_UPSTREAM_PORT_ENV,
|
@@ -30,7 +29,6 @@ class ServiceConfig(Config):
|
|
30
29
|
self.__name = None
|
31
30
|
self.__port = None
|
32
31
|
self.__priority = None
|
33
|
-
self.__proxy_mode = None
|
34
32
|
self.__scheme = None
|
35
33
|
self.__upstream_hostname = None
|
36
34
|
self.__upstream_port = None
|
@@ -58,9 +56,6 @@ class ServiceConfig(Config):
|
|
58
56
|
if 'priority' in kwargs:
|
59
57
|
self.__priority = kwargs.get('priority')
|
60
58
|
|
61
|
-
if 'proxy_mode' in kwargs:
|
62
|
-
self.__proxy_mode = kwargs.get('proxy_mode')
|
63
|
-
|
64
59
|
if 'scheme' in kwargs:
|
65
60
|
self.__scheme = kwargs.get('scheme')
|
66
61
|
|
@@ -152,22 +147,6 @@ class ServiceConfig(Config):
|
|
152
147
|
def priority(self, v):
|
153
148
|
self.__priority = v
|
154
149
|
|
155
|
-
@property
|
156
|
-
def proxy_mode(self) -> str:
|
157
|
-
if self.__proxy_mode:
|
158
|
-
return (self.__proxy_mode or '').strip()
|
159
|
-
|
160
|
-
if not self.hostname:
|
161
|
-
return ''
|
162
|
-
|
163
|
-
return 'regular'
|
164
|
-
|
165
|
-
@proxy_mode.setter
|
166
|
-
def proxy_mode(self, v: str):
|
167
|
-
if v and v not in ['regular', 'reverse']:
|
168
|
-
v = 'reverse'
|
169
|
-
self.__proxy_mode = v
|
170
|
-
|
171
150
|
@property
|
172
151
|
def scheme(self):
|
173
152
|
if not self.__scheme and self.__port:
|
@@ -221,7 +200,7 @@ class ServiceConfig(Config):
|
|
221
200
|
|
222
201
|
@upstream_scheme.setter
|
223
202
|
def upstream_scheme(self, v):
|
224
|
-
self.
|
203
|
+
self.__upstream_scheme = v
|
225
204
|
|
226
205
|
@property
|
227
206
|
def url(self):
|
@@ -247,7 +226,6 @@ class ServiceConfig(Config):
|
|
247
226
|
self.name = config.get(SERVICE_NAME_ENV)
|
248
227
|
self.port = config.get(SERVICE_PORT_ENV)
|
249
228
|
self.priority = config.get(SERVICE_PRIORITY_ENV)
|
250
|
-
self.proxy_mode = config.get(SERVICE_PROXY_MODE_ENV)
|
251
229
|
self.scheme = config.get(SERVICE_SCHEME_ENV)
|
252
230
|
self.upstream_hostname = config.get(SERVICE_UPSTREAM_HOSTNAME_ENV)
|
253
231
|
self.upstream_port = config.get(SERVICE_UPSTREAM_PORT_ENV)
|
@@ -261,7 +239,6 @@ class ServiceConfig(Config):
|
|
261
239
|
'name': self.name,
|
262
240
|
'port': self.port,
|
263
241
|
'priority': self.priority,
|
264
|
-
'proxy_mode': self.proxy_mode,
|
265
242
|
'scheme': self.scheme if self.hostname else '',
|
266
243
|
'upstream_hostname': self.upstream_hostname,
|
267
244
|
'upstream_port': self.upstream_port,
|
@@ -300,6 +277,5 @@ class ServiceConfig(Config):
|
|
300
277
|
|
301
278
|
config[SERVICE_DETACHED_ENV] = bool(self.detached)
|
302
279
|
config[SERVICE_ID_ENV] = self.id
|
303
|
-
config[SERVICE_PROXY_MODE_ENV] = self.proxy_mode
|
304
280
|
|
305
281
|
super().write(config)
|
@@ -1,6 +1,6 @@
|
|
1
|
+
from stoobly_agent.app.cli.scaffold.constants import SERVICES_NAMESPACE
|
1
2
|
from stoobly_agent.config.data_dir import DataDir
|
2
3
|
|
3
|
-
|
4
4
|
class ServiceDockerCompose():
|
5
5
|
def __init__(self, app_dir_path, target_workflow_name, service_name, hostname):
|
6
6
|
self.service_name = service_name
|
@@ -11,5 +11,5 @@ class ServiceDockerCompose():
|
|
11
11
|
self.configure_container_name = f"{target_workflow_name}-{service_name}.configure-1"
|
12
12
|
|
13
13
|
data_dir_path = DataDir.instance(app_dir_path).path
|
14
|
-
self.docker_compose_path = f"{data_dir_path}/
|
15
|
-
self.init_script_path = f"{data_dir_path}/
|
14
|
+
self.docker_compose_path = f"{data_dir_path}/{SERVICES_NAMESPACE}/{service_name}/{target_workflow_name}/docker-compose.yml"
|
15
|
+
self.init_script_path = f"{data_dir_path}/{SERVICES_NAMESPACE}/{service_name}/{target_workflow_name}/bin/init"
|
@@ -12,11 +12,12 @@ from docker.models.containers import Container
|
|
12
12
|
|
13
13
|
from stoobly_agent.app.cli.scaffold.constants import (
|
14
14
|
PUBLIC_FOLDER_NAME,
|
15
|
+
SERVICES_NAMESPACE,
|
15
16
|
STOOBLY_DATA_DIR,
|
16
17
|
WORKFLOW_RECORD_TYPE,
|
17
18
|
WORKFLOW_TEST_TYPE,
|
18
19
|
)
|
19
|
-
from stoobly_agent.app.cli.scaffold.docker.constants import
|
20
|
+
from stoobly_agent.app.cli.scaffold.docker.constants import APP_INGRESS_NETWORK_TEMPLATE
|
20
21
|
from stoobly_agent.app.cli.scaffold.hosts_file_manager import HostsFileManager
|
21
22
|
from stoobly_agent.app.cli.scaffold.service_command import ServiceCommand
|
22
23
|
from stoobly_agent.app.cli.scaffold.service_docker_compose import ServiceDockerCompose
|
@@ -118,12 +119,14 @@ class ServiceWorkflowValidateCommand(ServiceCommand, ValidateCommand):
|
|
118
119
|
print(f"Validating hostname inside Docker network, url: {url}")
|
119
120
|
|
120
121
|
# See WorkflowRunCommand for how 'network' is generated
|
122
|
+
# Debug command=f"curl -k --max-time {timeout_seconds} {url} --verbose",
|
121
123
|
network = f"{self.workflow_name}.{self.app.network}"
|
122
124
|
timeout_seconds = 1
|
125
|
+
http_code_format = '"%{http_code}"'
|
123
126
|
output = self.docker_client.containers.run(
|
124
127
|
image='curlimages/curl:8.11.0',
|
125
|
-
command=f"curl --max-time {timeout_seconds} {url}
|
126
|
-
network=
|
128
|
+
command=f"curl -k -s -o /dev/null -w {http_code_format} --max-time {timeout_seconds} {url}",
|
129
|
+
network=APP_INGRESS_NETWORK_TEMPLATE.format(network=network),
|
127
130
|
stderr=True,
|
128
131
|
remove=True,
|
129
132
|
)
|
@@ -131,7 +134,7 @@ class ServiceWorkflowValidateCommand(ServiceCommand, ValidateCommand):
|
|
131
134
|
# Note: 499 error could also mean success because it shows the proxy
|
132
135
|
# connection is working, but we haven't recorded anything yet
|
133
136
|
logs = output.decode('ascii')
|
134
|
-
if
|
137
|
+
if logs != '200' and logs != '499':
|
135
138
|
raise ScaffoldValidateException(f"Error reaching {url} from inside Docker network")
|
136
139
|
|
137
140
|
# Check public folder exists in container
|
@@ -190,14 +193,14 @@ class ServiceWorkflowValidateCommand(ServiceCommand, ValidateCommand):
|
|
190
193
|
def validate(self) -> bool:
|
191
194
|
print(f"Validating service: {self.service_name}")
|
192
195
|
|
193
|
-
url =
|
196
|
+
url = self.service_config.url
|
194
197
|
|
195
198
|
if self.service_config.hostname and self.workflow_name not in [WORKFLOW_TEST_TYPE]:
|
196
199
|
self.validate_hostname(self.hostname, self.service_config.port)
|
197
200
|
|
198
201
|
# Test workflow won't expose services that are detached and have a hostname to the host such as assets.
|
199
202
|
# Need to test connection from inside the Docker network
|
200
|
-
if self.service_config.hostname and self.workflow_name == WORKFLOW_TEST_TYPE
|
203
|
+
if self.service_config.hostname and self.workflow_name == WORKFLOW_TEST_TYPE:
|
201
204
|
self.validate_internal_hostname(url)
|
202
205
|
|
203
206
|
self.validate_init_containers(self.service_docker_compose.init_container_name, self.service_docker_compose.configure_container_name)
|
@@ -231,7 +234,7 @@ class ServiceWorkflowValidateCommand(ServiceCommand, ValidateCommand):
|
|
231
234
|
if self.is_local():
|
232
235
|
print(f"Validating local user defined service: {self.service_name}")
|
233
236
|
# Validate docker-compose path exists
|
234
|
-
docker_compose_path = f"{self.app_dir_path}/{DATA_DIR_NAME}/
|
237
|
+
docker_compose_path = f"{self.app_dir_path}/{DATA_DIR_NAME}/{SERVICES_NAMESPACE}/{self.service_docker_compose.service_name}/{self.workflow_name}/docker-compose.yml"
|
235
238
|
destination_path = Path(docker_compose_path)
|
236
239
|
|
237
240
|
if not destination_path.exists():
|
@@ -6,7 +6,7 @@ services:
|
|
6
6
|
extends:
|
7
7
|
file: ../.docker-compose.base.yml
|
8
8
|
service: context_base
|
9
|
-
working_dir: /home/stoobly/.stoobly/
|
9
|
+
working_dir: /home/stoobly/.stoobly/services/${SERVICE_NAME}/${WORKFLOW_NAME}
|
10
10
|
build.init_base:
|
11
11
|
command:
|
12
12
|
- ${SERVICE_SCRIPTS}/${SERVICE_NAME}/${WORKFLOW_TEMPLATE}/.init
|
@@ -16,4 +16,4 @@ services:
|
|
16
16
|
service: context_base
|
17
17
|
volumes:
|
18
18
|
- ${APP_DIR}:/app
|
19
|
-
working_dir: /home/stoobly/.stoobly/
|
19
|
+
working_dir: /home/stoobly/.stoobly/services/${SERVICE_NAME}/${WORKFLOW_NAME}
|
@@ -1,3 +1,28 @@
|
|
1
1
|
#!/bin/bash
|
2
2
|
|
3
|
-
# Add custom Stoobly configuration here
|
3
|
+
# Add custom Stoobly configuration here, to learn more: https://docs.stoobly.com/core-concepts/agent/proxy-settings
|
4
|
+
|
5
|
+
echo "Configuring rewrite rules..."
|
6
|
+
stoobly-agent config rewrite set \
|
7
|
+
--method GET --method POST --method OPTIONS --method PUT --method DELETE \
|
8
|
+
--mode record \
|
9
|
+
--name authorization \
|
10
|
+
--pattern ".*" \
|
11
|
+
--type Header \
|
12
|
+
--value '' \
|
13
|
+
|
14
|
+
stoobly-agent config rewrite set \
|
15
|
+
--method GET --method POST --method OPTIONS --method PUT --method DELETE \
|
16
|
+
--mode record \
|
17
|
+
--name cookie \
|
18
|
+
--pattern ".*" \
|
19
|
+
--type Header \
|
20
|
+
--value '' \
|
21
|
+
|
22
|
+
stoobly-agent config rewrite set \
|
23
|
+
--method GET --method POST --method OPTIONS --method PUT --method DELETE \
|
24
|
+
--mode record \
|
25
|
+
--name set-cookie \
|
26
|
+
--pattern ".*" \
|
27
|
+
--type 'Response Header' \
|
28
|
+
--value '' \
|
@@ -6,7 +6,7 @@ services:
|
|
6
6
|
extends:
|
7
7
|
file: ../.docker-compose.base.yml
|
8
8
|
service: context_base
|
9
|
-
working_dir: /home/stoobly/.stoobly/
|
9
|
+
working_dir: /home/stoobly/.stoobly/services/${SERVICE_NAME}/${WORKFLOW_NAME}
|
10
10
|
entrypoint.init_base:
|
11
11
|
command:
|
12
12
|
- ${SERVICE_SCRIPTS}/${SERVICE_NAME}/${WORKFLOW_TEMPLATE}/.init
|
@@ -16,4 +16,4 @@ services:
|
|
16
16
|
service: context_base
|
17
17
|
volumes:
|
18
18
|
- ${APP_DIR}:/app
|
19
|
-
working_dir: /home/stoobly/.stoobly/
|
19
|
+
working_dir: /home/stoobly/.stoobly/services/${SERVICE_NAME}/${WORKFLOW_NAME}
|
@@ -5,6 +5,26 @@
|
|
5
5
|
|
6
6
|
entrypoint=$1
|
7
7
|
|
8
|
+
port=$SERVICE_PORT
|
9
|
+
scheme=$SERVICE_SCHEME
|
10
|
+
service_origin="$scheme://$SERVICE_HOSTNAME"
|
11
|
+
|
12
|
+
if [ "$scheme" = 'http' -a "$port" != '80' ] || [ "$scheme" = 'https' -a "$port" != '443' ]; then
|
13
|
+
service_origin="$service_origin:$port"
|
14
|
+
fi
|
15
|
+
|
16
|
+
port=$SERVICE_UPSTREAM_PORT
|
17
|
+
scheme=$SERVICE_UPSTREAM_SCHEME
|
18
|
+
upstream_origin="$scheme://$SERVICE_UPSTREAM_HOSTNAME"
|
19
|
+
|
20
|
+
if [ "$scheme" = 'http' -a "$port" != '80' ] || [ "$scheme" = 'https' -a "$port" != '443' ]; then
|
21
|
+
upstream_origin="$upstream_origin:$port"
|
22
|
+
fi
|
23
|
+
|
24
|
+
if [ "$service_origin" != "$upstream_origin" ] && [ "$SERVICE_UPSTREAM_HOSTNAME" != "host.docker.internal" ]; then
|
25
|
+
service_origin="$upstream_origin"
|
26
|
+
fi
|
27
|
+
|
8
28
|
if [ -e "$entrypoint" ]; then
|
9
|
-
"$entrypoint"
|
29
|
+
"$entrypoint" "$service_origin"
|
10
30
|
fi
|
@@ -1,13 +1,5 @@
|
|
1
1
|
#!/bin/bash
|
2
2
|
|
3
|
-
# Add custom Stoobly configuration here
|
3
|
+
# Add custom Stoobly configuration here, to learn more: https://docs.stoobly.com/core-concepts/agent/proxy-settings
|
4
4
|
|
5
|
-
|
6
|
-
hostname=$SERVICE_HOSTNAME
|
7
|
-
port=$SERVICE_PORT
|
8
|
-
|
9
|
-
origin="$scheme://$hostname"
|
10
|
-
|
11
|
-
if [ "$scheme" = 'http' -a "$port" != '80' ] || [ "$scheme" = 'https' -a "$port" != '443' ]; then
|
12
|
-
origin="$origin:$port"
|
13
|
-
fi
|
5
|
+
origin=$1 # e.g. https://docs.stoobly.com
|
@@ -1,47 +1,21 @@
|
|
1
1
|
#!/bin/bash
|
2
2
|
|
3
|
-
# Add custom Stoobly configuration here
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
#
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
# Rewrite
|
24
|
-
echo "Configuring rewrite rules..."
|
25
|
-
stoobly-agent config rewrite set \
|
26
|
-
--method GET --method POST --method OPTIONS --method PUT --method DELETE \
|
27
|
-
--mode record \
|
28
|
-
--name authorization \
|
29
|
-
--pattern "$origin/?.*?" \
|
30
|
-
--type Header \
|
31
|
-
--value '' \
|
32
|
-
|
33
|
-
stoobly-agent config rewrite set \
|
34
|
-
--method GET --method POST --method OPTIONS --method PUT --method DELETE \
|
35
|
-
--mode record \
|
36
|
-
--name cookie \
|
37
|
-
--pattern "$origin/?.*?" \
|
38
|
-
--type Header \
|
39
|
-
--value '' \
|
40
|
-
|
41
|
-
stoobly-agent config rewrite set \
|
42
|
-
--method GET --method POST --method OPTIONS --method PUT --method DELETE \
|
43
|
-
--mode record \
|
44
|
-
--name set-cookie \
|
45
|
-
--pattern "$origin/?.*?" \
|
46
|
-
--type 'Response Header' \
|
47
|
-
--value '' \
|
3
|
+
# Add custom Stoobly configuration here, to learn more: https://docs.stoobly.com/core-concepts/agent/proxy-settings
|
4
|
+
|
5
|
+
origin=$1 # e.g. https://docs.stoobly.com
|
6
|
+
|
7
|
+
# Uncomment the following example to include or exclude requests
|
8
|
+
# stoobly-agent config firewall set \
|
9
|
+
# --action include \
|
10
|
+
# --method GET --method POST --method OPTIONS --method PUT --method DELETE \
|
11
|
+
# --mode record \
|
12
|
+
# --pattern "$origin/index.html"
|
13
|
+
|
14
|
+
# Uncomment the following example to modify parts of a request
|
15
|
+
# stoobly-agent config rewrite set \
|
16
|
+
# --method GET --method POST --method OPTIONS --method PUT --method DELETE \
|
17
|
+
# --mode record \
|
18
|
+
# --name etag \
|
19
|
+
# --pattern "$origin/.*" \
|
20
|
+
# --type Header \
|
21
|
+
# --value '' \
|
@@ -1,13 +1,5 @@
|
|
1
1
|
#!/bin/bash
|
2
2
|
|
3
|
-
# Add custom Stoobly configuration here
|
3
|
+
# Add custom Stoobly configuration here, to learn more: https://docs.stoobly.com/core-concepts/agent/proxy-settings
|
4
4
|
|
5
|
-
|
6
|
-
hostname=$SERVICE_HOSTNAME
|
7
|
-
port=$SERVICE_PORT
|
8
|
-
|
9
|
-
origin="$scheme://$hostname"
|
10
|
-
|
11
|
-
if [ "$scheme" = 'http' -a "$port" != '80' ] || [ "$scheme" = 'https' -a "$port" != '443' ]; then
|
12
|
-
origin="$origin:$port"
|
13
|
-
fi
|
5
|
+
origin=$1 # e.g. https://docs.stoobly.com
|