stoobly-agent 1.9.12__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.
Files changed (98) hide show
  1. stoobly_agent/__init__.py +1 -1
  2. stoobly_agent/app/api/__init__.py +4 -20
  3. stoobly_agent/app/api/application_http_request_handler.py +5 -2
  4. stoobly_agent/app/api/configs_controller.py +3 -3
  5. stoobly_agent/app/cli/decorators/exec.py +1 -1
  6. stoobly_agent/app/cli/helpers/handle_config_update_service.py +4 -0
  7. stoobly_agent/app/cli/intercept_cli.py +40 -7
  8. stoobly_agent/app/cli/scaffold/app_command.py +4 -0
  9. stoobly_agent/app/cli/scaffold/app_config.py +21 -3
  10. stoobly_agent/app/cli/scaffold/app_create_command.py +109 -2
  11. stoobly_agent/app/cli/scaffold/constants.py +14 -3
  12. stoobly_agent/app/cli/scaffold/docker/constants.py +4 -6
  13. stoobly_agent/app/cli/scaffold/docker/service/build_decorator.py +2 -2
  14. stoobly_agent/app/cli/scaffold/docker/service/builder.py +36 -10
  15. stoobly_agent/app/cli/scaffold/docker/workflow/builder.py +0 -27
  16. stoobly_agent/app/cli/scaffold/docker/workflow/command_decorator.py +25 -0
  17. stoobly_agent/app/cli/scaffold/docker/workflow/decorators_factory.py +7 -2
  18. stoobly_agent/app/cli/scaffold/docker/workflow/detached_decorator.py +42 -0
  19. stoobly_agent/app/cli/scaffold/docker/workflow/local_decorator.py +26 -0
  20. stoobly_agent/app/cli/scaffold/docker/workflow/mock_decorator.py +9 -10
  21. stoobly_agent/app/cli/scaffold/docker/workflow/reverse_proxy_decorator.py +5 -8
  22. stoobly_agent/app/cli/scaffold/service_config.py +133 -34
  23. stoobly_agent/app/cli/scaffold/service_create_command.py +11 -2
  24. stoobly_agent/app/cli/scaffold/service_dependency.py +51 -0
  25. stoobly_agent/app/cli/scaffold/service_docker_compose.py +3 -3
  26. stoobly_agent/app/cli/scaffold/service_workflow_validate_command.py +10 -7
  27. stoobly_agent/app/cli/scaffold/templates/app/.Dockerfile.context +1 -1
  28. stoobly_agent/app/cli/scaffold/templates/app/build/.docker-compose.base.yml +2 -2
  29. stoobly_agent/app/cli/scaffold/templates/app/build/mock/bin/configure +1 -1
  30. stoobly_agent/app/cli/scaffold/templates/app/build/mock/docker-compose.yml +16 -6
  31. stoobly_agent/app/cli/scaffold/templates/app/build/record/bin/configure +26 -1
  32. stoobly_agent/app/cli/scaffold/templates/app/build/record/docker-compose.yml +16 -6
  33. stoobly_agent/app/cli/scaffold/templates/app/build/test/bin/configure +1 -1
  34. stoobly_agent/app/cli/scaffold/templates/app/build/test/docker-compose.yml +16 -6
  35. stoobly_agent/app/cli/scaffold/templates/app/entrypoint/.docker-compose.base.yml +2 -2
  36. stoobly_agent/app/cli/scaffold/templates/app/entrypoint/mock/bin/configure +1 -1
  37. stoobly_agent/app/cli/scaffold/templates/app/entrypoint/mock/docker-compose.yml +16 -10
  38. stoobly_agent/app/cli/scaffold/templates/app/entrypoint/record/bin/configure +1 -1
  39. stoobly_agent/app/cli/scaffold/templates/app/entrypoint/record/docker-compose.yml +16 -10
  40. stoobly_agent/app/cli/scaffold/templates/app/entrypoint/test/bin/configure +1 -1
  41. stoobly_agent/app/cli/scaffold/templates/app/entrypoint/test/docker-compose.yml +16 -10
  42. stoobly_agent/app/cli/scaffold/templates/app/stoobly-ui/.docker-compose.base.yml +2 -1
  43. stoobly_agent/app/cli/scaffold/templates/app/stoobly-ui/mock/.docker-compose.mock.yml +6 -3
  44. stoobly_agent/app/cli/scaffold/templates/app/stoobly-ui/record/.docker-compose.record.yml +6 -4
  45. stoobly_agent/app/cli/scaffold/templates/build/workflows/record/.configure +21 -1
  46. stoobly_agent/app/cli/scaffold/templates/constants.py +4 -0
  47. stoobly_agent/app/cli/scaffold/templates/plugins/cypress/test/.Dockerfile.cypress +22 -0
  48. stoobly_agent/app/cli/scaffold/templates/plugins/cypress/test/.docker-compose.test.yml +19 -0
  49. stoobly_agent/app/cli/scaffold/templates/plugins/playwright/test/.Dockerfile.playwright +33 -0
  50. stoobly_agent/app/cli/scaffold/templates/plugins/playwright/test/.docker-compose.test.yml +18 -0
  51. stoobly_agent/app/cli/scaffold/templates/plugins/playwright/test/.entrypoint.sh +11 -0
  52. stoobly_agent/app/cli/scaffold/templates/workflow/mock/bin/configure +2 -10
  53. stoobly_agent/app/cli/scaffold/templates/workflow/mock/docker-compose.yml +17 -0
  54. stoobly_agent/app/cli/scaffold/templates/workflow/record/bin/configure +19 -45
  55. stoobly_agent/app/cli/scaffold/templates/workflow/record/docker-compose.yml +17 -0
  56. stoobly_agent/app/cli/scaffold/templates/workflow/test/bin/configure +2 -10
  57. stoobly_agent/app/cli/scaffold/templates/workflow/test/docker-compose.yml +17 -0
  58. stoobly_agent/app/cli/scaffold/workflow_create_command.py +0 -1
  59. stoobly_agent/app/cli/scaffold/workflow_run_command.py +1 -1
  60. stoobly_agent/app/cli/scaffold_cli.py +85 -96
  61. stoobly_agent/app/proxy/handle_record_service.py +12 -3
  62. stoobly_agent/app/proxy/handle_replay_service.py +14 -2
  63. stoobly_agent/app/proxy/intercept_settings.py +12 -8
  64. stoobly_agent/app/proxy/record/upload_request_service.py +5 -8
  65. stoobly_agent/app/proxy/replay/replay_request_service.py +3 -0
  66. stoobly_agent/app/proxy/run.py +3 -28
  67. stoobly_agent/app/proxy/utils/allowed_request_service.py +3 -2
  68. stoobly_agent/app/proxy/utils/minimize_headers.py +47 -0
  69. stoobly_agent/app/proxy/utils/publish_change_service.py +22 -24
  70. stoobly_agent/app/proxy/utils/strategy.py +16 -0
  71. stoobly_agent/app/settings/__init__.py +15 -6
  72. stoobly_agent/app/settings/data_rules.py +25 -1
  73. stoobly_agent/app/settings/intercept_settings.py +5 -2
  74. stoobly_agent/app/settings/types/__init__.py +0 -1
  75. stoobly_agent/app/settings/ui_settings.py +5 -5
  76. stoobly_agent/cli.py +41 -16
  77. stoobly_agent/config/constants/custom_headers.py +1 -0
  78. stoobly_agent/config/constants/env_vars.py +4 -3
  79. stoobly_agent/config/constants/record_strategy.py +6 -0
  80. stoobly_agent/config/data_dir.py +1 -0
  81. stoobly_agent/config/settings.yml.sample +2 -3
  82. stoobly_agent/lib/logger.py +15 -5
  83. stoobly_agent/public/index.html +1 -1
  84. stoobly_agent/public/main-es2015.5a9aa16433404c3f423a.js +1 -0
  85. stoobly_agent/public/main-es5.5a9aa16433404c3f423a.js +1 -0
  86. stoobly_agent/test/app/cli/intercept/intercept_configure_test.py +231 -1
  87. stoobly_agent/test/app/cli/scaffold/cli_invoker.py +3 -2
  88. stoobly_agent/test/app/cli/scaffold/cli_test.py +3 -3
  89. stoobly_agent/test/app/cli/scaffold/e2e_test.py +11 -11
  90. stoobly_agent/test/app/models/schemas/.stoobly/db/VERSION +1 -1
  91. stoobly_agent/test/app/proxy/utils/minimize_headers_test.py +342 -0
  92. {stoobly_agent-1.9.12.dist-info → stoobly_agent-1.10.1.dist-info}/METADATA +2 -1
  93. {stoobly_agent-1.9.12.dist-info → stoobly_agent-1.10.1.dist-info}/RECORD +96 -80
  94. stoobly_agent/public/main-es2015.089b46f303768fbe864f.js +0 -1
  95. stoobly_agent/public/main-es5.089b46f303768fbe864f.js +0 -1
  96. {stoobly_agent-1.9.12.dist-info → stoobly_agent-1.10.1.dist-info}/LICENSE +0 -0
  97. {stoobly_agent-1.9.12.dist-info → stoobly_agent-1.10.1.dist-info}/WHEEL +0 -0
  98. {stoobly_agent-1.9.12.dist-info → stoobly_agent-1.10.1.dist-info}/entry_points.txt +0 -0
