wexample-wex-addon-services-platform 0.0.3__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 (135) hide show
  1. wexample_wex_addon_services_platform/__init__.py +7 -0
  2. wexample_wex_addon_services_platform/py.typed +0 -0
  3. wexample_wex_addon_services_platform/services/__init__.py +0 -0
  4. wexample_wex_addon_services_platform/services/gitlab/__init__.py +0 -0
  5. wexample_wex_addon_services_platform/services/gitlab/app_service.py +29 -0
  6. wexample_wex_addon_services_platform/services/gitlab/commands/__init__.py +0 -0
  7. wexample_wex_addon_services_platform/services/gitlab/commands/service/__init__.py +0 -0
  8. wexample_wex_addon_services_platform/services/gitlab/commands/service/install.py +31 -0
  9. wexample_wex_addon_services_platform/services/gitlab/commands/service/ready.py +32 -0
  10. wexample_wex_addon_services_platform/services/gitlab/docker/__init__.py +0 -0
  11. wexample_wex_addon_services_platform/services/gitlab/docker/docker-compose.yml +20 -0
  12. wexample_wex_addon_services_platform/services/gitlab/samples/__init__.py +0 -0
  13. wexample_wex_addon_services_platform/services/gitlab/samples/docker/__init__.py +0 -0
  14. wexample_wex_addon_services_platform/services/gitlab/samples/docker/docker-compose.yml +5 -0
  15. wexample_wex_addon_services_platform/services/gitlab/samples/env/__init__.py +0 -0
  16. wexample_wex_addon_services_platform/services/gitlab/samples/env/prod/__init__.py +0 -0
  17. wexample_wex_addon_services_platform/services/gitlab/samples/env/prod/docker/__init__.py +0 -0
  18. wexample_wex_addon_services_platform/services/gitlab/samples/env/prod/docker/docker-compose.yml +6 -0
  19. wexample_wex_addon_services_platform/services/gitlab/samples/gitlab/__init__.py +0 -0
  20. wexample_wex_addon_services_platform/services/gitlab/samples/gitlab/backups/.gitkeep +1 -0
  21. wexample_wex_addon_services_platform/services/gitlab/samples/gitlab/backups/__init__.py +0 -0
  22. wexample_wex_addon_services_platform/services/gitlab/samples/gitlab/config/.gitkeep +1 -0
  23. wexample_wex_addon_services_platform/services/gitlab/samples/gitlab/config/__init__.py +0 -0
  24. wexample_wex_addon_services_platform/services/gitlab/samples/gitlab/data/.gitkeep +1 -0
  25. wexample_wex_addon_services_platform/services/gitlab/samples/gitlab/data/__init__.py +0 -0
  26. wexample_wex_addon_services_platform/services/gitlab/samples/gitlab/logs/.gitkeep +1 -0
  27. wexample_wex_addon_services_platform/services/gitlab/samples/gitlab/logs/__init__.py +0 -0
  28. wexample_wex_addon_services_platform/services/gitlab/service.yml +8 -0
  29. wexample_wex_addon_services_platform/services/jenkins/__init__.py +0 -0
  30. wexample_wex_addon_services_platform/services/jenkins/docker/__init__.py +0 -0
  31. wexample_wex_addon_services_platform/services/jenkins/docker/docker-compose.yml +15 -0
  32. wexample_wex_addon_services_platform/services/jenkins/samples/__init__.py +0 -0
  33. wexample_wex_addon_services_platform/services/jenkins/samples/docker/__init__.py +0 -0
  34. wexample_wex_addon_services_platform/services/jenkins/samples/docker/docker-compose.yml +5 -0
  35. wexample_wex_addon_services_platform/services/jenkins/samples/env/__init__.py +0 -0
  36. wexample_wex_addon_services_platform/services/jenkins/samples/env/prod/__init__.py +0 -0
  37. wexample_wex_addon_services_platform/services/jenkins/samples/env/prod/docker/__init__.py +0 -0
  38. wexample_wex_addon_services_platform/services/jenkins/samples/env/prod/docker/docker-compose.yml +5 -0
  39. wexample_wex_addon_services_platform/services/jenkins/samples/jenkins/__init__.py +0 -0
  40. wexample_wex_addon_services_platform/services/jenkins/samples/jenkins/config/.gitkeep +1 -0
  41. wexample_wex_addon_services_platform/services/jenkins/samples/jenkins/config/__init__.py +0 -0
  42. wexample_wex_addon_services_platform/services/jenkins/samples/jenkins/home/.gitkeep +1 -0
  43. wexample_wex_addon_services_platform/services/jenkins/samples/jenkins/home/__init__.py +0 -0
  44. wexample_wex_addon_services_platform/services/jenkins/service.yml +8 -0
  45. wexample_wex_addon_services_platform/services/listmonk/__init__.py +0 -0
  46. wexample_wex_addon_services_platform/services/listmonk/docker/__init__.py +0 -0
  47. wexample_wex_addon_services_platform/services/listmonk/docker/docker-compose.yml +21 -0
  48. wexample_wex_addon_services_platform/services/listmonk/samples/__init__.py +0 -0
  49. wexample_wex_addon_services_platform/services/listmonk/samples/config.toml +2 -0
  50. wexample_wex_addon_services_platform/services/listmonk/samples/docker/__init__.py +0 -0
  51. wexample_wex_addon_services_platform/services/listmonk/samples/docker/docker-compose.yml +5 -0
  52. wexample_wex_addon_services_platform/services/listmonk/samples/env/__init__.py +0 -0
  53. wexample_wex_addon_services_platform/services/listmonk/samples/env/dev/__init__.py +0 -0
  54. wexample_wex_addon_services_platform/services/listmonk/samples/env/dev/docker/__init__.py +0 -0
  55. wexample_wex_addon_services_platform/services/listmonk/samples/env/dev/docker/docker-compose.yml +5 -0
  56. wexample_wex_addon_services_platform/services/listmonk/samples/env/prod/__init__.py +0 -0
  57. wexample_wex_addon_services_platform/services/listmonk/samples/env/prod/docker/__init__.py +0 -0
  58. wexample_wex_addon_services_platform/services/listmonk/samples/env/prod/docker/docker-compose.yml +5 -0
  59. wexample_wex_addon_services_platform/services/listmonk/service.yml +9 -0
  60. wexample_wex_addon_services_platform/services/n8n/__init__.py +0 -0
  61. wexample_wex_addon_services_platform/services/n8n/app_service.py +24 -0
  62. wexample_wex_addon_services_platform/services/n8n/commands/__init__.py +1 -0
  63. wexample_wex_addon_services_platform/services/n8n/commands/service/__init__.py +1 -0
  64. wexample_wex_addon_services_platform/services/n8n/commands/service/install.py +35 -0
  65. wexample_wex_addon_services_platform/services/n8n/commands/service/ready.py +39 -0
  66. wexample_wex_addon_services_platform/services/n8n/docker/__init__.py +0 -0
  67. wexample_wex_addon_services_platform/services/n8n/docker/docker-compose.yml +21 -0
  68. wexample_wex_addon_services_platform/services/n8n/samples/__init__.py +0 -0
  69. wexample_wex_addon_services_platform/services/n8n/samples/docker/__init__.py +0 -0
  70. wexample_wex_addon_services_platform/services/n8n/samples/docker/docker-compose.yml +5 -0
  71. wexample_wex_addon_services_platform/services/n8n/samples/env/__init__.py +0 -0
  72. wexample_wex_addon_services_platform/services/n8n/samples/env/dev/__init__.py +0 -0
  73. wexample_wex_addon_services_platform/services/n8n/samples/env/dev/docker/__init__.py +0 -0
  74. wexample_wex_addon_services_platform/services/n8n/samples/env/dev/docker/docker-compose.yml +5 -0
  75. wexample_wex_addon_services_platform/services/n8n/samples/env/prod/__init__.py +0 -0
  76. wexample_wex_addon_services_platform/services/n8n/samples/env/prod/docker/__init__.py +0 -0
  77. wexample_wex_addon_services_platform/services/n8n/samples/env/prod/docker/docker-compose.yml +8 -0
  78. wexample_wex_addon_services_platform/services/n8n/samples/n8n/.gitkeep +1 -0
  79. wexample_wex_addon_services_platform/services/n8n/samples/n8n/__init__.py +0 -0
  80. wexample_wex_addon_services_platform/services/n8n/service.yml +8 -0
  81. wexample_wex_addon_services_platform/services/nextcloud/__init__.py +0 -0
  82. wexample_wex_addon_services_platform/services/nextcloud/app_service.py +29 -0
  83. wexample_wex_addon_services_platform/services/nextcloud/commands/__init__.py +0 -0
  84. wexample_wex_addon_services_platform/services/nextcloud/commands/service/__init__.py +0 -0
  85. wexample_wex_addon_services_platform/services/nextcloud/commands/service/ready.py +39 -0
  86. wexample_wex_addon_services_platform/services/nextcloud/docker/__init__.py +0 -0
  87. wexample_wex_addon_services_platform/services/nextcloud/docker/docker-compose.yml +12 -0
  88. wexample_wex_addon_services_platform/services/nextcloud/service.yml +8 -0
  89. wexample_wex_addon_services_platform/services/ollama/__init__.py +0 -0
  90. wexample_wex_addon_services_platform/services/ollama/app_service.py +19 -0
  91. wexample_wex_addon_services_platform/services/ollama/commands/__init__.py +0 -0
  92. wexample_wex_addon_services_platform/services/ollama/commands/service/__init__.py +0 -0
  93. wexample_wex_addon_services_platform/services/ollama/commands/service/install.py +30 -0
  94. wexample_wex_addon_services_platform/services/ollama/commands/service/ready.py +39 -0
  95. wexample_wex_addon_services_platform/services/ollama/docker/__init__.py +0 -0
  96. wexample_wex_addon_services_platform/services/ollama/docker/docker-compose.yml +7 -0
  97. wexample_wex_addon_services_platform/services/ollama/service.yml +6 -0
  98. wexample_wex_addon_services_platform/services/rabbitmq/__init__.py +0 -0
  99. wexample_wex_addon_services_platform/services/rabbitmq/docker/__init__.py +0 -0
  100. wexample_wex_addon_services_platform/services/rabbitmq/docker/docker-compose.yml +21 -0
  101. wexample_wex_addon_services_platform/services/rabbitmq/service.yml +8 -0
  102. wexample_wex_addon_services_platform/services/sonarqube/__init__.py +0 -0
  103. wexample_wex_addon_services_platform/services/sonarqube/docker/__init__.py +0 -0
  104. wexample_wex_addon_services_platform/services/sonarqube/docker/docker-compose.yml +21 -0
  105. wexample_wex_addon_services_platform/services/sonarqube/samples/__init__.py +0 -0
  106. wexample_wex_addon_services_platform/services/sonarqube/samples/docker/__init__.py +0 -0
  107. wexample_wex_addon_services_platform/services/sonarqube/samples/docker/docker-compose.yml +5 -0
  108. wexample_wex_addon_services_platform/services/sonarqube/samples/env/__init__.py +0 -0
  109. wexample_wex_addon_services_platform/services/sonarqube/samples/env/prod/__init__.py +0 -0
  110. wexample_wex_addon_services_platform/services/sonarqube/samples/env/prod/docker/__init__.py +0 -0
  111. wexample_wex_addon_services_platform/services/sonarqube/samples/env/prod/docker/docker-compose.yml +6 -0
  112. wexample_wex_addon_services_platform/services/sonarqube/samples/sonarqube/__init__.py +0 -0
  113. wexample_wex_addon_services_platform/services/sonarqube/samples/sonarqube/conf/__init__.py +0 -0
  114. wexample_wex_addon_services_platform/services/sonarqube/samples/sonarqube/conf/sonar.properties +6 -0
  115. wexample_wex_addon_services_platform/services/sonarqube/samples/sonarqube/data/.gitkeep +1 -0
  116. wexample_wex_addon_services_platform/services/sonarqube/samples/sonarqube/data/__init__.py +0 -0
  117. wexample_wex_addon_services_platform/services/sonarqube/samples/sonarqube/extensions/.gitkeep +1 -0
  118. wexample_wex_addon_services_platform/services/sonarqube/samples/sonarqube/extensions/__init__.py +0 -0
  119. wexample_wex_addon_services_platform/services/sonarqube/samples/sonarqube/logs/.gitkeep +1 -0
  120. wexample_wex_addon_services_platform/services/sonarqube/samples/sonarqube/logs/__init__.py +0 -0
  121. wexample_wex_addon_services_platform/services/sonarqube/service.yml +9 -0
  122. wexample_wex_addon_services_platform/services/supabase/__init__.py +0 -0
  123. wexample_wex_addon_services_platform/services/supabase/app_service.py +54 -0
  124. wexample_wex_addon_services_platform/services/supabase/commands/__init__.py +0 -0
  125. wexample_wex_addon_services_platform/services/supabase/commands/service/__init__.py +0 -0
  126. wexample_wex_addon_services_platform/services/supabase/commands/service/install.py +149 -0
  127. wexample_wex_addon_services_platform/services/supabase/commands/service/ready.py +34 -0
  128. wexample_wex_addon_services_platform/services/supabase/docker/__init__.py +0 -0
  129. wexample_wex_addon_services_platform/services/supabase/docker/docker-compose.yml +430 -0
  130. wexample_wex_addon_services_platform/services/supabase/service.yml +55 -0
  131. wexample_wex_addon_services_platform/services_platform_addon_manager.py +15 -0
  132. wexample_wex_addon_services_platform-0.0.3.dist-info/METADATA +166 -0
  133. wexample_wex_addon_services_platform-0.0.3.dist-info/RECORD +135 -0
  134. wexample_wex_addon_services_platform-0.0.3.dist-info/WHEEL +4 -0
  135. wexample_wex_addon_services_platform-0.0.3.dist-info/entry_points.txt +4 -0
