lensfy 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.
- lensfy-0.1.0/.gitignore +24 -0
- lensfy-0.1.0/LICENSE +202 -0
- lensfy-0.1.0/PKG-INFO +395 -0
- lensfy-0.1.0/README.md +356 -0
- lensfy-0.1.0/backend/lensfy/__init__.py +3 -0
- lensfy-0.1.0/backend/lensfy/__main__.py +7 -0
- lensfy-0.1.0/backend/lensfy/ai/__init__.py +0 -0
- lensfy-0.1.0/backend/lensfy/ai/agent.py +259 -0
- lensfy-0.1.0/backend/lensfy/ai/tools.py +422 -0
- lensfy-0.1.0/backend/lensfy/api/__init__.py +0 -0
- lensfy-0.1.0/backend/lensfy/api/deps.py +72 -0
- lensfy-0.1.0/backend/lensfy/api/router.py +32 -0
- lensfy-0.1.0/backend/lensfy/api/routes/__init__.py +0 -0
- lensfy-0.1.0/backend/lensfy/api/routes/ai.py +40 -0
- lensfy-0.1.0/backend/lensfy/api/routes/clusters.py +105 -0
- lensfy-0.1.0/backend/lensfy/api/routes/deployments.py +31 -0
- lensfy-0.1.0/backend/lensfy/api/routes/helm.py +60 -0
- lensfy-0.1.0/backend/lensfy/api/routes/logs.py +30 -0
- lensfy-0.1.0/backend/lensfy/api/routes/metrics.py +66 -0
- lensfy-0.1.0/backend/lensfy/api/routes/onboarding.py +55 -0
- lensfy-0.1.0/backend/lensfy/api/routes/pods.py +27 -0
- lensfy-0.1.0/backend/lensfy/api/routes/portforward.py +31 -0
- lensfy-0.1.0/backend/lensfy/api/routes/resources.py +344 -0
- lensfy-0.1.0/backend/lensfy/auth/__init__.py +5 -0
- lensfy-0.1.0/backend/lensfy/cli.py +110 -0
- lensfy-0.1.0/backend/lensfy/core/__init__.py +0 -0
- lensfy-0.1.0/backend/lensfy/core/config.py +171 -0
- lensfy-0.1.0/backend/lensfy/core/env.py +18 -0
- lensfy-0.1.0/backend/lensfy/core/logging.py +75 -0
- lensfy-0.1.0/backend/lensfy/core/security.py +243 -0
- lensfy-0.1.0/backend/lensfy/database/__init__.py +0 -0
- lensfy-0.1.0/backend/lensfy/database/base.py +5 -0
- lensfy-0.1.0/backend/lensfy/database/migrate.py +160 -0
- lensfy-0.1.0/backend/lensfy/database/session.py +117 -0
- lensfy-0.1.0/backend/lensfy/kubernetes/__init__.py +3 -0
- lensfy-0.1.0/backend/lensfy/kubernetes/client.py +1984 -0
- lensfy-0.1.0/backend/lensfy/kubernetes/gcloud.py +168 -0
- lensfy-0.1.0/backend/lensfy/kubernetes/helm.py +119 -0
- lensfy-0.1.0/backend/lensfy/kubernetes/portforward.py +147 -0
- lensfy-0.1.0/backend/lensfy/kubernetes/resources.py +433 -0
- lensfy-0.1.0/backend/lensfy/main.py +116 -0
- lensfy-0.1.0/backend/lensfy/migrations/env.py +67 -0
- lensfy-0.1.0/backend/lensfy/migrations/script.py.mako +24 -0
- lensfy-0.1.0/backend/lensfy/migrations/versions/.gitkeep +0 -0
- lensfy-0.1.0/backend/lensfy/migrations/versions/3dd28d5360e5_add_cluster_insecure.py +32 -0
- lensfy-0.1.0/backend/lensfy/migrations/versions/65f848049163_initial_schema.py +65 -0
- lensfy-0.1.0/backend/lensfy/migrations/versions/a56ba4a12ec7_add_cluster_color.py +32 -0
- lensfy-0.1.0/backend/lensfy/migrations/versions/b7c19e4a52d1_add_cluster_sort_order.py +28 -0
- lensfy-0.1.0/backend/lensfy/migrations/versions/c3f1a8d4e7b2_add_ai_reports.py +36 -0
- lensfy-0.1.0/backend/lensfy/migrations/versions/d8e2f4a6b1c9_manifest_versions_and_env.py +58 -0
- lensfy-0.1.0/backend/lensfy/migrations/versions/f30cb007a222_context_not_unique.py +34 -0
- lensfy-0.1.0/backend/lensfy/models/__init__.py +6 -0
- lensfy-0.1.0/backend/lensfy/models/ai_report.py +21 -0
- lensfy-0.1.0/backend/lensfy/models/cluster.py +33 -0
- lensfy-0.1.0/backend/lensfy/models/command_history.py +21 -0
- lensfy-0.1.0/backend/lensfy/models/manifest_version.py +28 -0
- lensfy-0.1.0/backend/lensfy/models/mixins.py +15 -0
- lensfy-0.1.0/backend/lensfy/repositories/__init__.py +0 -0
- lensfy-0.1.0/backend/lensfy/repositories/base.py +33 -0
- lensfy-0.1.0/backend/lensfy/repositories/cluster.py +31 -0
- lensfy-0.1.0/backend/lensfy/schemas/__init__.py +0 -0
- lensfy-0.1.0/backend/lensfy/schemas/ai_report.py +26 -0
- lensfy-0.1.0/backend/lensfy/schemas/cluster.py +88 -0
- lensfy-0.1.0/backend/lensfy/schemas/workloads.py +185 -0
- lensfy-0.1.0/backend/lensfy/services/__init__.py +0 -0
- lensfy-0.1.0/backend/lensfy/services/ai_reports.py +42 -0
- lensfy-0.1.0/backend/lensfy/services/cluster.py +293 -0
- lensfy-0.1.0/backend/lensfy/services/helm.py +61 -0
- lensfy-0.1.0/backend/lensfy/services/manifest_versions.py +71 -0
- lensfy-0.1.0/backend/lensfy/services/workloads.py +275 -0
- lensfy-0.1.0/backend/lensfy/static/css/style.css +1264 -0
- lensfy-0.1.0/backend/lensfy/static/css/tokens.css +124 -0
- lensfy-0.1.0/backend/lensfy/static/icons/icon-192.png +0 -0
- lensfy-0.1.0/backend/lensfy/static/icons/icon-512.png +0 -0
- lensfy-0.1.0/backend/lensfy/static/icons/icon-maskable-512.png +0 -0
- lensfy-0.1.0/backend/lensfy/static/icons/icon.svg +21 -0
- lensfy-0.1.0/backend/lensfy/static/js/app.js +6230 -0
- lensfy-0.1.0/backend/lensfy/static/js/sw.js +83 -0
- lensfy-0.1.0/backend/lensfy/static/js/toast.js +58 -0
- lensfy-0.1.0/backend/lensfy/static/manifest.webmanifest +22 -0
- lensfy-0.1.0/backend/lensfy/templates/index.html +426 -0
- lensfy-0.1.0/backend/lensfy/web/__init__.py +3 -0
- lensfy-0.1.0/backend/lensfy/web/router.py +82 -0
- lensfy-0.1.0/backend/lensfy/websocket/__init__.py +3 -0
- lensfy-0.1.0/backend/lensfy/websocket/manager.py +34 -0
- lensfy-0.1.0/backend/lensfy/websocket/router.py +956 -0
- lensfy-0.1.0/pyproject.toml +72 -0
lensfy-0.1.0/.gitignore
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
|
|
2
|
+
# runtime do script de controle (PID/log)
|
|
3
|
+
backend/.run/
|
|
4
|
+
|
|
5
|
+
# artefatos de empacotamento .rpm
|
|
6
|
+
packaging/rpm/_build/
|
|
7
|
+
packaging/rpm/dist/
|
|
8
|
+
|
|
9
|
+
# segredos / estado local do backend (nunca versionar nem empacotar)
|
|
10
|
+
backend/.env
|
|
11
|
+
backend/.env.local
|
|
12
|
+
*.db
|
|
13
|
+
*.db-journal
|
|
14
|
+
|
|
15
|
+
# caches de teste / cobertura
|
|
16
|
+
.pytest_cache/
|
|
17
|
+
.coverage
|
|
18
|
+
.coverage.*
|
|
19
|
+
htmlcov/
|
|
20
|
+
|
|
21
|
+
# Python packaging (python -m build)
|
|
22
|
+
/dist/
|
|
23
|
+
/build/
|
|
24
|
+
*.egg-info/
|
lensfy-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
lensfy-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,395 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: lensfy
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Gerenciador local de clusters Kubernetes — alternativa open-source ao Lens/OpenLens, no navegador
|
|
5
|
+
Project-URL: Homepage, https://gitlab.com/fabiocax/lensfy
|
|
6
|
+
Project-URL: Source, https://gitlab.com/fabiocax/lensfy
|
|
7
|
+
Project-URL: Issues, https://gitlab.com/fabiocax/lensfy/-/issues
|
|
8
|
+
Author: fabiocax
|
|
9
|
+
License-Expression: Apache-2.0
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: dashboard,devops,k8s,kubectl,kubernetes,lens,sre
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: Environment :: Web Environment
|
|
14
|
+
Classifier: Framework :: FastAPI
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
16
|
+
Classifier: Intended Audience :: System Administrators
|
|
17
|
+
Classifier: Natural Language :: Portuguese (Brazilian)
|
|
18
|
+
Classifier: Operating System :: MacOS
|
|
19
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
20
|
+
Classifier: Programming Language :: Python :: 3
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
24
|
+
Classifier: Topic :: System :: Clustering
|
|
25
|
+
Classifier: Topic :: System :: Systems Administration
|
|
26
|
+
Requires-Python: >=3.12
|
|
27
|
+
Requires-Dist: alembic<2,>=1.18
|
|
28
|
+
Requires-Dist: fastapi<1,>=0.136
|
|
29
|
+
Requires-Dist: httpx<1,>=0.28
|
|
30
|
+
Requires-Dist: jinja2<4,>=3.1
|
|
31
|
+
Requires-Dist: kubernetes<37,>=36
|
|
32
|
+
Requires-Dist: pydantic-settings<3,>=2.14
|
|
33
|
+
Requires-Dist: pydantic<3,>=2.13
|
|
34
|
+
Requires-Dist: pyyaml<7,>=6.0
|
|
35
|
+
Requires-Dist: sqlalchemy<2.1,>=2.0.50
|
|
36
|
+
Requires-Dist: uvicorn[standard]<1,>=0.49
|
|
37
|
+
Requires-Dist: websockets<17,>=16
|
|
38
|
+
Description-Content-Type: text/markdown
|
|
39
|
+
|
|
40
|
+
# Lensfy
|
|
41
|
+
|
|
42
|
+
**Português** · [English](https://gitlab.com/fabiocax/lensfy/-/blob/main/README.en.md)
|
|
43
|
+
|
|
44
|
+
**Gerenciador local de clusters Kubernetes** — uma alternativa open-source ao Lens/OpenLens que roda inteiramente na sua máquina, sem serviços externos obrigatórios.
|
|
45
|
+
|
|
46
|
+
Multi-cluster, logs e métricas em tempo real, terminal/exec integrado, shell `kubectl`, port-forward, deploy de manifestos/Helm, editor YAML (Monaco) com histórico de versões, e um **assistente de IA** (Claude API) que diagnostica problemas e automatiza operações no cluster — com aprovação.
|
|
47
|
+
|
|
48
|
+
> A interface é um **PWA instalável**, servida pelo próprio backend (FastAPI + Jinja2 + JS/CSS vanilla — sem build step, sem npm). O acesso é restrito à máquina local e protegido por um **token de dispositivo** (sem login/senha).
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## Sumário
|
|
53
|
+
|
|
54
|
+
- [Recursos](#recursos)
|
|
55
|
+
- [Requisitos](#requisitos)
|
|
56
|
+
- [Instalação](#instalação)
|
|
57
|
+
- [Instalador desktop (Linux)](#1-instalador-desktop-linux--recomendado)
|
|
58
|
+
- [Pacote .rpm (Fedora/RHEL)](#2-pacote-rpm-fedorarhel)
|
|
59
|
+
- [A partir do código (desenvolvimento)](#3-a-partir-do-código-desenvolvimento)
|
|
60
|
+
- [Como rodar](#como-rodar)
|
|
61
|
+
- [Segurança](#segurança)
|
|
62
|
+
- [Configuração](#configuração-variáveis-de-ambiente)
|
|
63
|
+
- [Primeiros passos na UI](#primeiros-passos-na-ui)
|
|
64
|
+
- [Testes](#testes)
|
|
65
|
+
- [Estrutura](#estrutura)
|
|
66
|
+
- [Roadmap](#roadmap)
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## Recursos
|
|
71
|
+
|
|
72
|
+
### Multi-cluster
|
|
73
|
+
- **Importar kubeconfig** por caminho, upload de arquivo ou colando o conteúdo — detecção de contextos com checklist (importe vários de uma vez).
|
|
74
|
+
- **Importar do Google Cloud (GKE):** aba **gcloud** lista projetos e clusters e roda `get-credentials` por você (requer `gcloud` + `gke-gcloud-auth-plugin`).
|
|
75
|
+
- **Seletor de clusters** com busca, status/versão por item, troca em um clique, **reordenação por arrastar** e remoção. Importar nunca trava a UI (clusters sobem em segundo plano).
|
|
76
|
+
- **Sessão por cluster:** ao voltar a um cluster, o Lensfy restaura onde você parou — a view, o filtro de namespace e as abas abertas no dock (logs/console/YAML/IA).
|
|
77
|
+
|
|
78
|
+
### Explorer de recursos
|
|
79
|
+
- Árvore com **Pods, Deployments, StatefulSets, DaemonSets, Jobs, CronJobs, Services, Ingress, ConfigMaps, Secrets, PVC, StorageClasses, Namespaces, Nodes, Events, RBAC** (roles/bindings), **LimitRanges** e **ResourceQuotas**.
|
|
80
|
+
- **Tabelas ao vivo** (`/ws/watch`): pods criados/removidos, status e restarts atualizam sozinhos — reconciliação incremental **sem flicker** (seleção e scroll preservados).
|
|
81
|
+
- **Filtro global de namespace** multi-seleção (estilo Lens) e **busca global / command palette** (foco com `/`).
|
|
82
|
+
- **Painel de detalhes (drawer)** por recurso: resumo, metadados, status, containers (estado/restarts/imagens), condições, **métricas ao vivo** (CPU/mem) e eventos.
|
|
83
|
+
|
|
84
|
+
### Observabilidade
|
|
85
|
+
- **Dashboard:** saúde do cluster (nós, versões), fases dos pods, restarts, deployments disponíveis vs desejados, uso de CPU/memória e eventos de alerta.
|
|
86
|
+
- **Métricas:** nós/pods via `metrics.k8s.io`, cards de resumo, colunas ordenáveis e barras coloridas por limiar.
|
|
87
|
+
- **Problemas:** varredura do cluster que lista issues por categoria e severidade (CrashLoop, ImagePull, OOMKilled, pendentes, PVC não vinculado, nós com pressão/cordon, etc.).
|
|
88
|
+
- **Recursos & Cotas:** soma de requests/limits por namespace, `ResourceQuota` usado/limite e containers **sem requests/limits** (risco de OOM/SLA).
|
|
89
|
+
- **Mapa de tráfego:** topologia **Ingress → Service → Workload → Pods** em SVG, com zoom/pan.
|
|
90
|
+
|
|
91
|
+
### Tempo real (terminal, logs, console)
|
|
92
|
+
- **Logs ao vivo:** filtro, auto-scroll, copiar, baixar e seletor de container.
|
|
93
|
+
- **Terminal/console (xterm.js):** `exec` em pod (PTY), **shell de nó** (estilo Lens, via pod privilegiado + `nsenter`) e **shell `kubectl`** com o contexto do cluster.
|
|
94
|
+
- **Dock inferior estilo Lens:** logs, console, YAML e IA em **abas**, várias ao mesmo tempo, painel redimensionável que empurra a view (não sobrepõe).
|
|
95
|
+
|
|
96
|
+
### Editor YAML & deploy
|
|
97
|
+
- **Editor YAML (Monaco)** para ver/editar/aplicar qualquer recurso, com **autocomplete de Kubernetes** e **diff**.
|
|
98
|
+
- **Histórico de versões (até 5)** por recurso, gravado a cada *Aplicar*: carregar uma versão, **diff contra o editor** ou **diff entre duas versões**.
|
|
99
|
+
- **Apply robusto:** realinha o `resourceVersion` ao estado atual e repete em conflito (sem falhas intermitentes de save).
|
|
100
|
+
- **Deploy de manifestos:** editor Monaco com templates, **Construtor** (formulário → YAML), **validação dry-run**, e arrastar-e-soltar de arquivos/pastas YAML (multi-documento).
|
|
101
|
+
|
|
102
|
+
### Operações
|
|
103
|
+
- **Workloads:** escalar, *restart* (rollout), excluir.
|
|
104
|
+
- **Rollout:** histórico de revisões, *undo* (rollback) e *pause/resume*.
|
|
105
|
+
- **Nós:** *cordon/uncordon* e *drain* (respeitando PodDisruptionBudgets via Eviction API).
|
|
106
|
+
- **CronJobs:** *trigger* (executar agora) e *suspend/resume*.
|
|
107
|
+
- **Recursos:** editar requests/limits por container; editar **Secrets/ConfigMaps** in-place.
|
|
108
|
+
- **Port-forward:** túneis para pods, gerenciados na UI.
|
|
109
|
+
- **Helm:** releases, install/upgrade/rollback e uninstall.
|
|
110
|
+
|
|
111
|
+
### Assistente de IA (opcional)
|
|
112
|
+
- Agente SRE sobre a **Claude API**: ferramentas **read-only** (visão geral, listar/ver recursos, logs, top) rodam automaticamente; **ações que alteram o cluster** (escalar/restart/excluir/cordon/drain/rollback/cronjob) exigem **Aprovar/Negar** na UI.
|
|
113
|
+
- Pode ser desligado por completo (`LENSFY_AI_ALLOW_MUTATIONS=false`) e os diagnósticos podem ser **salvos como relatórios**.
|
|
114
|
+
|
|
115
|
+
### Plataforma
|
|
116
|
+
- **Segurança local sem login:** acesso só de *loopback*, *allowlist* de Host (anti DNS-rebinding) e **token de dispositivo**; tela de **onboarding** gera o token na primeira execução.
|
|
117
|
+
- **PWA instalável** com app shell offline.
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
## Requisitos
|
|
122
|
+
|
|
123
|
+
- **Python 3.12+** (testado em 3.14).
|
|
124
|
+
- Um **kubeconfig** com acesso aos seus clusters (`~/.kube/config` ou importado pela UI).
|
|
125
|
+
- Opcionais (cada recurso degrada com aviso quando ausente):
|
|
126
|
+
- `kubectl` — para o shell kubectl do header.
|
|
127
|
+
- `helm` — para a aba Helm.
|
|
128
|
+
- `gcloud` (+ `gke-gcloud-auth-plugin`) — para importar clusters GKE.
|
|
129
|
+
- **metrics-server** no cluster — para gráficos de CPU/memória.
|
|
130
|
+
- Uma **chave da Claude API** (`LENSFY_ANTHROPIC_API_KEY`) — para o assistente de IA.
|
|
131
|
+
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
## Instalação
|
|
135
|
+
|
|
136
|
+
### Via PyPI (`pip` / `pipx`) — mais rápido
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
pipx install lensfy # recomendado: ambiente isolado
|
|
140
|
+
# ou: pip install --user lensfy
|
|
141
|
+
|
|
142
|
+
lensfy # sobe em http://127.0.0.1:8645 e abre o navegador
|
|
143
|
+
lensfy serve --port 9000 --no-browser
|
|
144
|
+
lensfy version
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
Requer Python 3.12+. Os dados ficam em `~/.lensfy/` e a configuração (ex.: `LENSFY_ANTHROPIC_API_KEY`) em `~/.config/lensfy/env` (`KEY=VALUE`, permissão 0600). Para iniciar no login e ter atalho no menu, use o instalador desktop abaixo.
|
|
148
|
+
|
|
149
|
+
### 1. Instalador desktop (Linux)
|
|
150
|
+
|
|
151
|
+
Instala num venv isolado, cria o comando **`lensfy`** e um **atalho no menu de aplicativos** (sem root):
|
|
152
|
+
|
|
153
|
+
```bash
|
|
154
|
+
git clone https://gitlab.com/fabiocax/lensfy.git
|
|
155
|
+
cd lensfy
|
|
156
|
+
./install.sh # instala/atualiza (re-rodar atualiza no lugar)
|
|
157
|
+
./install.sh --service # + serviço systemd --user (inicia no login)
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
Depois:
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
lensfy # inicia (se preciso) e abre no navegador
|
|
164
|
+
lensfy status # estado + health + versão
|
|
165
|
+
lensfy stop # para
|
|
166
|
+
lensfy logs # acompanha o log
|
|
167
|
+
lensfy version # versão instalada
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
Com o serviço systemd instalado (`--service`), `lensfy start|stop|restart|status|logs` delegam para `systemctl --user … lensfy` / `journalctl --user -u lensfy`. Re-rodar `./install.sh` (com ou sem `--service`) atualiza a unit e reinicia o serviço se ele estiver ativo.
|
|
171
|
+
|
|
172
|
+
**Configuração do app instalado:** `~/.config/lensfy/env` (linhas `KEY=VALUE`, permissão `0600`), criado pelo instalador a partir de `backend/.env.example` — é lido pelo launcher e pelo serviço systemd. Ex.: `LENSFY_ANTHROPIC_API_KEY=sk-ant-…`. Depois de editar: `lensfy restart`. O `.env` do repositório **nunca** é copiado para a instalação nem para o `.rpm`.
|
|
173
|
+
|
|
174
|
+
Ou abra **“Lensfy”** no menu de aplicativos. Layout instalado:
|
|
175
|
+
|
|
176
|
+
| Caminho | Conteúdo |
|
|
177
|
+
|---|---|
|
|
178
|
+
| `~/.local/share/lensfy/app` | código + UI |
|
|
179
|
+
| `~/.local/share/lensfy/venv` | dependências (runtime) |
|
|
180
|
+
| `~/.local/share/lensfy/VERSION` | versão instalada (`git describe` + data) |
|
|
181
|
+
| `~/.config/lensfy/env` | configuração `LENSFY_*` (0600) — **preservada** |
|
|
182
|
+
| `~/.config/systemd/user/lensfy.service` | serviço (só com `--service`) |
|
|
183
|
+
| `~/.local/bin/lensfy` | launcher |
|
|
184
|
+
| `~/.local/share/applications/lensfy.desktop` | atalho de menu |
|
|
185
|
+
| `~/.local/state/lensfy/` | pid + log (modo sem systemd; rotação a 10 MB, 0600) |
|
|
186
|
+
| `~/.lensfy/` | dados (SQLite, token) — **preservado** |
|
|
187
|
+
|
|
188
|
+
Desinstalar: `./uninstall.sh` (use `--purge` para apagar também `~/.lensfy` e `~/.config/lensfy`).
|
|
189
|
+
|
|
190
|
+
### 2. Pacote .rpm (Fedora/RHEL)
|
|
191
|
+
|
|
192
|
+
Gera um `.rpm` distribuível, com as dependências embutidas (instalação **offline**):
|
|
193
|
+
|
|
194
|
+
```bash
|
|
195
|
+
sudo dnf install -y rpm-build rpmdevtools python3-pip
|
|
196
|
+
./packaging/rpm/build-rpm.sh # → packaging/rpm/dist/lensfy-<versão>.rpm
|
|
197
|
+
|
|
198
|
+
sudo dnf install packaging/rpm/dist/lensfy-*.rpm
|
|
199
|
+
lensfy # ou pelo menu de aplicativos
|
|
200
|
+
sudo dnf remove lensfy
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
> Os *wheels* embutidos são específicos da plataforma e da versão do Python do host de build (ex.: x86_64 / Python 3.14). Gere o pacote num ambiente compatível com o destino. Ajuste a licença em `packaging/rpm/lensfy.spec` (atualmente um placeholder). A configuração continua por usuário em `~/.config/lensfy/env`.
|
|
204
|
+
|
|
205
|
+
### 3. A partir do código (desenvolvimento)
|
|
206
|
+
|
|
207
|
+
```bash
|
|
208
|
+
git clone https://gitlab.com/fabiocax/lensfy.git
|
|
209
|
+
cd lensfy/backend
|
|
210
|
+
|
|
211
|
+
python3 -m venv .venv
|
|
212
|
+
source .venv/bin/activate
|
|
213
|
+
pip install -r requirements-dev.txt # runtime + ferramentas de teste
|
|
214
|
+
cp .env.example .env # opcional: configuração local (LENSFY_*)
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
> `requirements.txt` tem só as dependências de **runtime** (usado pelo instalador e pelo `.rpm`); `requirements-dev.txt` inclui também pytest & cia.
|
|
218
|
+
>
|
|
219
|
+
> **Python 3.14:** se algum pacote tentar compilar do código-fonte, force *wheels* prontas:
|
|
220
|
+
> `pip install --only-binary=:all: -r requirements-dev.txt`
|
|
221
|
+
|
|
222
|
+
---
|
|
223
|
+
|
|
224
|
+
## Como rodar
|
|
225
|
+
|
|
226
|
+
### Scripts de controle (a partir do código)
|
|
227
|
+
|
|
228
|
+
Na **raiz** do projeto:
|
|
229
|
+
|
|
230
|
+
```bash
|
|
231
|
+
./start.sh # inicia em background → http://127.0.0.1:8645
|
|
232
|
+
./lensfy.sh status # estado + health
|
|
233
|
+
./lensfy.sh logs # acompanha o log
|
|
234
|
+
./lensfy.sh restart # reinicia
|
|
235
|
+
./stop.sh # para (encerra o grupo de processos)
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
### Forma manual (desenvolvimento)
|
|
239
|
+
|
|
240
|
+
```bash
|
|
241
|
+
cd backend
|
|
242
|
+
source .venv/bin/activate
|
|
243
|
+
uvicorn lensfy.main:app --reload --port 8645
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
- App: <http://localhost:8645>
|
|
247
|
+
- Docs da API (Swagger): <http://localhost:8645/docs>
|
|
248
|
+
- Health: <http://localhost:8645/health>
|
|
249
|
+
|
|
250
|
+
Editar arquivos em `backend/lensfy/templates/` ou `backend/lensfy/static/` só exige **atualizar o navegador** (sem rebuild).
|
|
251
|
+
|
|
252
|
+
---
|
|
253
|
+
|
|
254
|
+
## Segurança
|
|
255
|
+
|
|
256
|
+
Lensfy é um app local de **um usuário** e foi pensado para não ser acessível de outras máquinas — **sem login nem senha**. Três camadas, aplicadas a toda requisição HTTP **e** WebSocket:
|
|
257
|
+
|
|
258
|
+
1. **Somente loopback** — conexões fora de `127.0.0.0/8`/`::1` são recusadas (mesmo que o servidor seja exposto por engano).
|
|
259
|
+
2. **Allowlist de `Host`** — bloqueia ataques de *DNS-rebinding* (um site remoto resolvendo seu domínio para `127.0.0.1`).
|
|
260
|
+
3. **Token de dispositivo** — gerado uma vez no equipamento (`~/.lensfy/device_token`, permissão `0600`) e exigido em `/api` e `/ws`. A SPA o obtém em runtime; uma página de outra origem não consegue lê-lo nem forjá-lo (também derrota CSRF). Na **primeira execução**, uma tela de **onboarding** gera o token.
|
|
261
|
+
|
|
262
|
+
| Variável | Default | Efeito |
|
|
263
|
+
|---|---|---|
|
|
264
|
+
| `LENSFY_SECURITY_ENABLED` | `true` | `false` desliga todas as camadas (ambiente confiável/testes). |
|
|
265
|
+
| `LENSFY_ALLOW_REMOTE` | `false` | `true` permite acesso fora do loopback (LAN) — **o token continua valendo**. Use com cuidado. |
|
|
266
|
+
| `LENSFY_ALLOWED_HOSTS` | `[]` | Valores extras aceitos no header `Host` (ex.: o hostname da máquina). |
|
|
267
|
+
|
|
268
|
+
Outras notas:
|
|
269
|
+
- O assistente de IA só executa ações que **alteram** o cluster após **aprovação explícita**; desligue com `LENSFY_AI_ALLOW_MUTATIONS=false`.
|
|
270
|
+
- Trate kubeconfigs importados como **conteúdo confiável** (podem conter credenciais e comandos `exec`).
|
|
271
|
+
- Se você **regenerar/rotacionar** o token, **recarregue as abas abertas** (a UI mostra um aviso "Sessão de dispositivo inválida → Recarregar" quando isso acontece).
|
|
272
|
+
|
|
273
|
+
---
|
|
274
|
+
|
|
275
|
+
## Configuração (variáveis de ambiente)
|
|
276
|
+
|
|
277
|
+
Todas com prefixo `LENSFY_`. Veja `backend/.env.example` (lista comentada de todas). Onde definir:
|
|
278
|
+
|
|
279
|
+
- **App instalado:** `~/.config/lensfy/env` (lido pelo launcher `lensfy` e pelo serviço systemd).
|
|
280
|
+
- **Desenvolvimento:** `backend/.env` (copie de `backend/.env.example`) ou variáveis exportadas no shell.
|
|
281
|
+
|
|
282
|
+
Variáveis do ambiente sempre têm precedência sobre os arquivos.
|
|
283
|
+
|
|
284
|
+
| Variável | Default | Descrição |
|
|
285
|
+
|---|---|---|
|
|
286
|
+
| `LENSFY_HOST` | `127.0.0.1` | Interface de bind. **`0.0.0.0` requer `LENSFY_ALLOW_REMOTE=true` — veja Segurança.** |
|
|
287
|
+
| `LENSFY_PORT` | `8645` | Porta. |
|
|
288
|
+
| `LENSFY_RELOAD` | `0` | `1` para auto-reload (dev). |
|
|
289
|
+
| `LENSFY_DEBUG` | `false` | Cria as tabelas do banco no startup (dispensa migrations no dev). |
|
|
290
|
+
| `LENSFY_DATABASE_URL` | sqlite em `~/.lensfy/lensfy.db` | Override do banco. |
|
|
291
|
+
| `LENSFY_SECURITY_ENABLED` | `true` | Liga/desliga o controle de acesso local. |
|
|
292
|
+
| `LENSFY_ALLOW_REMOTE` | `false` | Permite acesso não-loopback (token continua exigido). |
|
|
293
|
+
| `LENSFY_ALLOWED_HOSTS` | `[]` | Hosts extras aceitos no header `Host`. |
|
|
294
|
+
| `LENSFY_ANTHROPIC_API_KEY` | — | Habilita o assistente de IA (Claude API). |
|
|
295
|
+
| `LENSFY_ANTHROPIC_MODEL` | `claude-sonnet-4-6` | Modelo do assistente. |
|
|
296
|
+
| `LENSFY_AI_ALLOW_MUTATIONS` | `true` | `false` deixa a IA só diagnosticar. |
|
|
297
|
+
|
|
298
|
+
Exemplos:
|
|
299
|
+
|
|
300
|
+
```bash
|
|
301
|
+
LENSFY_PORT=9000 ./start.sh
|
|
302
|
+
LENSFY_ANTHROPIC_API_KEY=sk-ant-... ./start.sh # liga o assistente IA
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
---
|
|
306
|
+
|
|
307
|
+
## Primeiros passos na UI
|
|
308
|
+
|
|
309
|
+
1. **(Primeira execução)** uma tela de **onboarding** gera o token deste equipamento — clique em **“Gerar token e começar”** e depois **“Entrar”**.
|
|
310
|
+
2. **Importar cluster** — no seletor de clusters (topo da sidebar) → **“+ Importar cluster”**:
|
|
311
|
+
- **Caminho / Arquivo / Colar** um kubeconfig, ou
|
|
312
|
+
- **gcloud** → escolher projeto → listar e importar clusters **GKE**.
|
|
313
|
+
3. Navegue pela árvore de recursos (Pods, Deployments, Services, Secrets, etc.).
|
|
314
|
+
4. O **Dashboard** mostra a saúde do cluster; **Problemas**, **Recursos** e **Mapa** ficam no topo.
|
|
315
|
+
5. **Assistente IA** (botão 🤖 no header) — peça um diagnóstico ou uma ação; ações que alteram o cluster pedem **Aprovar/Negar**.
|
|
316
|
+
|
|
317
|
+
### Instalar como app (PWA)
|
|
318
|
+
|
|
319
|
+
No Chrome/Edge, clique no ícone de instalar na barra de endereço (ou no botão **Instalar** do header). Abre em janela própria, com ícone no sistema.
|
|
320
|
+
> Service workers exigem **contexto seguro**: `localhost` (ok) ou **HTTPS**.
|
|
321
|
+
|
|
322
|
+
---
|
|
323
|
+
|
|
324
|
+
## Testes
|
|
325
|
+
|
|
326
|
+
```bash
|
|
327
|
+
cd backend
|
|
328
|
+
source .venv/bin/activate
|
|
329
|
+
pytest # suíte completa
|
|
330
|
+
pytest --cov # com cobertura
|
|
331
|
+
pytest tests/test_ai.py # um arquivo específico
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
---
|
|
335
|
+
|
|
336
|
+
## Estrutura
|
|
337
|
+
|
|
338
|
+
```
|
|
339
|
+
lensfy/
|
|
340
|
+
├── lensfy.sh, start.sh, stop.sh # controle da aplicação (modo dev)
|
|
341
|
+
├── install.sh, uninstall.sh # instalador desktop (Linux, por usuário)
|
|
342
|
+
├── packaging/
|
|
343
|
+
│ ├── lensfy # launcher instalado
|
|
344
|
+
│ └── rpm/ # spec + build-rpm.sh (pacote .rpm)
|
|
345
|
+
├── PROJECT.md # especificação (pt-BR)
|
|
346
|
+
├── CLAUDE.md # guia de arquitetura p/ contribuir
|
|
347
|
+
├── pyproject.toml # metadados do pacote PyPI (hatchling)
|
|
348
|
+
└── backend/
|
|
349
|
+
├── lensfy/ # pacote Python publicado no PyPI
|
|
350
|
+
│ ├── api/ # rotas REST (/api)
|
|
351
|
+
│ ├── websocket/ # canais em tempo real (/ws): logs, terminal, watch, events, metrics, ai, kubectl
|
|
352
|
+
│ ├── services/ # regras de negócio
|
|
353
|
+
│ ├── repositories/ # acesso a dados
|
|
354
|
+
│ ├── models/ # SQLAlchemy
|
|
355
|
+
│ ├── kubernetes/ # integração com o SDK do Kubernetes, helm, gcloud
|
|
356
|
+
│ ├── ai/ # assistente de IA (Claude API)
|
|
357
|
+
│ ├── core/ # config + segurança (token de dispositivo)
|
|
358
|
+
│ ├── web/ # serve a UI (Jinja2) + PWA
|
|
359
|
+
│ ├── cli.py # comando `lensfy`
|
|
360
|
+
│ ├── migrations/ # Alembic
|
|
361
|
+
│ ├── templates/ # index.html (app shell)
|
|
362
|
+
│ └── static/ # css/, js/, icons/, manifest.webmanifest, sw.js
|
|
363
|
+
├── tests/
|
|
364
|
+
└── requirements.txt, requirements-dev.txt # runtime / dev+testes
|
|
365
|
+
```
|
|
366
|
+
|
|
367
|
+
Arquitetura em camadas: `api/` → `services/` → `repositories/` → `models/`. Persistência local em SQLite (migrations via Alembic). Detalhes em [`CLAUDE.md`](https://gitlab.com/fabiocax/lensfy/-/blob/main/CLAUDE.md) e a especificação em [`PROJECT.md`](https://gitlab.com/fabiocax/lensfy/-/blob/main/PROJECT.md).
|
|
368
|
+
|
|
369
|
+
---
|
|
370
|
+
|
|
371
|
+
## Roadmap
|
|
372
|
+
|
|
373
|
+
- Empacotamento **`.deb` / AppImage** e wrapper **desktop nativo** (Tauri) para Linux/Windows/macOS.
|
|
374
|
+
- Rotação de token pela UI.
|
|
375
|
+
- Testes E2E (Playwright).
|
|
376
|
+
|
|
377
|
+
---
|
|
378
|
+
|
|
379
|
+
## Publicando uma versão (PyPI)
|
|
380
|
+
|
|
381
|
+
A publicação é feita pelo CI do GitLab com **Trusted Publishing** (OIDC — nenhum token do PyPI fica guardado):
|
|
382
|
+
|
|
383
|
+
1. Atualize `__version__` em `backend/lensfy/__init__.py` (ex.: `0.2.0`).
|
|
384
|
+
2. Faça commit e crie a tag correspondente: `git tag v0.2.0 && git push --tags`.
|
|
385
|
+
3. O pipeline roda lint + testes, gera sdist/wheel (`python -m build`, `twine check`) e o job `publish:pypi` envia ao PyPI. Ele falha se a tag não bater com `__version__`.
|
|
386
|
+
|
|
387
|
+
Configuração única no pypi.org (*Your account → Publishing → Add a new pending publisher → GitLab*): projeto `lensfy`, namespace `fabiocax`, projeto `lensfy`, arquivo `.gitlab-ci.yml`, ambiente `pypi`.
|
|
388
|
+
|
|
389
|
+
Build local para conferir: `python -m build && twine check dist/*`.
|
|
390
|
+
|
|
391
|
+
---
|
|
392
|
+
|
|
393
|
+
## Licença
|
|
394
|
+
|
|
395
|
+
[Apache License 2.0](https://gitlab.com/fabiocax/lensfy/-/blob/main/LICENSE).
|