@@ -1,7 +1,17 @@
1
- # Define services here
1
+ # Define custom services here
2
2
  #
3
- # Container services that are intended to be run as part of a workflow need to have the workflow name added to the 'profiles' property
4
- # e.g. If we want to run a service as part of the 'mock' workflow, then the following should be added
5
- # profiles:
6
- # - mock
7
- services: {}
3
+ # 1. Uncomment the following
4
+ # 2. Replace <SERVICE-NAME> with the name of the service, this can be found in ../config.yml
5
+ # 3. Extend as needed
6
+ #
7
+ # To learn more, see https://docs.stoobly.com/core-concepts/scaffold
8
+
9
+ #services:
10
+ # <SERVICE-NAME>.<CUSTOM-SERVICE-NAME>:
11
+ # depends_on:
12
+ # <SERVICE-NAME>.configure:
13
+ # condition: service_completed_successfully
14
+ # networks:
15
+ # app.ingress: {}
16
+ # profiles:
17
+ # - ${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 '' \
@@ -1,7 +1,17 @@
1
- # Define services here
1
+ # Define custom services here
2
2
  #
3
- # Container services that are intended to be run as part of a workflow need to have the workflow name added to the 'profiles' property
4
- # e.g. If we want to run a service as part of the 'record' workflow, then the following should be added
5
- # profiles:
6
- # - record
7
- services: {}
3
+ # 1. Uncomment the following
4
+ # 2. Replace <SERVICE-NAME> with the name of the service, this can be found in ../config.yml
5
+ # 3. Extend as needed
6
+ #
7
+ # To learn more, see https://docs.stoobly.com/core-concepts/scaffold
8
+
9
+ #services:
10
+ # <SERVICE-NAME>.<CUSTOM-SERVICE-NAME>:
11
+ # depends_on:
12
+ # <SERVICE-NAME>.configure:
13
+ # condition: service_completed_successfully
14
+ # networks:
15
+ # app.egress: {}
16
+ # profiles:
17
+ # - ${WORKFLOW_NAME}
@@ -1,3 +1,3 @@
1
1
  #!/bin/bash