@@ -0,0 +1,7 @@
1
+ from __future__ import annotations
2
+
3
+ from wexample_wex_addon_services_platform.services_platform_addon_manager import (
4
+ ServicesPlatformAddonManager,
5
+ )
6
+
7
+ __all__ = ["ServicesPlatformAddonManager"]
File without changes
@@ -0,0 +1,29 @@
1
+ from __future__ import annotations
2
+
3
+ from wexample_wex_addon_app.service.app_service import AppService as BaseAppService
4
+
5
+
6
+ class AppService(BaseAppService):
7
+ def get_workdir_contribution(self) -> dict:
8
+ from wexample_filestate.const.disk import DiskItemType
9
+
10
+ # Gitlab-ce manages its own internal permissions (runs as root),
11
+ # we just ensure the host directories exist before first docker up.
12
+ def _dir(name: str) -> dict:
13
+ return {"name": name, "type": DiskItemType.DIRECTORY, "should_exist": True}
14
+
15
+ return {
16
+ "children": [
17
+ {
18
+ "name": "gitlab",
19
+ "type": DiskItemType.DIRECTORY,
20
+ "should_exist": True,
21
+ "children": [
22
+ _dir("config"),
23
+ _dir("logs"),
24
+ _dir("data"),
25
+ _dir("backups"),
26
+ ],
27
+ }
28
+ ]
29
+ }
@@ -0,0 +1,31 @@
1
+ from __future__ import annotations
2
+
3
+ from typing import TYPE_CHECKING
4
+
5
+ from wexample_wex_core.const.globals import COMMAND_TYPE_SERVICE
6
+ from wexample_wex_core.decorator.command import command
7
+
8
+ if TYPE_CHECKING:
9
+ from wexample_wex_addon_app.service.app_service import AppService
10
+ from wexample_wex_core.context.execution_context import ExecutionContext
11
+
12
+
13
+ @command(
14
+ type=COMMAND_TYPE_SERVICE, description="Configure gitlab service in app config"
15
+ )
16
+ def gitlab__service__install(
17
+ context: ExecutionContext,
18
+ service: AppService,
19
+ ) -> None:
20
+ app_name = service.app_workdir.get_config().search("global.name").get_str()
21
+ config_file = service.app_workdir.get_config_file()
22
+ config = config_file.read_config()
23
+
24
+ config.set_by_path(f"service.{service.name}.host", f"{app_name}_{service.name}")
25
+ config.set_by_path(f"service.{service.name}.port", 80)
26
+ config.set_by_path(f"service.{service.name}.port_ssh", 4567)
27
+
28
+ config_file.write_config(config)
29
+ service.app_workdir.get_runtime_config(rebuild=True)
30
+
31
+ context.io.log(f"Configured gitlab service for app '{app_name}'")
@@ -0,0 +1,32 @@
1
+ from __future__ import annotations
2
+
3
+ from typing import TYPE_CHECKING
4
+
5
+ from wexample_wex_core.const.globals import COMMAND_TYPE_SERVICE
6
+ from wexample_wex_core.decorator.command import command
7
+
8
+ if TYPE_CHECKING:
9
+ from wexample_app.response.boolean_response import BooleanResponse
10
+ from wexample_wex_addon_app.service.app_service import AppService
11
+ from wexample_wex_core.context.execution_context import ExecutionContext
12
+
13
+
14
+ @command(type=COMMAND_TYPE_SERVICE, description="Check if gitlab service is ready")
15
+ def gitlab__service__ready(
16
+ context: ExecutionContext,
17
+ service: AppService,
18
+ ) -> BooleanResponse:
19
+ import subprocess
20
+
21
+ from wexample_app.response.boolean_response import BooleanResponse
22
+
23
+ runtime = service.app_workdir.get_runtime_config()
24
+ app_project_name = runtime.search("app.project_name").get_str()
25
+ container_name = f"{app_project_name}_{service.name}"
26
+
27
+ result = subprocess.run(
28
+ ["docker", "exec", container_name, "gitlab-healthcheck"],
29
+ capture_output=True,
30
+ )
31
+
32
+ return BooleanResponse(kernel=context.kernel, content=result.returncode == 0)
@@ -0,0 +1,20 @@
1
+ services:
2
+ gitlab:
3
+ container_name: ${APP_PROJECT_NAME}_gitlab
4
+ image: gitlab/gitlab-ce:16.4.1-ce.0
5
+ hostname: ${APP_DOMAIN}
6
+ ports:
7
+ - "4567:22"
8
+ volumes:
9
+ - ${APP_PATH}gitlab/backups:/var/opt/gitlab/backups
10
+ - ${APP_PATH}gitlab/config:/etc/gitlab
11
+ - ${APP_PATH}gitlab/logs:/var/log/gitlab
12
+ - ${APP_PATH}gitlab/data:/var/opt/gitlab
13
+ environment:
14
+ - VIRTUAL_HOST=${APP_DOMAINS_STRING}
15
+ - SMTP_DOMAIN=${APP_DOMAIN}
16
+ - VIRTUAL_PORT=80
17
+ - GITLAB_SHELL_SSH_PORT=4567
18
+ extends:
19
+ file: ${SERVICE_DEFAULT_COMPOSE}
20
+ service: default
@@ -0,0 +1,5 @@
1
+ services:
2
+ gitlab:
3
+ extends:
4
+ file: ${SERVICE_GITLAB_COMPOSE}
5
+ service: gitlab
@@ -0,0 +1,6 @@
1
+ services:
2
+ gitlab:
3
+ environment:
4
+ - LETSENCRYPT_EMAIL=${APP_EMAIL}
5
+ - LETSENCRYPT_HOST=${APP_DOMAINS_STRING}
6
+ - VIRTUAL_PROTO=https
@@ -0,0 +1,8 @@
1
+ name: gitlab
2
+ tags:
3
+ - platform
4
+ - scm
5
+ dependencies:
6
+ - proxy
7
+ docker:
8
+ compose: docker/docker-compose.yml
@@ -0,0 +1,15 @@
1
+ services:
2
+ jenkins:
3
+ extends:
4
+ file: ${SERVICE_DEFAULT_COMPOSE}
5
+ service: default
6
+ container_name: ${APP_PROJECT_NAME}_jenkins
7
+ image: jenkins/jenkins:2.60.3
8
+ ports:
9
+ - "50000:50000"
10
+ environment:
11
+ - VIRTUAL_HOST=${APP_DOMAINS_STRING}
12
+ - VIRTUAL_PORT=8080
13
+ volumes:
14
+ - ${APP_PATH}jenkins/config:/jenkins_config
15
+ - ${APP_PATH}jenkins/home:/var/jenkins_home
@@ -0,0 +1,5 @@
1
+ services:
2
+ jenkins:
3
+ extends:
4
+ file: ${SERVICE_JENKINS_COMPOSE}
5
+ service: jenkins
@@ -0,0 +1,5 @@
1
+ services:
2
+ jenkins:
3
+ environment:
4
+ - LETSENCRYPT_HOST=${APP_DOMAINS_STRING}
5
+ - LETSENCRYPT_EMAIL=${APP_EMAIL}
@@ -0,0 +1,8 @@
1
+ name: jenkins
2
+ tags:
3
+ - platform
4
+ - ci
5
+ dependencies:
6
+ - proxy
7
+ docker:
8
+ compose: docker/docker-compose.yml
@@ -0,0 +1,21 @@
1
+ services:
2
+ listmonk:
3
+ container_name: ${APP_PROJECT_NAME}_listmonk
4
+ image: listmonk/listmonk:v2.5.1
5
+ ports:
6
+ - 9000:9000
7
+ environment:
8
+ - VIRTUAL_HOST=${APP_DOMAINS_STRING}
9
+ - TZ=Europe/Paris
10
+ - LISTMONK_app__address=:9000
11
+ - LISTMONK_db__host=${SERVICE_POSTGRES_HOST}
12
+ - LISTMONK_db__port=${SERVICE_POSTGRES_PORT}
13
+ - LISTMONK_db__user=${SERVICE_POSTGRES_USER}
14
+ - LISTMONK_db__password=${SERVICE_POSTGRES_PASSWORD}
15
+ - LISTMONK_db__database=${SERVICE_POSTGRES_NAME}
16
+ volumes:
17
+ - ${APP_PATH}config.toml:/listmonk/config.toml
18
+ extends:
19
+ file: ${SERVICE_DEFAULT_COMPOSE}
20
+ service: default
21
+ command: [sh, -c, "yes | ./listmonk --install && ./listmonk"]
@@ -0,0 +1,2 @@
1
+ [db]
2
+ ssl_mode = "disable"
@@ -0,0 +1,5 @@
1
+ services:
2
+ listmonk:
3
+ extends:
4
+ file: ${SERVICE_LISTMONK_COMPOSE}
5
+ service: listmonk
@@ -0,0 +1,5 @@
1
+ services:
2
+ listmonk:
3
+ environment:
4
+ - LETSENCRYPT_HOST=${APP_DOMAINS_STRING}
5
+ - LETSENCRYPT_EMAIL=${APP_EMAIL}
@@ -0,0 +1,5 @@
1
+ services:
2
+ listmonk:
3
+ environment:
4
+ - LETSENCRYPT_HOST=${APP_DOMAINS_STRING}
5
+ - LETSENCRYPT_EMAIL=${APP_EMAIL}
@@ -0,0 +1,9 @@
1
+ name: listmonk
2
+ tags:
3
+ - platform
4
+ - marketing
5
+ dependencies:
6
+ - postgres
7
+ - proxy
8
+ docker:
9
+ compose: docker/docker-compose.yml
@@ -0,0 +1,24 @@
1
+ from __future__ import annotations
2
+
3
+ from wexample_wex_addon_app.service.app_service import AppService as BaseAppService
4
+
5
+
6
+ class AppService(BaseAppService):
7
+ def get_workdir_contribution(self) -> dict:
8
+ from wexample_filestate.const.disk import DiskItemType
9
+
10
+ # n8n container runs as uid 1000 (node user)
11
+ return {
12
+ "children": [
13
+ {
14
+ "name": "n8n",
15
+ "type": DiskItemType.DIRECTORY,
16
+ "should_exist": True,
17
+ "mode": {
18
+ "owner": "1000:1000",
19
+ "permissions": "750",
20
+ "recursive": True,
21
+ },
22
+ },
23
+ ]
24
+ }
@@ -0,0 +1,35 @@
1
+ from __future__ import annotations
2
+
3
+ from typing import TYPE_CHECKING
4
+
5
+ from wexample_wex_core.const.globals import COMMAND_TYPE_SERVICE
6
+ from wexample_wex_core.decorator.command import command
7
+
8
+ if TYPE_CHECKING:
9
+ from wexample_wex_addon_app.service.app_service import AppService
10
+ from wexample_wex_core.context.execution_context import ExecutionContext
11
+
12
+
13
+ @command(
14
+ type=COMMAND_TYPE_SERVICE,
15
+ description="Configure n8n service in app config",
16
+ )
17
+ def n8n__service__install(
18
+ context: ExecutionContext,
19
+ service: AppService,
20
+ ) -> None:
21
+ from wexample_helpers.helpers.string import string_random_password
22
+
23
+ config_file = service.app_workdir.get_config_file()
24
+ config = config_file.read_config()
25
+
26
+ config.set_by_path(f"service.{service.name}.basic_auth.user", "admin")
27
+ config.set_by_path(
28
+ f"service.{service.name}.basic_auth.password",
29
+ string_random_password(),
30
+ )
31
+
32
+ config_file.write_config(config)
33
+ service.app_workdir.get_runtime_config(rebuild=True)
34
+
35
+ context.io.log("Configured n8n service defaults")
@@ -0,0 +1,39 @@
1
+ from __future__ import annotations
2
+
3
+ from typing import TYPE_CHECKING
4
+
5
+ from wexample_wex_core.const.globals import COMMAND_TYPE_SERVICE
6
+ from wexample_wex_core.decorator.command import command
7
+
8
+ if TYPE_CHECKING:
9
+ from wexample_app.response.boolean_response import BooleanResponse
10
+ from wexample_wex_addon_app.service.app_service import AppService
11
+ from wexample_wex_core.context.execution_context import ExecutionContext
12
+
13
+
14
+ @command(type=COMMAND_TYPE_SERVICE, description="Check if n8n service is ready")
15
+ def n8n__service__ready(
16
+ context: ExecutionContext,
17
+ service: AppService,
18
+ ) -> BooleanResponse:
19
+ import subprocess
20
+
21
+ from wexample_app.response.boolean_response import BooleanResponse
22
+
23
+ runtime = service.app_workdir.get_runtime_config()
24
+ app_project_name = runtime.search("app.project_name").get_str()
25
+ container_name = f"{app_project_name}_{service.name}"
26
+
27
+ result = subprocess.run(
28
+ [
29
+ "docker",
30
+ "exec",
31
+ container_name,
32
+ "curl",
33
+ "-sf",
34
+ "http://localhost:5678/healthz",
35
+ ],
36
+ capture_output=True,
37
+ )
38
+
39
+ return BooleanResponse(kernel=context.kernel, content=result.returncode == 0)
@@ -0,0 +1,21 @@
1
+ services:
2
+ n8n:
3
+ container_name: ${APP_PROJECT_NAME}_n8n
4
+ image: n8nio/n8n:1.113.3
5
+ ports:
6
+ - 5678:5678
7
+ environment:
8
+ - VIRTUAL_HOST=${APP_DOMAINS_STRING}
9
+ - VIRTUAL_PORT=5678
10
+ - N8N_BASIC_AUTH_ACTIVE=true
11
+ - N8N_BASIC_AUTH_USER=${SERVICE_N8N_BASIC_AUTH_USER}
12
+ - N8N_BASIC_AUTH_PASSWORD=${SERVICE_N8N_BASIC_AUTH_PASSWORD}
13
+ - N8N_HOST=${APP_DOMAIN}
14
+ - N8N_PROTOCOL=https
15
+ - NODE_ENV=production
16
+ - WEBHOOK_TUNNEL_URL=https://${APP_DOMAIN}/
17
+ - GENERIC_TIMEZONE=Europe/Paris
18
+ volumes:
19
+ - ${APP_PATH}n8n:/home/node/.n8n
20
+ networks:
21
+ - wex_net
@@ -0,0 +1,5 @@
1
+ services:
2
+ n8n:
3
+ extends:
4
+ file: ${SERVICE_N8N_COMPOSE}
5
+ service: n8n
@@ -0,0 +1,5 @@
1
+ services:
2
+ n8n:
3
+ environment:
4
+ - LETSENCRYPT_HOST=${APP_DOMAINS_STRING}
5
+ - LETSENCRYPT_EMAIL=${APP_EMAIL}
@@ -0,0 +1,8 @@
1
+ services:
2
+ n8n:
3
+ environment:
4
+ - N8N_PORT=443
5
+ - LETSENCRYPT_HOST=${APP_DOMAINS_STRING}
6
+ - LETSENCRYPT_EMAIL=${APP_EMAIL}
7
+ ports:
8
+ - 5678:443
@@ -0,0 +1,8 @@
1
+ name: n8n
2
+ tags:
3
+ - platform
4
+ - automation
5
+ dependencies:
6
+ - proxy
7
+ docker:
8
+ compose: docker/docker-compose.yml
@@ -0,0 +1,29 @@
1
+ from __future__ import annotations
2
+
3
+ from wexample_wex_addon_app.service.app_service import AppService as BaseAppService
4
+
5
+
6
+ class AppService(BaseAppService):
7
+ def get_workdir_contribution(self) -> dict:
8
+ from wexample_filestate.const.disk import DiskItemType
9
+
10
+ # Nextcloud container runs as uid 33 (www-data)
11
+ nc_mode = {"owner": "33:33", "permissions": "750", "recursive": True}
12
+
13
+ return {
14
+ "children": [
15
+ {
16
+ "name": "nextcloud",
17
+ "type": DiskItemType.DIRECTORY,
18
+ "should_exist": True,
19
+ "children": [
20
+ {
21
+ "name": "data",
22
+ "type": DiskItemType.DIRECTORY,
23
+ "should_exist": True,
24
+ "mode": nc_mode,
25
+ },
26
+ ],
27
+ },
28
+ ]
29
+ }
@@ -0,0 +1,39 @@
1
+ from __future__ import annotations
2
+
3
+ from typing import TYPE_CHECKING
4
+
5
+ from wexample_wex_core.const.globals import COMMAND_TYPE_SERVICE
6
+ from wexample_wex_core.decorator.command import command
7
+
8
+ if TYPE_CHECKING:
9
+ from wexample_app.response.boolean_response import BooleanResponse
10
+ from wexample_wex_addon_app.service.app_service import AppService
11
+ from wexample_wex_core.context.execution_context import ExecutionContext
12
+
13
+
14
+ @command(type=COMMAND_TYPE_SERVICE, description="Check if nextcloud service is ready")
15
+ def nextcloud__service__ready(
16
+ context: ExecutionContext,
17
+ service: AppService,
18
+ ) -> BooleanResponse:
19
+ import subprocess
20
+
21
+ from wexample_app.response.boolean_response import BooleanResponse
22
+
23
+ runtime = service.app_workdir.get_runtime_config()
24
+ app_project_name = runtime.search("app.project_name").get_str()
25
+ container_name = f"{app_project_name}_{service.name}"
26
+
27
+ result = subprocess.run(
28
+ [
29
+ "docker",
30
+ "exec",
31
+ container_name,
32
+ "curl",
33
+ "-sf",
34
+ "http://localhost/status.php",
35
+ ],
36
+ capture_output=True,
37
+ )
38
+
39
+ return BooleanResponse(kernel=context.kernel, content=result.returncode == 0)