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.
- wexample_wex_addon_services_platform/__init__.py +7 -0
- wexample_wex_addon_services_platform/py.typed +0 -0
- wexample_wex_addon_services_platform/services/__init__.py +0 -0
- wexample_wex_addon_services_platform/services/gitlab/__init__.py +0 -0
- wexample_wex_addon_services_platform/services/gitlab/app_service.py +29 -0
- wexample_wex_addon_services_platform/services/gitlab/commands/__init__.py +0 -0
- wexample_wex_addon_services_platform/services/gitlab/commands/service/__init__.py +0 -0
- wexample_wex_addon_services_platform/services/gitlab/commands/service/install.py +31 -0
- wexample_wex_addon_services_platform/services/gitlab/commands/service/ready.py +32 -0
- wexample_wex_addon_services_platform/services/gitlab/docker/__init__.py +0 -0
- wexample_wex_addon_services_platform/services/gitlab/docker/docker-compose.yml +20 -0
- wexample_wex_addon_services_platform/services/gitlab/samples/__init__.py +0 -0
- wexample_wex_addon_services_platform/services/gitlab/samples/docker/__init__.py +0 -0
- wexample_wex_addon_services_platform/services/gitlab/samples/docker/docker-compose.yml +5 -0
- wexample_wex_addon_services_platform/services/gitlab/samples/env/__init__.py +0 -0
- wexample_wex_addon_services_platform/services/gitlab/samples/env/prod/__init__.py +0 -0
- wexample_wex_addon_services_platform/services/gitlab/samples/env/prod/docker/__init__.py +0 -0
- wexample_wex_addon_services_platform/services/gitlab/samples/env/prod/docker/docker-compose.yml +6 -0
- wexample_wex_addon_services_platform/services/gitlab/samples/gitlab/__init__.py +0 -0
- wexample_wex_addon_services_platform/services/gitlab/samples/gitlab/backups/.gitkeep +1 -0
- wexample_wex_addon_services_platform/services/gitlab/samples/gitlab/backups/__init__.py +0 -0
- wexample_wex_addon_services_platform/services/gitlab/samples/gitlab/config/.gitkeep +1 -0
- wexample_wex_addon_services_platform/services/gitlab/samples/gitlab/config/__init__.py +0 -0
- wexample_wex_addon_services_platform/services/gitlab/samples/gitlab/data/.gitkeep +1 -0
- wexample_wex_addon_services_platform/services/gitlab/samples/gitlab/data/__init__.py +0 -0
- wexample_wex_addon_services_platform/services/gitlab/samples/gitlab/logs/.gitkeep +1 -0
- wexample_wex_addon_services_platform/services/gitlab/samples/gitlab/logs/__init__.py +0 -0
- wexample_wex_addon_services_platform/services/gitlab/service.yml +8 -0
- wexample_wex_addon_services_platform/services/jenkins/__init__.py +0 -0
- wexample_wex_addon_services_platform/services/jenkins/docker/__init__.py +0 -0
- wexample_wex_addon_services_platform/services/jenkins/docker/docker-compose.yml +15 -0
- wexample_wex_addon_services_platform/services/jenkins/samples/__init__.py +0 -0
- wexample_wex_addon_services_platform/services/jenkins/samples/docker/__init__.py +0 -0
- wexample_wex_addon_services_platform/services/jenkins/samples/docker/docker-compose.yml +5 -0
- wexample_wex_addon_services_platform/services/jenkins/samples/env/__init__.py +0 -0
- wexample_wex_addon_services_platform/services/jenkins/samples/env/prod/__init__.py +0 -0
- wexample_wex_addon_services_platform/services/jenkins/samples/env/prod/docker/__init__.py +0 -0
- wexample_wex_addon_services_platform/services/jenkins/samples/env/prod/docker/docker-compose.yml +5 -0
- wexample_wex_addon_services_platform/services/jenkins/samples/jenkins/__init__.py +0 -0
- wexample_wex_addon_services_platform/services/jenkins/samples/jenkins/config/.gitkeep +1 -0
- wexample_wex_addon_services_platform/services/jenkins/samples/jenkins/config/__init__.py +0 -0
- wexample_wex_addon_services_platform/services/jenkins/samples/jenkins/home/.gitkeep +1 -0
- wexample_wex_addon_services_platform/services/jenkins/samples/jenkins/home/__init__.py +0 -0
- wexample_wex_addon_services_platform/services/jenkins/service.yml +8 -0
- wexample_wex_addon_services_platform/services/listmonk/__init__.py +0 -0
- wexample_wex_addon_services_platform/services/listmonk/docker/__init__.py +0 -0
- wexample_wex_addon_services_platform/services/listmonk/docker/docker-compose.yml +21 -0
- wexample_wex_addon_services_platform/services/listmonk/samples/__init__.py +0 -0
- wexample_wex_addon_services_platform/services/listmonk/samples/config.toml +2 -0
- wexample_wex_addon_services_platform/services/listmonk/samples/docker/__init__.py +0 -0
- wexample_wex_addon_services_platform/services/listmonk/samples/docker/docker-compose.yml +5 -0
- wexample_wex_addon_services_platform/services/listmonk/samples/env/__init__.py +0 -0
- wexample_wex_addon_services_platform/services/listmonk/samples/env/dev/__init__.py +0 -0
- wexample_wex_addon_services_platform/services/listmonk/samples/env/dev/docker/__init__.py +0 -0
- wexample_wex_addon_services_platform/services/listmonk/samples/env/dev/docker/docker-compose.yml +5 -0
- wexample_wex_addon_services_platform/services/listmonk/samples/env/prod/__init__.py +0 -0
- wexample_wex_addon_services_platform/services/listmonk/samples/env/prod/docker/__init__.py +0 -0
- wexample_wex_addon_services_platform/services/listmonk/samples/env/prod/docker/docker-compose.yml +5 -0
- wexample_wex_addon_services_platform/services/listmonk/service.yml +9 -0
- wexample_wex_addon_services_platform/services/n8n/__init__.py +0 -0
- wexample_wex_addon_services_platform/services/n8n/app_service.py +24 -0
- wexample_wex_addon_services_platform/services/n8n/commands/__init__.py +1 -0
- wexample_wex_addon_services_platform/services/n8n/commands/service/__init__.py +1 -0
- wexample_wex_addon_services_platform/services/n8n/commands/service/install.py +35 -0
- wexample_wex_addon_services_platform/services/n8n/commands/service/ready.py +39 -0
- wexample_wex_addon_services_platform/services/n8n/docker/__init__.py +0 -0
- wexample_wex_addon_services_platform/services/n8n/docker/docker-compose.yml +21 -0
- wexample_wex_addon_services_platform/services/n8n/samples/__init__.py +0 -0
- wexample_wex_addon_services_platform/services/n8n/samples/docker/__init__.py +0 -0
- wexample_wex_addon_services_platform/services/n8n/samples/docker/docker-compose.yml +5 -0
- wexample_wex_addon_services_platform/services/n8n/samples/env/__init__.py +0 -0
- wexample_wex_addon_services_platform/services/n8n/samples/env/dev/__init__.py +0 -0
- wexample_wex_addon_services_platform/services/n8n/samples/env/dev/docker/__init__.py +0 -0
- wexample_wex_addon_services_platform/services/n8n/samples/env/dev/docker/docker-compose.yml +5 -0
- wexample_wex_addon_services_platform/services/n8n/samples/env/prod/__init__.py +0 -0
- wexample_wex_addon_services_platform/services/n8n/samples/env/prod/docker/__init__.py +0 -0
- wexample_wex_addon_services_platform/services/n8n/samples/env/prod/docker/docker-compose.yml +8 -0
- wexample_wex_addon_services_platform/services/n8n/samples/n8n/.gitkeep +1 -0
- wexample_wex_addon_services_platform/services/n8n/samples/n8n/__init__.py +0 -0
- wexample_wex_addon_services_platform/services/n8n/service.yml +8 -0
- wexample_wex_addon_services_platform/services/nextcloud/__init__.py +0 -0
- wexample_wex_addon_services_platform/services/nextcloud/app_service.py +29 -0
- wexample_wex_addon_services_platform/services/nextcloud/commands/__init__.py +0 -0
- wexample_wex_addon_services_platform/services/nextcloud/commands/service/__init__.py +0 -0
- wexample_wex_addon_services_platform/services/nextcloud/commands/service/ready.py +39 -0
- wexample_wex_addon_services_platform/services/nextcloud/docker/__init__.py +0 -0
- wexample_wex_addon_services_platform/services/nextcloud/docker/docker-compose.yml +12 -0
- wexample_wex_addon_services_platform/services/nextcloud/service.yml +8 -0
- wexample_wex_addon_services_platform/services/ollama/__init__.py +0 -0
- wexample_wex_addon_services_platform/services/ollama/app_service.py +19 -0
- wexample_wex_addon_services_platform/services/ollama/commands/__init__.py +0 -0
- wexample_wex_addon_services_platform/services/ollama/commands/service/__init__.py +0 -0
- wexample_wex_addon_services_platform/services/ollama/commands/service/install.py +30 -0
- wexample_wex_addon_services_platform/services/ollama/commands/service/ready.py +39 -0
- wexample_wex_addon_services_platform/services/ollama/docker/__init__.py +0 -0
- wexample_wex_addon_services_platform/services/ollama/docker/docker-compose.yml +7 -0
- wexample_wex_addon_services_platform/services/ollama/service.yml +6 -0
- wexample_wex_addon_services_platform/services/rabbitmq/__init__.py +0 -0
- wexample_wex_addon_services_platform/services/rabbitmq/docker/__init__.py +0 -0
- wexample_wex_addon_services_platform/services/rabbitmq/docker/docker-compose.yml +21 -0
- wexample_wex_addon_services_platform/services/rabbitmq/service.yml +8 -0
- wexample_wex_addon_services_platform/services/sonarqube/__init__.py +0 -0
- wexample_wex_addon_services_platform/services/sonarqube/docker/__init__.py +0 -0
- wexample_wex_addon_services_platform/services/sonarqube/docker/docker-compose.yml +21 -0
- wexample_wex_addon_services_platform/services/sonarqube/samples/__init__.py +0 -0
- wexample_wex_addon_services_platform/services/sonarqube/samples/docker/__init__.py +0 -0
- wexample_wex_addon_services_platform/services/sonarqube/samples/docker/docker-compose.yml +5 -0
- wexample_wex_addon_services_platform/services/sonarqube/samples/env/__init__.py +0 -0
- wexample_wex_addon_services_platform/services/sonarqube/samples/env/prod/__init__.py +0 -0
- wexample_wex_addon_services_platform/services/sonarqube/samples/env/prod/docker/__init__.py +0 -0
- wexample_wex_addon_services_platform/services/sonarqube/samples/env/prod/docker/docker-compose.yml +6 -0
- wexample_wex_addon_services_platform/services/sonarqube/samples/sonarqube/__init__.py +0 -0
- wexample_wex_addon_services_platform/services/sonarqube/samples/sonarqube/conf/__init__.py +0 -0
- wexample_wex_addon_services_platform/services/sonarqube/samples/sonarqube/conf/sonar.properties +6 -0
- wexample_wex_addon_services_platform/services/sonarqube/samples/sonarqube/data/.gitkeep +1 -0
- wexample_wex_addon_services_platform/services/sonarqube/samples/sonarqube/data/__init__.py +0 -0
- wexample_wex_addon_services_platform/services/sonarqube/samples/sonarqube/extensions/.gitkeep +1 -0
- wexample_wex_addon_services_platform/services/sonarqube/samples/sonarqube/extensions/__init__.py +0 -0
- wexample_wex_addon_services_platform/services/sonarqube/samples/sonarqube/logs/.gitkeep +1 -0
- wexample_wex_addon_services_platform/services/sonarqube/samples/sonarqube/logs/__init__.py +0 -0
- wexample_wex_addon_services_platform/services/sonarqube/service.yml +9 -0
- wexample_wex_addon_services_platform/services/supabase/__init__.py +0 -0
- wexample_wex_addon_services_platform/services/supabase/app_service.py +54 -0
- wexample_wex_addon_services_platform/services/supabase/commands/__init__.py +0 -0
- wexample_wex_addon_services_platform/services/supabase/commands/service/__init__.py +0 -0
- wexample_wex_addon_services_platform/services/supabase/commands/service/install.py +149 -0
- wexample_wex_addon_services_platform/services/supabase/commands/service/ready.py +34 -0
- wexample_wex_addon_services_platform/services/supabase/docker/__init__.py +0 -0
- wexample_wex_addon_services_platform/services/supabase/docker/docker-compose.yml +430 -0
- wexample_wex_addon_services_platform/services/supabase/service.yml +55 -0
- wexample_wex_addon_services_platform/services_platform_addon_manager.py +15 -0
- wexample_wex_addon_services_platform-0.0.3.dist-info/METADATA +166 -0
- wexample_wex_addon_services_platform-0.0.3.dist-info/RECORD +135 -0
- wexample_wex_addon_services_platform-0.0.3.dist-info/WHEEL +4 -0
- wexample_wex_addon_services_platform-0.0.3.dist-info/entry_points.txt +4 -0
|
File without changes
|
|
File without changes
|
|
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
|
+
}
|
|
File without changes
|
|
File without changes
|
|
@@ -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)
|
|
File without changes
|
|
@@ -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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -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"]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -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 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -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)
|
|
File without changes
|
|
@@ -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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
File without changes
|
|
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
|
+
# 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
|
+
}
|
|
File without changes
|
|
File without changes
|
|
@@ -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)
|
|
File without changes
|