2
2
 
3
- # Add custom configuration here
3
+ # Add custom Stoobly configuration here, to learn more: https://docs.stoobly.com/core-concepts/agent/proxy-settings
@@ -1,7 +1,17 @@
1
- # Define services here
1
+ # Define custom services here
2
2
  #
3
- # Container services that are intended to be run as part of a workflow need to have the workflow name added to the 'profiles' property
4
- # e.g. If we want to run a service as part of the 'test' workflow, then the following should be added
5
- # profiles:
6
- # - test
7
- services: {}
3
+ # 1. Uncomment the following
4
+ # 2. Replace <SERVICE-NAME> with the name of the service, this can be found in ../config.yml
5
+ # 3. Extend as needed
6
+ #
7
+ # To learn more, see https://docs.stoobly.com/core-concepts/scaffold
8
+
9
+ #services:
10
+ # <SERVICE-NAME>.<CUSTOM-SERVICE-NAME>:
11
+ # depends_on:
12
+ # <SERVICE-NAME>.configure:
13
+ # condition: service_completed_successfully
14
+ # networks:
15
+ # app.ingress: {}
16
+ # profiles:
17
+ # - ${WORKFLOW_NAME}
@@ -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/docker/${SERVICE_NAME}/${WORKFLOW_NAME}
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/docker/${SERVICE_NAME}/${WORKFLOW_NAME}
19
+ working_dir: /home/stoobly/.stoobly/services/${SERVICE_NAME}/${WORKFLOW_NAME}
@@ -1,3 +1,3 @@
1
1
  #!/bin/bash
