pristy-support 1.0.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,45 @@
1
+ GNU AFFERO GENERAL PUBLIC LICENSE
2
+ Version 3, 19 November 2007
3
+
4
+ Copyright (C) 2025 JECI SARL
5
+
6
+ This program is free software: you can redistribute it and/or modify
7
+ it under the terms of the GNU Affero General Public License as published by
8
+ the Free Software Foundation, either version 3 of the License, or
9
+ (at your option) any later version.
10
+
11
+ This program is distributed in the hope that it will be useful,
12
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ GNU Affero General Public License for more details.
15
+
16
+ You should have received a copy of the GNU Affero General Public License
17
+ along with this program. If not, see <https://www.gnu.org/licenses/>.
18
+
19
+ ================================================================================
20
+
21
+ For the full text of the GNU Affero General Public License version 3,
22
+ please visit: https://www.gnu.org/licenses/agpl-3.0.txt
23
+
24
+ ================================================================================
25
+
26
+ ADDITIONAL INFORMATION
27
+
28
+ This software is part of the Pristy project, an open-source Enterprise
29
+ Content Management (ECM) suite built on Alfresco Community Edition.
30
+
31
+ Project Website: https://www.jeci.fr
32
+ Contact: contact@jeci.fr
33
+
34
+ The AGPL-3.0 license ensures that:
35
+
36
+ 1. You can use this software freely for any purpose
37
+ 2. You can study and modify the source code
38
+ 3. You can distribute copies of the software
39
+ 4. You can distribute modified versions of the software
40
+ 5. If you run a modified version on a server and let others interact with it,
41
+ you must make your modified source code available to those users
42
+
43
+ This license is designed to ensure that improvements to the software remain
44
+ free and open source, even when the software is used to provide services
45
+ over a network.
@@ -0,0 +1,504 @@
1
+ Metadata-Version: 2.3
2
+ Name: pristy-support
3
+ Version: 1.0.0
4
+ Summary: Audit and support tools for Pristy ECM installations
5
+ License: AGPL-3.0-or-later
6
+ Keywords: pristy,alfresco,audit,support,monitoring
7
+ Author: Jérémie Lesage
8
+ Author-email: jeremie.lesage@jeci.fr
9
+ Maintainer: Jérémie Lesage
10
+ Maintainer-email: jeremie.lesage@jeci.fr
11
+ Requires-Python: >=3.9
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Environment :: Console
14
+ Classifier: Intended Audience :: System Administrators
15
+ Classifier: License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)
16
+ Classifier: Operating System :: POSIX :: Linux
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.9
19
+ Classifier: Programming Language :: Python :: 3.10
20
+ Classifier: Programming Language :: Python :: 3.11
21
+ Classifier: Programming Language :: Python :: 3.12
22
+ Classifier: Programming Language :: Python :: 3.13
23
+ Classifier: Topic :: System :: Systems Administration
24
+ Provides-Extra: dev
25
+ Requires-Dist: black (>=23.0) ; extra == "dev"
26
+ Requires-Dist: click (>=8.0)
27
+ Requires-Dist: docker (>=6.0.0)
28
+ Requires-Dist: flake8 (>=6.0) ; extra == "dev"
29
+ Requires-Dist: jinja2 (>=3.0)
30
+ Requires-Dist: mypy (>=1.0) ; extra == "dev"
31
+ Requires-Dist: psutil (>=5.9.0)
32
+ Requires-Dist: pytest (>=7.0) ; extra == "dev"
33
+ Requires-Dist: pytest-cov (>=4.0) ; extra == "dev"
34
+ Requires-Dist: python-dateutil (>=2.8.0)
35
+ Requires-Dist: pyyaml (>=6.0)
36
+ Requires-Dist: tabulate (>=0.9.0)
37
+ Project-URL: Bug Tracker, https://gitlab.com/pristy-oss/pristy-support/issues
38
+ Project-URL: Documentation, https://gitlab.com/pristy-oss/pristy-support/blob/main/README.md
39
+ Project-URL: Homepage, https://gitlab.com/pristy-oss/pristy-support
40
+ Project-URL: Repository, https://gitlab.com/pristy-oss/pristy-support.git
41
+ Description-Content-Type: text/markdown
42
+
43
+ # Pristy Support
44
+
45
+ Audit and support tools for Pristy ECM installations.
46
+
47
+ ## Overview
48
+
49
+ Pristy Support is a command-line tool designed to help support teams diagnose and audit Pristy installations. It performs comprehensive checks on system resources, services, logs, database statistics, and configuration files, generating detailed reports in multiple formats.
50
+
51
+ ## Features
52
+
53
+ ### System Checks
54
+ - ✅ Systemd services status (enabled/active)
55
+ - ✅ Docker containers health
56
+ - ✅ Memory configuration and limits validation
57
+ - ✅ Swap presence and size
58
+ - ✅ Firewall status detection
59
+ - ✅ Disk space monitoring
60
+ - ✅ System load analysis
61
+
62
+ ### Logs Analysis
63
+ - 🔍 Journalctl log analysis for all Pristy services
64
+ - 🔍 Error and warning detection
65
+ - 🔍 Log severity aggregation
66
+ - 🔍 Common error pattern extraction
67
+
68
+ ### Database Statistics
69
+ - 📊 Node, property, and aspect counts
70
+ - 📊 User and group statistics
71
+ - 📊 Content statistics
72
+ - 📊 Database and table sizes
73
+ - 📊 Useful ratios (properties/node, aspects/node)
74
+
75
+ ### Configuration Review
76
+ - 📄 Alfresco global.properties analysis
77
+ - 📄 Pristy Vue.js application configurations
78
+ - 📄 Key parameter extraction
79
+ - 📄 Configuration issue detection
80
+
81
+ ### Export Formats
82
+ - 📝 **Markdown**: Clean text reports
83
+ - 🌐 **HTML**: Styled, navigable reports
84
+ - 📦 **ZIP**: Complete archives with all data and reports
85
+
86
+ ## Installation
87
+
88
+ ### From Source
89
+
90
+ * with uv
91
+
92
+ ```bash
93
+ cd pristy-support
94
+ uv venv
95
+ uv pip install .
96
+ ```
97
+
98
+ * without uv
99
+
100
+
101
+ ```bash
102
+ cd pristy-support
103
+
104
+ python3 -m venv .venv
105
+ source .venv/bin/activate
106
+ pip install .
107
+ ```
108
+
109
+ ### For Development
110
+
111
+ ```bash
112
+ cd pristy-support
113
+ pip install -e .
114
+ ```
115
+
116
+ ### For Client Deployment
117
+
118
+ Once published to a package index:
119
+
120
+ ```bash
121
+ pip install pristy-support
122
+ ```
123
+
124
+ ## Configuration
125
+
126
+ Pristy Support can be customized via YAML configuration files. The tool looks for configuration in these locations (in order of priority):
127
+ 1. Custom path specified with `--config` option
128
+ 2. `./pristy-support.yml` (current directory)
129
+ 3. `./.pristy-support.yml` (current directory, hidden)
130
+ 4. `~/.pristy-support.yml` (user home directory)
131
+ 5. `~/.config/pristy-support/config.yml` (XDG config directory)
132
+ 6. `/etc/pristy/pristy-support.yml` (system-wide configuration)
133
+
134
+ ### Generate Default Configuration
135
+
136
+ Create a configuration file with all default values:
137
+
138
+ ```bash
139
+ pristy-support init-config
140
+ ```
141
+
142
+ This creates `pristy-support.yml` in the current directory. You can specify a custom output path:
143
+
144
+ ```bash
145
+ pristy-support init-config --output /path/to/config.yml
146
+ ```
147
+
148
+ ### Configuration Options
149
+
150
+ The configuration file allows you to customize:
151
+ - **System**: Services to check, memory thresholds, disk space thresholds
152
+ - **Docker**: Container name patterns to monitor
153
+ - **Logs**: Services to analyze, time periods, severity keywords, max samples per severity
154
+ - **Database**: PostgreSQL connection parameters
155
+ - **Config Paths**: Paths for Alfresco and Pristy application configurations
156
+ - **Audit**: Default export formats and output directory
157
+
158
+ Example configuration snippet:
159
+
160
+ ```yaml
161
+ system:
162
+ services:
163
+ - postgres
164
+ - kafka
165
+ - alfresco
166
+ memory:
167
+ min_ram_gb: 8
168
+ recommended_ram_gb: 12
169
+ min_swap_gb: 2
170
+ disk_thresholds:
171
+ /: 10
172
+ /var/lib/docker: 30
173
+
174
+ logs:
175
+ services:
176
+ - alfresco
177
+ - solr6
178
+ default_since: 7d
179
+ max_samples_per_severity: 10
180
+ severity_keywords:
181
+ critical: [CRITICAL, FATAL]
182
+ error: [ERROR]
183
+ warning: [WARN, WARNING]
184
+ ```
185
+
186
+ ### Using Custom Configuration
187
+
188
+ ```bash
189
+ pristy-support --config /path/to/config.yml audit
190
+ ```
191
+
192
+ ## Usage
193
+
194
+ ### Full Audit
195
+
196
+ Run a complete audit of your Pristy installation:
197
+
198
+ ```bash
199
+ pristy-support audit
200
+ ```
201
+
202
+ This will generate reports in the current directory in all formats (Markdown, HTML, and ZIP).
203
+
204
+ #### Options
205
+
206
+ ```bash
207
+ pristy-support audit --output-dir /path/to/output --formats md,html,zip --since 30d
208
+ ```
209
+
210
+ - `--output-dir`, `-o`: Output directory for reports (default: current directory)
211
+ - `--formats`, `-f`: Export formats, comma-separated (default: `md,html,zip`)
212
+ - `--since`, `-s`: Time period for log analysis (default: `7d`)
213
+
214
+ Examples:
215
+ - `--since 24h`: Last 24 hours
216
+ - `--since 7d`: Last 7 days (default)
217
+ - `--since 30d`: Last 30 days
218
+
219
+ ### Individual Checks
220
+
221
+ Run specific checks independently:
222
+
223
+ #### System Checks Only
224
+
225
+ ```bash
226
+ pristy-support system-check
227
+ ```
228
+
229
+ #### Logs Analysis Only
230
+
231
+ ```bash
232
+ pristy-support logs-check --since 7d
233
+ ```
234
+
235
+ #### Database Statistics Only
236
+
237
+ ```bash
238
+ pristy-support database-check
239
+ ```
240
+
241
+ #### Configuration Review Only
242
+
243
+ ```bash
244
+ pristy-support config-check
245
+ ```
246
+
247
+ ### Version
248
+
249
+ ```bash
250
+ pristy-support --version
251
+ ```
252
+
253
+ ### Help
254
+
255
+ ```bash
256
+ pristy-support --help
257
+ pristy-support audit --help
258
+ ```
259
+
260
+ ### Debug Mode
261
+
262
+ Enable debug mode to see all commands executed by the tool:
263
+
264
+ ```bash
265
+ pristy-support --debug audit
266
+ ```
267
+
268
+ Debug mode displays:
269
+ - All system commands before execution (systemctl, journalctl, docker, etc.)
270
+ - Command results (success/failure with exit codes)
271
+ - Docker exec operations with container names
272
+ - File read/write operations
273
+
274
+ Example output:
275
+ ```
276
+ DEBUG [pristy_support] 🔧 Checking systemctl availability
277
+ DEBUG [pristy_support] $ systemctl --version
278
+ DEBUG [pristy_support] ✓ Command succeeded (exit code: 0)
279
+ DEBUG [pristy_support] 🔧 Listing Docker containers
280
+ DEBUG [pristy_support] $ docker ps --format {{.ID}}|{{.Names}}|{{.Status}}|{{.Image}} -a
281
+ DEBUG [pristy_support] ✓ Command succeeded (exit code: 0)
282
+ DEBUG [pristy_support] 🐳 Executing in container 'postgres':
283
+ DEBUG [pristy_support] $ psql -U alfresco -d alfresco -t -A -c SELECT COUNT(*) FROM alf_node;
284
+ ```
285
+
286
+ This is useful for:
287
+ - Troubleshooting issues
288
+ - Understanding what the tool is doing
289
+ - Debugging permission problems
290
+ - Support and diagnostics
291
+
292
+ ## Requirements
293
+
294
+ ### System Requirements
295
+
296
+ - Python 3.9 or higher
297
+ - Linux operating system (systemd-based)
298
+ - Docker (for container checks and PostgreSQL access)
299
+
300
+ ### Permissions
301
+
302
+ The tool automatically detects available permissions and adapts its checks accordingly:
303
+
304
+ - **Root/sudo**: Full access to all checks
305
+ - **Docker group**: Access to Docker commands
306
+ - **Standard user**: Limited checks (may miss some system information)
307
+
308
+ For best results, run with sudo or as root:
309
+
310
+ ```bash
311
+ sudo pristy-support audit
312
+ ```
313
+
314
+ ### Pristy Installation
315
+
316
+ The tool expects a standard Pristy installation with:
317
+
318
+ - Systemd services for Pristy components
319
+ - Docker containers running Pristy services
320
+ - PostgreSQL database in a Docker container named `postgres`
321
+ - Configuration files in standard locations:
322
+ - `/opt/alfresco/tomcat/shared/classes/alfresco-global.properties`
323
+ - `/opt/pristy-*/public/env-config.json`
324
+
325
+ ## Architecture
326
+
327
+ ### Project Structure
328
+
329
+ ```
330
+ pristy-support/
331
+ ├── pristy_support/
332
+ │ ├── __init__.py
333
+ │ ├── __main__.py # Entry point for python -m pristy_support
334
+ │ ├── cli.py # CLI interface (Click)
335
+ │ ├── modules/ # Audit modules
336
+ │ │ ├── system.py # System checks
337
+ │ │ ├── logs.py # Log analysis
338
+ │ │ ├── database.py # Database statistics
339
+ │ │ └── config.py # Configuration review
340
+ │ ├── exporters/ # Report exporters
341
+ │ │ ├── markdown.py # Markdown exporter
342
+ │ │ ├── html.py # HTML exporter
343
+ │ │ └── zip_exporter.py # ZIP archive exporter
344
+ │ ├── utils/ # Utilities
345
+ │ │ ├── permissions.py # Permission detection
346
+ │ │ ├── docker_utils.py # Docker utilities
347
+ │ │ └── logger.py # Debug logging
348
+ │ └── templates/ # HTML templates
349
+ │ └── report.html.j2
350
+ ├── tests/ # Unit tests
351
+ ├── setup.py # Package setup
352
+ ├── pyproject.toml # Modern packaging metadata
353
+ ├── requirements.txt # Dependencies
354
+ ├── README.md # This file
355
+ └── LICENSE # AGPL-3.0 license
356
+
357
+ ```
358
+
359
+ ### Modules
360
+
361
+ #### System Module (`system.py`)
362
+ Checks system resources and services:
363
+ - Systemd service status
364
+ - Docker container health
365
+ - Memory and swap configuration
366
+ - Disk space availability
367
+ - System load
368
+
369
+ #### Logs Module (`logs.py`)
370
+ Analyzes system logs via journalctl:
371
+ - Searches for ERROR, WARN, FATAL keywords
372
+ - Aggregates by service and severity
373
+ - Extracts common error patterns
374
+
375
+ #### Database Module (`database.py`)
376
+ Collects PostgreSQL statistics:
377
+ - Executes queries via `docker exec` on postgres container
378
+ - Counts nodes, properties, aspects, users, groups
379
+ - Calculates useful ratios
380
+ - Reports database and table sizes
381
+
382
+ #### Config Module (`config.py`)
383
+ Reviews configuration files:
384
+ - Parses alfresco-global.properties
385
+ - Reads Vue.js env-config.json files
386
+ - Validates key parameters
387
+ - Detects configuration issues
388
+
389
+ ### Exporters
390
+
391
+ #### Markdown Exporter
392
+ Generates clean, readable text reports with tables.
393
+
394
+ #### HTML Exporter
395
+ Creates styled HTML reports with:
396
+ - Responsive layout
397
+ - Color-coded status badges
398
+ - Sortable tables
399
+ - Metrics cards
400
+
401
+ #### ZIP Exporter
402
+ Bundles all reports and raw data:
403
+ - Markdown report
404
+ - HTML report
405
+ - Raw JSON data
406
+ - Individual module data files
407
+
408
+ ## Development
409
+
410
+ ### Setup Development Environment
411
+
412
+ ```bash
413
+ git clone https://gitlab.com/pristy-oss/pristy-support.git
414
+ cd pristy-support
415
+ pip install -e ".[dev]"
416
+ ```
417
+
418
+ ### Run Tests
419
+
420
+ ```bash
421
+ pytest
422
+ ```
423
+
424
+ ### Code Formatting
425
+
426
+ ```bash
427
+ black pristy_support/
428
+ ```
429
+
430
+ ### Type Checking
431
+
432
+ ```bash
433
+ mypy pristy_support/
434
+ ```
435
+
436
+ ## Contributing
437
+
438
+ Contributions are welcome! Please follow these guidelines:
439
+
440
+ 1. Fork the repository
441
+ 2. Create a feature branch (`git checkout -b feature/amazing-feature`)
442
+ 3. Commit your changes using conventional commits
443
+ 4. Push to the branch (`git push origin feature/amazing-feature`)
444
+ 5. Open a Pull Request
445
+
446
+ ### Code Style
447
+
448
+ - Follow PEP 8 guidelines
449
+ - Use Black for code formatting (line length: 100)
450
+ - Add type hints where possible
451
+ - Write docstrings for all functions and classes
452
+ - All code comments in English
453
+
454
+ ### Commit Messages
455
+
456
+ Use conventional commits format:
457
+ - `feat(module): add new feature`
458
+ - `fix(logs): correct error detection`
459
+ - `docs(readme): update installation instructions`
460
+ - `refactor(system): improve memory check logic`
461
+
462
+ ## License
463
+
464
+ This project is licensed under the GNU Affero General Public License v3.0 or later (AGPL-3.0-or-later).
465
+
466
+ See [LICENSE](LICENSE) file for details.
467
+
468
+ ## Authors
469
+
470
+ - **JECI SARL** - [https://www.jeci.fr](https://jeci.fr/en/)
471
+ - **PRISTY** - [https://www.pristy.fr](https://pristy.fr/en)
472
+
473
+ ## Support
474
+
475
+ For issues, questions, or contributions:
476
+ - GitHub Issues: [https://gitlab.com/pristy-oss/pristy-support/-/issues)
477
+
478
+ ## Changelog
479
+
480
+ ### Version 1.0.0 (2025-01-XX)
481
+
482
+ Initial release:
483
+ - System checks (services, containers, memory, disk, load)
484
+ - Logs analysis with error detection
485
+ - Database statistics collection
486
+ - Configuration review
487
+ - Multiple export formats (Markdown, HTML, ZIP)
488
+ - Automatic permission detection
489
+ - CLI interface with Click
490
+ - Debug mode with command tracing
491
+ - YAML configuration system with customizable parameters
492
+ - `init-config` command to generate default configuration
493
+
494
+ ## Roadmap
495
+
496
+ Future enhancements:
497
+ - [ ] Interactive mode for detailed investigation
498
+ - [ ] Automated issue remediation suggestions
499
+ - [ ] Integration with monitoring systems (Prometheus, Grafana)
500
+ - [ ] Performance benchmarking
501
+ - [ ] Historical trend analysis
502
+ - [ ] Multi-server support for clustered installations
503
+ - [ ] Email report delivery
504
+ - [ ] Scheduled audit execution