phlo-traefik 0.1.0__tar.gz

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.
@@ -0,0 +1,15 @@
1
+ Metadata-Version: 2.4
2
+ Name: phlo-traefik
3
+ Version: 0.1.0
4
+ Summary: Traefik service plugin for Phlo
5
+ Author-email: Phlo Team <team@phlo.dev>
6
+ License: MIT
7
+ Requires-Python: >=3.11
8
+ Description-Content-Type: text/plain
9
+ Requires-Dist: phlo>=0.1.0
10
+ Requires-Dist: pyyaml>=6.0.1
11
+ Provides-Extra: dev
12
+ Requires-Dist: pytest>=7.0; extra == "dev"
13
+ Requires-Dist: ruff>=0.1.0; extra == "dev"
14
+
15
+ Traefik service plugin for Phlo.
@@ -0,0 +1,52 @@
1
+ # phlo-traefik
2
+
3
+ Traefik reverse proxy service plugin for Phlo.
4
+
5
+ ## Overview
6
+
7
+ Provides local reverse proxy for accessing Phlo services by hostname:
8
+ - `http://dagster.phlo.localhost`
9
+ - `http://minio.phlo.localhost`
10
+ - `http://trino.phlo.localhost`
11
+
12
+ ## Usage
13
+
14
+ ```bash
15
+ phlo services start --service traefik
16
+ open http://dagster.phlo.localhost
17
+ ```
18
+
19
+ ## Configuration
20
+
21
+ | Environment Variable | Default | Description |
22
+ |---------------------|---------|-------------|
23
+ | `TRAEFIK_HTTP_PORT` | `80` | Host port for Traefik HTTP entrypoint |
24
+ | `TRAEFIK_DOMAIN` | `phlo.localhost` | Base domain for service hostnames |
25
+
26
+ ## Routed Services
27
+
28
+ The following services are automatically routed when Traefik is enabled:
29
+
30
+ | Hostname | Service | Port |
31
+ |----------|---------|------|
32
+ | `dagster.phlo.localhost` | Dagster | 3000 |
33
+ | `minio.phlo.localhost` | MinIO Console | 9001 |
34
+ | `minio-api.phlo.localhost` | MinIO API | 9000 |
35
+ | `trino.phlo.localhost` | Trino | 8080 |
36
+ | `nessie.phlo.localhost` | Nessie | 19120 |
37
+ | `clickhouse.phlo.localhost` | ClickHouse | 8123 |
38
+ | `api.phlo.localhost` | Phlo API | 4000 |
39
+ | `traefik.phlo.localhost` | Traefik Dashboard | (internal) |
40
+
41
+ ## Troubleshooting
42
+
43
+ ### Port 80 already in use
44
+
45
+ If port 80 is already in use on your machine, set a custom port:
46
+
47
+ ```bash
48
+ # In .phlo/.env.local
49
+ TRAEFIK_HTTP_PORT=8088
50
+ ```
51
+
52
+ Then access services with the port: `http://dagster.phlo.localhost:8088`
@@ -0,0 +1,41 @@
1
+ [build-system]
2
+ requires = ["setuptools>=45", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "phlo-traefik"
7
+ version = "0.1.0"
8
+ description = "Traefik service plugin for Phlo"
9
+ readme = {text = "Traefik service plugin for Phlo.", content-type = "text/plain"}
10
+ requires-python = ">=3.11"
11
+ authors = [
12
+ {name = "Phlo Team", email = "team@phlo.dev"},
13
+ ]
14
+ license = {text = "MIT"}
15
+ dependencies = [
16
+ "phlo>=0.1.0",
17
+ "pyyaml>=6.0.1",
18
+ ]
19
+
20
+ [project.optional-dependencies]
21
+ dev = [
22
+ "pytest>=7.0",
23
+ "ruff>=0.1.0",
24
+ ]
25
+
26
+ [project.entry-points."phlo.plugins.services"]
27
+ traefik = "phlo_traefik.plugin:TraefikServicePlugin"
28
+
29
+ [tool.setuptools]
30
+ package-dir = {"" = "src"}
31
+ include-package-data = true
32
+
33
+ [tool.setuptools.packages.find]
34
+ where = ["src"]
35
+
36
+ [tool.setuptools.package-data]
37
+ phlo_traefik = ["service.yaml"]
38
+
39
+ [tool.ruff]
40
+ line-length = 100
41
+ target-version = "py311"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1 @@
1
+ """Traefik service plugin."""
@@ -0,0 +1,31 @@
1
+ """Traefik service plugin."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from importlib import resources
6
+ from typing import Any
7
+
8
+ import yaml
9
+
10
+ from phlo.plugins import PluginMetadata, ServicePlugin
11
+
12
+
13
+ class TraefikServicePlugin(ServicePlugin):
14
+ """Service plugin for Traefik reverse proxy."""
15
+
16
+ @property
17
+ def metadata(self) -> PluginMetadata:
18
+ """Return plugin metadata for Traefik service registration."""
19
+ return PluginMetadata(
20
+ name="traefik",
21
+ version="0.1.0",
22
+ description="Local reverse proxy for named service URLs",
23
+ author="Phlo Team",
24
+ tags=["networking", "proxy", "traefik"],
25
+ )
26
+
27
+ @property
28
+ def service_definition(self) -> dict[str, Any]:
29
+ """Load and return the Traefik service definition."""
30
+ service_path = resources.files("phlo_traefik").joinpath("service.yaml")
31
+ return yaml.safe_load(service_path.read_text(encoding="utf-8"))
@@ -0,0 +1,32 @@
1
+ name: traefik
2
+ description: Local reverse proxy for named service URLs
3
+ category: networking
4
+ default: false
5
+ profile: proxy
6
+
7
+ image: traefik:v3.3
8
+
9
+ compose:
10
+ restart: unless-stopped
11
+ command:
12
+ - "--providers.docker=true"
13
+ - "--providers.docker.exposedbydefault=false"
14
+ - "--entrypoints.web.address=:80"
15
+ - "--api.dashboard=true"
16
+ ports:
17
+ - "${TRAEFIK_HTTP_PORT:-80}:80"
18
+ volumes:
19
+ - "/var/run/docker.sock:/var/run/docker.sock:ro"
20
+ labels:
21
+ traefik.enable: "true"
22
+ traefik.http.routers.traefik.rule: "Host(`traefik.${TRAEFIK_DOMAIN:-phlo.localhost}`)"
23
+ traefik.http.routers.traefik.service: "api@internal"
24
+ traefik.http.routers.traefik.entrypoints: "web"
25
+
26
+ env_vars:
27
+ TRAEFIK_HTTP_PORT:
28
+ default: 80
29
+ description: Host port for Traefik HTTP entrypoint
30
+ TRAEFIK_DOMAIN:
31
+ default: phlo.localhost
32
+ description: Base domain used to build service hostnames
@@ -0,0 +1,6 @@
1
+ """Traefik settings."""
2
+
3
+ from __future__ import annotations
4
+
5
+ TRAEFIK_HTTP_PORT_DEFAULT = 80
6
+ TRAEFIK_DOMAIN_DEFAULT = "phlo.localhost"
@@ -0,0 +1,15 @@
1
+ Metadata-Version: 2.4
2
+ Name: phlo-traefik
3
+ Version: 0.1.0
4
+ Summary: Traefik service plugin for Phlo
5
+ Author-email: Phlo Team <team@phlo.dev>
6
+ License: MIT
7
+ Requires-Python: >=3.11
8
+ Description-Content-Type: text/plain
9
+ Requires-Dist: phlo>=0.1.0
10
+ Requires-Dist: pyyaml>=6.0.1
11
+ Provides-Extra: dev
12
+ Requires-Dist: pytest>=7.0; extra == "dev"
13
+ Requires-Dist: ruff>=0.1.0; extra == "dev"
14
+
15
+ Traefik service plugin for Phlo.
@@ -0,0 +1,13 @@
1
+ README.md
2
+ pyproject.toml
3
+ src/phlo_traefik/__init__.py
4
+ src/phlo_traefik/plugin.py
5
+ src/phlo_traefik/service.yaml
6
+ src/phlo_traefik/settings.py
7
+ src/phlo_traefik.egg-info/PKG-INFO
8
+ src/phlo_traefik.egg-info/SOURCES.txt
9
+ src/phlo_traefik.egg-info/dependency_links.txt
10
+ src/phlo_traefik.egg-info/entry_points.txt
11
+ src/phlo_traefik.egg-info/requires.txt
12
+ src/phlo_traefik.egg-info/top_level.txt
13
+ tests/test_traefik_plugin.py
@@ -0,0 +1,2 @@
1
+ [phlo.plugins.services]
2
+ traefik = phlo_traefik.plugin:TraefikServicePlugin
@@ -0,0 +1,6 @@
1
+ phlo>=0.1.0
2
+ pyyaml>=6.0.1
3
+
4
+ [dev]
5
+ pytest>=7.0
6
+ ruff>=0.1.0
@@ -0,0 +1 @@
1
+ phlo_traefik
@@ -0,0 +1,21 @@
1
+ """Tests for Traefik service plugin."""
2
+
3
+ from phlo_traefik.plugin import TraefikServicePlugin
4
+
5
+
6
+ def test_traefik_service_definition():
7
+ """Validate Traefik service definition defaults."""
8
+ plugin = TraefikServicePlugin()
9
+ defn = plugin.service_definition
10
+
11
+ assert defn["name"] == "traefik"
12
+ assert defn["profile"] == "proxy"
13
+
14
+
15
+ def test_traefik_plugin_metadata():
16
+ """Validate Traefik plugin metadata."""
17
+ plugin = TraefikServicePlugin()
18
+ meta = plugin.metadata
19
+
20
+ assert meta.name == "traefik"
21
+ assert "networking" in meta.tags