2
2
 
3
- # Add custom configuration here
3
+ # Add custom Stoobly configuration here, to learn more: https://docs.stoobly.com/core-concepts/agent/proxy-settings
@@ -1,11 +1,17 @@
1
- # Define services here
1
+ # Define custom services here
2
2
  #
3
- # If a container service needs access to a Stoobly defined service,
4
- # then the container service needs to add one of the scaffolded networks to the 'networks' property
5
- # See https://docs.stoobly.com/core-concepts/scaffold
6
- #
7
- # Container services that are intended to be run as part of a workflow need to have the workflow name added to the 'profiles' property
8
- # e.g. If we want to run a service as part of the 'mock' workflow, then the following should be added
9
- # profiles:
10
- # - mock
11
- services: {}
3
+ # 1. Uncomment the following
4
+ # 2. Replace <SERVICE-NAME> with the name of the service, this can be found in ../config.yml
5
+ # 3. Extend as needed
6
+ #
7
+ # To learn more, see https://docs.stoobly.com/core-concepts/scaffold
8
+
9
+ #services:
10
+ # <SERVICE-NAME>.<CUSTOM-SERVICE-NAME>:
11
+ # depends_on:
12
+ # <SERVICE-NAME>.configure:
13
+ # condition: service_completed_successfully
14
+ # networks:
15
+ # app.ingress: {}
16
+ # profiles:
17
+ # - ${WORKFLOW_NAME}
@@ -1,3 +1,3 @@
1
1
  #!/bin/bash
2
2
 
3
- # Add custom configuration here
3
+ # Add custom Stoobly configuration here, to learn more: https://docs.stoobly.com/core-concepts/agent/proxy-settings
@@ -1,11 +1,17 @@
1
- # Define services here
1
+ # Define custom services here
2
2
  #
3
- # If a container service needs access to a Stoobly defined service,
4
- # then the container service needs to add one of the scaffolded networks to the 'networks' property
5
- # See https://docs.stoobly.com/core-concepts/scaffold
6
- #
7
- # Container services that are intended to be run as part of a workflow need to have the workflow name added to the 'profiles' property
8
- # e.g. If we want to run a service as part of the 'record' workflow, then the following should be added
9
- # profiles:
10
- # - record
11
- services: {}
3
+ # 1. Uncomment the following
4
+ # 2. Replace <SERVICE-NAME> with the name of the service, this can be found in ../config.yml
5
+ # 3. Extend as needed
6
+ #
7
+ # To learn more, see https://docs.stoobly.com/core-concepts/scaffold
8
+
9
+ #services:
10
+ # <SERVICE-NAME>.<CUSTOM-SERVICE-NAME>:
11
+ # depends_on:
12
+ # <SERVICE-NAME>.configure:
13
+ # condition: service_completed_successfully
14
+ # networks:
15
+ # app.egress: {}
16
+ # profiles:
17
+ # - ${WORKFLOW_NAME}
@@ -1,3 +1,3 @@
1
1
  #!/bin/bash
2
2
 
3
- # Add custom configuration here
3
+ # Add custom Stoobly configuration here, to learn more: https://docs.stoobly.com/core-concepts/agent/proxy-settings
@@ -1,11 +1,17 @@
1
- # Define services here
1
+ # Define custom services here
2
2
  #
3
- # If a container service needs access to a Stoobly defined service,
4
- # then the container service needs to add one of the scaffolded networks to the 'networks' property
5
- # See https://docs.stoobly.com/core-concepts/scaffold
6
- #
7
- # Container services that are intended to be run as part of a workflow need to have the workflow name added to the 'profiles' property
8
- # e.g. If we want to run a service as part of the 'test' workflow, then the following should be added
9
- # profiles:
10
- # - test
11
- services: {}
3
+ # 1. Uncomment the following
4
+ # 2. Replace <SERVICE-NAME> with the name of the service, this can be found in ../config.yml
5
+ # 3. Extend as needed
6
+ #
7
+ # To learn more, see https://docs.stoobly.com/core-concepts/scaffold
8
+
9
+ #services:
10
+ # <SERVICE-NAME>.<CUSTOM-SERVICE-NAME>:
11
+ # depends_on:
12
+ # <SERVICE-NAME>.configure:
13
+ # condition: service_completed_successfully
14
+ # networks:
15
+ # app.ingress: {}
16
+ # profiles:
17
+ # - ${WORKFLOW_NAME}
@@ -2,4 +2,5 @@ services:
2
2
  stoobly_ui.base:
3
3
  extends:
4
4
  file: ../.docker-compose.base.yml
5
- service: context_base
5
+ service: context_base
6
+ image: stoobly.${USER_ID}
@@ -1,11 +1,14 @@
1
1
  services:
2
2
  stoobly_ui.service:
3
- command: --ui-port 4200
3
+ command: --proxyless --ui-host local.stoobly.com --ui-port 4200
4
4
  extends:
5
5
  file: ../.docker-compose.base.yml
6
6
  service: stoobly_ui.base
7
- image: stoobly.${USER_ID}
7
+ networks:
8
+ app.egress:
9
+ aliases:
10
+ - local.stoobly.com
8
11
  ports:
9
12
  - '${APP_UI_PORT}:4200'
10
13
  profiles:
11
- - mock
14
+ - ${WORKFLOW_NAME}
@@ -1,12 +1,14 @@
1
1
  services:
2
2
  stoobly_ui.service:
3
- command: --ui-port 4200
3
+ command: --proxyless --ui-host local.stoobly.com --ui-port 4200
4
4
  extends:
5
5
  file: ../.docker-compose.base.yml
6
6
  service: stoobly_ui.base
7
- image: stoobly.${USER_ID}
7
+ networks:
8
+ app.egress:
9
+ aliases:
10
+ - local.stoobly.com
8
11
  ports:
9
12
  - '${APP_UI_PORT}:4200'
10
13
  profiles:
11
- - record
12
-
14
+ - ${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
@@ -13,6 +13,7 @@ CORE_RECORD_WORKFLOW = 'record'
13
13
 
14
14
  CUSTOM_BUILD = os.path.join('bin', 'build')
15
15
  CUSTOM_CONFIGURE = os.path.join('bin', 'configure')
16
+ CUSTOM_DOCKER_COMPOSE = 'docker-compose.yml'
16
17
  CUSTOM_INIT = os.path.join('bin', 'init')
17
18
  CUSTOM_FIXTURES = 'fixtures.yml'
18
19
  CUSTOM_LIFECYCLE_HOOKS = os.path.join('lifecycle_hooks.py')
@@ -28,6 +29,7 @@ MOCK_WORKFLOW_MAINTAINED_FILES = [
28
29
  MOCK_WORKFLOW_CUSTOM_FILES = [
29
30
  CUSTOM_BUILD,
30
31
  CUSTOM_CONFIGURE,
32
+ CUSTOM_DOCKER_COMPOSE,
31
33
  CUSTOM_FIXTURES,
32
34
  CUSTOM_INIT,
33
35
  CUSTOM_LIFECYCLE_HOOKS,
@@ -42,6 +44,7 @@ RECORD_WORKFLOW_MAINTAINED_FILES = [
42
44
  RECORD_WORKFLOW_CUSTOM_FILES = [
43
45
  CUSTOM_BUILD,
44
46
  CUSTOM_CONFIGURE,
47
+ CUSTOM_DOCKER_COMPOSE,
45
48
  CUSTOM_INIT,
46
49
  CUSTOM_LIFECYCLE_HOOKS,
47
50
  ]
@@ -54,6 +57,7 @@ TEST_WORKFLOW_MAINTAINED_FILES = [
54
57
  TEST_WORKFLOW_CUSTOM_FILES = [
55
58
  CUSTOM_BUILD,
56
59
  CUSTOM_CONFIGURE,
60
+ CUSTOM_DOCKER_COMPOSE,
57
61
  CUSTOM_FIXTURES,
58
62
  CUSTOM_INIT,
59
63
  CUSTOM_LIFECYCLE_HOOKS,
@@ -0,0 +1,22 @@
1
+ ARG CYPRESS_IMAGE
2
+ FROM ${CYPRESS_IMAGE}
3
+
4
+ # Change user id of stoobly user to that of host's user id
5
+ ARG USER_ID
6
+ ARG USER_NAME=stoobly
7
+ RUN set -eux; \
8
+ # Check if a user with this UID exists
9
+ if getent passwd "${USER_ID}" > /dev/null; then \
10
+ EXISTING_USER="$(getent passwd "${USER_ID}" | cut -d: -f1)"; \
11
+ if [ "$EXISTING_USER" != "${USER_NAME}" ]; then \
12
+ usermod -l "${USER_NAME}" "$EXISTING_USER"; \
13
+ usermod -d "/home/${USER_NAME}" -m "${USER_NAME}"; \
14
+ fi; \
15
+ else \
16
+ useradd -u "${USER_ID}" -m "${USER_NAME}"; \
17
+ fi
18
+
19
+ USER stoobly
20
+ WORKDIR /home/stoobly
21
+
22
+ RUN npx cypress install # Install Cypress binary into image
@@ -0,0 +1,19 @@
1
+ services:
2
+ entrypoint.cypress:
3
+ build:
4
+ args:
5
+ CYPRESS_IMAGE: ${CYPRESS_IMAGE:-cypress/browsers:22.11.0}
6
+ USER_ID: ${USER_ID}
7
+ context: ./
8
+ dockerfile: ./.Dockerfile.cypress
9
+ command: npx cypress run --project .
10
+ depends_on:
11
+ entrypoint.configure:
12
+ condition: service_completed_successfully
13
+ networks:
14
+ - "app.ingress"
15
+ profiles:
16
+ - ${WORKFLOW_NAME}
17
+ user: stoobly
18
+ volumes:
19
+ - ${CONTEXT_DIR}:/home/stoobly
@@ -0,0 +1,33 @@
1
+ ARG PLAYWRIGHT_IMAGE
2
+ FROM ${PLAYWRIGHT_IMAGE}
3
+
4
+ RUN set -eux; \
5
+ apt-get update; \
6
+ apt-get install -y --no-install-recommends ca-certificates wget; \
7
+ dpkgArch="$(dpkg --print-architecture | awk -F- '{ print $NF }')"; \
8
+ wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/1.16/gosu-$dpkgArch"; \
9
+ chmod +x /usr/local/bin/gosu; \
10
+ gosu --version;
11
+ RUN apt-get update && apt-get install -y ca-certificates && rm -rf /var/lib/apt/lists/*
12
+ RUN npx playwright install --with-deps
13
+
14
+ # Change user id of stoobly user to that of host's user id
15
+ ARG USER_ID
16
+ ARG USER_NAME=stoobly
17
+ RUN set -eux; \
18
+ # Check if a user with this UID exists
19
+ if getent passwd "${USER_ID}" > /dev/null; then \
20
+ EXISTING_USER="$(getent passwd "${USER_ID}" | cut -d: -f1)"; \
21
+ if [ "$EXISTING_USER" != "${USER_NAME}" ]; then \
22
+ usermod -l "${USER_NAME}" "$EXISTING_USER"; \
23
+ usermod -d "/home/${USER_NAME}" -m "${USER_NAME}"; \
24
+ fi; \
25
+ else \
26
+ useradd -u "${USER_ID}" -m "${USER_NAME}"; \
27
+ fi
28
+
29
+ WORKDIR /home/stoobly
30
+
31
+ COPY .entrypoint.sh /usr/local/bin/entrypoint.sh
32
+ RUN chmod +x /usr/local/bin/entrypoint.sh
33
+ ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
@@ -0,0 +1,18 @@
1
+ services:
2
+ entrypoint.playwright:
3
+ build:
4
+ args:
5
+ PLAYWRIGHT_IMAGE: ${PLAYWRIGHT_IMAGE:-mcr.microsoft.com/playwright:v1.46.1-jammy}
6
+ USER_ID: ${USER_ID}
7
+ context: ./
8
+ dockerfile: ./.Dockerfile.playwright
9
+ command: npx playwright test --reporter dot
10
+ depends_on:
11
+ entrypoint.configure:
12
+ condition: service_completed_successfully
13
+ networks:
14
+ - "app.ingress"
15
+ profiles:
16
+ - ${WORKFLOW_NAME}
17
+ volumes:
18
+ - ${CONTEXT_DIR}:/home/stoobly
@@ -0,0 +1,11 @@
1
+ #!/bin/sh
2
+ set -e
3
+
4
+ # Copy certs and update trust store
5
+ if [ -d "/home/stoobly/.stoobly/certs" ]; then
6
+ cp /home/stoobly/.stoobly/certs/*.crt /usr/local/share/ca-certificates/ || true
7
+ update-ca-certificates
8
+ fi
9
+
10
+ # Execute the CMD from Dockerfile or passed command
11
+ exec gosu stoobly "$@"
@@ -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
- scheme=$SERVICE_SCHEME
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
@@ -0,0 +1,17 @@
1
+ # Define custom services here
2
+ #
3
+ # 1. Uncomment the following
4
+ # 2. Replace <SERVICE-NAME> with the name of the service, this can be found in ../config.yml
5
+ # 3. Extend as needed
6
+ #
7
+ # To learn more, see https://docs.stoobly.com/core-concepts/scaffold
8
+
9
+ #services:
10
+ # <SERVICE-NAME>.<CUSTOM-SERVICE-NAME>:
11
+ # depends_on:
12
+ # <SERVICE-NAME>.configure:
13
+ # condition: service_completed_successfully
14
+ # networks:
15
+ # app.ingress: {}
16
+ # profiles:
17
+ # - ${WORKFLOW_NAME}
@@ -1,47 +1,21 @@
1
1
  #!/bin/bash
2
2
 
3
- # Add custom Stoobly configuration here
4
-
5
- scheme=$SERVICE_SCHEME
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
14
-
15
- # Firewall
16
- echo "Configuring firewall rules..."
17
- stoobly-agent config firewall set \
18
- --action include \
19
- --method GET --method POST --method OPTIONS --method PUT --method DELETE \
20
- --mode record \
21
- --pattern "$origin/?.*?"
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 '' \
@@ -0,0 +1,17 @@
1
+ # Define custom services here
2
+ #
3
+ # 1. Uncomment the following
4
+ # 2. Replace <SERVICE-NAME> with the name of the service, this can be found in ../config.yml
5
+ # 3. Extend as needed
6
+ #
7
+ # To learn more, see https://docs.stoobly.com/core-concepts/scaffold
8
+
9
+ #services:
10
+ # <SERVICE-NAME>.<CUSTOM-SERVICE-NAME>:
11
+ # depends_on:
12
+ # <SERVICE-NAME>.configure:
13
+ # condition: service_completed_successfully
14
+ # networks:
15
+ # app.egress: {}
16
+ # profiles:
17
+ # - ${WORKFLOW_NAME}
@@ -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
- scheme=$SERVICE_SCHEME
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
@@ -0,0 +1,17 @@
1
+ # Define custom services here
2
+ #
3
+ # 1. Uncomment the following
4
+ # 2. Replace <SERVICE-NAME> with the name of the service, this can be found in ../config.yml
5
+ # 3. Extend as needed
6
+ #
7
+ # To learn more, see https://docs.stoobly.com/core-concepts/scaffold
8
+
9
+ #services:
10
+ # <SERVICE-NAME>.<CUSTOM-SERVICE-NAME>:
11
+ # depends_on:
12
+ # <SERVICE-NAME>.configure:
13
+ # condition: service_completed_successfully
14
+ # networks:
15
+ # app.ingress: {}
16
+ # profiles:
17
+ # - ${WORKFLOW_NAME}
@@ -92,6 +92,5 @@ class WorkflowCreateCommand(WorkflowCommand):
92
92
  workflow_decorator(workflow_builder).decorate()
93
93
 
94
94
  workflow_builder.write()
95
- workflow_builder.initialize_custom_file()
96
95
 
97
96
  return workflow_builder
@@ -10,7 +10,7 @@ from stoobly_agent.lib.logger import Logger
10
10
 
11
11
  from .app import App
12
12
  from .constants import (
13
- APP_DIR_ENV, APP_NETWORK_ENV, CA_CERTS_DIR_ENV, CERTS_DIR_ENV, CONTEXT_DIR_ENV,
13
+ APP_DIR_ENV, APP_NETWORK_ENV, APP_PLUGINS_ENV, CA_CERTS_DIR_ENV, CERTS_DIR_ENV, CONTEXT_DIR_ENV,
14
14
  SERVICE_DNS_ENV, SERVICE_NAME_ENV, SERVICE_SCRIPTS_DIR, SERVICE_SCRIPTS_ENV, USER_ID_ENV,
15
15
  WORKFLOW_NAME_ENV, WORKFLOW_NAMESPACE_ENV, WORKFLOW_SCRIPTS_DIR, WORKFLOW_SCRIPTS_ENV, WORKFLOW_TEMPLATE_ENV
16
16
  )