sum-cli 3.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.
Files changed (106) hide show
  1. sum_cli-3.0.0/LICENSE +29 -0
  2. sum_cli-3.0.0/MANIFEST.in +4 -0
  3. sum_cli-3.0.0/PKG-INFO +127 -0
  4. sum_cli-3.0.0/README.md +99 -0
  5. sum_cli-3.0.0/pyproject.toml +60 -0
  6. sum_cli-3.0.0/setup.cfg +4 -0
  7. sum_cli-3.0.0/sum/__init__.py +1 -0
  8. sum_cli-3.0.0/sum/boilerplate/.env.example +124 -0
  9. sum_cli-3.0.0/sum/boilerplate/.gitea/workflows/ci.yml +33 -0
  10. sum_cli-3.0.0/sum/boilerplate/.gitea/workflows/deploy-production.yml +98 -0
  11. sum_cli-3.0.0/sum/boilerplate/.gitea/workflows/deploy-staging.yml +113 -0
  12. sum_cli-3.0.0/sum/boilerplate/.github/workflows/ci.yml +36 -0
  13. sum_cli-3.0.0/sum/boilerplate/.github/workflows/deploy-production.yml +102 -0
  14. sum_cli-3.0.0/sum/boilerplate/.github/workflows/deploy-staging.yml +115 -0
  15. sum_cli-3.0.0/sum/boilerplate/.gitignore +45 -0
  16. sum_cli-3.0.0/sum/boilerplate/README.md +259 -0
  17. sum_cli-3.0.0/sum/boilerplate/manage.py +34 -0
  18. sum_cli-3.0.0/sum/boilerplate/project_name/__init__.py +5 -0
  19. sum_cli-3.0.0/sum/boilerplate/project_name/home/__init__.py +5 -0
  20. sum_cli-3.0.0/sum/boilerplate/project_name/home/apps.py +20 -0
  21. sum_cli-3.0.0/sum/boilerplate/project_name/home/management/__init__.py +0 -0
  22. sum_cli-3.0.0/sum/boilerplate/project_name/home/management/commands/__init__.py +0 -0
  23. sum_cli-3.0.0/sum/boilerplate/project_name/home/management/commands/populate_demo_content.py +644 -0
  24. sum_cli-3.0.0/sum/boilerplate/project_name/home/management/commands/seed.py +129 -0
  25. sum_cli-3.0.0/sum/boilerplate/project_name/home/management/commands/seed_showroom.py +1661 -0
  26. sum_cli-3.0.0/sum/boilerplate/project_name/home/migrations/__init__.py +3 -0
  27. sum_cli-3.0.0/sum/boilerplate/project_name/home/models.py +13 -0
  28. sum_cli-3.0.0/sum/boilerplate/project_name/settings/__init__.py +5 -0
  29. sum_cli-3.0.0/sum/boilerplate/project_name/settings/base.py +348 -0
  30. sum_cli-3.0.0/sum/boilerplate/project_name/settings/local.py +78 -0
  31. sum_cli-3.0.0/sum/boilerplate/project_name/settings/production.py +106 -0
  32. sum_cli-3.0.0/sum/boilerplate/project_name/urls.py +33 -0
  33. sum_cli-3.0.0/sum/boilerplate/project_name/wsgi.py +16 -0
  34. sum_cli-3.0.0/sum/boilerplate/pytest.ini +5 -0
  35. sum_cli-3.0.0/sum/boilerplate/requirements.txt +25 -0
  36. sum_cli-3.0.0/sum/boilerplate/static/client/.gitkeep +3 -0
  37. sum_cli-3.0.0/sum/boilerplate/templates/overrides/.gitkeep +3 -0
  38. sum_cli-3.0.0/sum/boilerplate/tests/__init__.py +3 -0
  39. sum_cli-3.0.0/sum/boilerplate/tests/test_health.py +51 -0
  40. sum_cli-3.0.0/sum/cli.py +42 -0
  41. sum_cli-3.0.0/sum/commands/__init__.py +10 -0
  42. sum_cli-3.0.0/sum/commands/backup.py +308 -0
  43. sum_cli-3.0.0/sum/commands/check.py +128 -0
  44. sum_cli-3.0.0/sum/commands/init.py +265 -0
  45. sum_cli-3.0.0/sum/commands/promote.py +758 -0
  46. sum_cli-3.0.0/sum/commands/run.py +96 -0
  47. sum_cli-3.0.0/sum/commands/themes.py +56 -0
  48. sum_cli-3.0.0/sum/commands/update.py +301 -0
  49. sum_cli-3.0.0/sum/config.py +61 -0
  50. sum_cli-3.0.0/sum/docs/USER_GUIDE.md +663 -0
  51. sum_cli-3.0.0/sum/exceptions.py +45 -0
  52. sum_cli-3.0.0/sum/setup/__init__.py +17 -0
  53. sum_cli-3.0.0/sum/setup/auth.py +184 -0
  54. sum_cli-3.0.0/sum/setup/database.py +58 -0
  55. sum_cli-3.0.0/sum/setup/deps.py +73 -0
  56. sum_cli-3.0.0/sum/setup/git_ops.py +463 -0
  57. sum_cli-3.0.0/sum/setup/infrastructure.py +576 -0
  58. sum_cli-3.0.0/sum/setup/orchestrator.py +354 -0
  59. sum_cli-3.0.0/sum/setup/remote_themes.py +371 -0
  60. sum_cli-3.0.0/sum/setup/scaffold.py +500 -0
  61. sum_cli-3.0.0/sum/setup/seed.py +110 -0
  62. sum_cli-3.0.0/sum/setup/site_orchestrator.py +441 -0
  63. sum_cli-3.0.0/sum/setup/venv.py +89 -0
  64. sum_cli-3.0.0/sum/system_config.py +330 -0
  65. sum_cli-3.0.0/sum/themes_registry.py +180 -0
  66. sum_cli-3.0.0/sum/utils/__init__.py +25 -0
  67. sum_cli-3.0.0/sum/utils/django.py +97 -0
  68. sum_cli-3.0.0/sum/utils/environment.py +76 -0
  69. sum_cli-3.0.0/sum/utils/output.py +78 -0
  70. sum_cli-3.0.0/sum/utils/project.py +110 -0
  71. sum_cli-3.0.0/sum/utils/prompts.py +36 -0
  72. sum_cli-3.0.0/sum/utils/validation.py +313 -0
  73. sum_cli-3.0.0/sum_cli.egg-info/PKG-INFO +127 -0
  74. sum_cli-3.0.0/sum_cli.egg-info/SOURCES.txt +104 -0
  75. sum_cli-3.0.0/sum_cli.egg-info/dependency_links.txt +1 -0
  76. sum_cli-3.0.0/sum_cli.egg-info/entry_points.txt +2 -0
  77. sum_cli-3.0.0/sum_cli.egg-info/requires.txt +5 -0
  78. sum_cli-3.0.0/sum_cli.egg-info/top_level.txt +2 -0
  79. sum_cli-3.0.0/tests/test_auth.py +459 -0
  80. sum_cli-3.0.0/tests/test_check.py +106 -0
  81. sum_cli-3.0.0/tests/test_cli_entrypoint.py +262 -0
  82. sum_cli-3.0.0/tests/test_cli_init_and_check.py +111 -0
  83. sum_cli-3.0.0/tests/test_cli_safety.py +39 -0
  84. sum_cli-3.0.0/tests/test_command_config_errors.py +276 -0
  85. sum_cli-3.0.0/tests/test_config.py +36 -0
  86. sum_cli-3.0.0/tests/test_database.py +148 -0
  87. sum_cli-3.0.0/tests/test_deps.py +134 -0
  88. sum_cli-3.0.0/tests/test_django.py +107 -0
  89. sum_cli-3.0.0/tests/test_e2e_production.py +634 -0
  90. sum_cli-3.0.0/tests/test_environment.py +99 -0
  91. sum_cli-3.0.0/tests/test_exceptions.py +21 -0
  92. sum_cli-3.0.0/tests/test_git_ops.py +219 -0
  93. sum_cli-3.0.0/tests/test_init.py +345 -0
  94. sum_cli-3.0.0/tests/test_orchestrator.py +455 -0
  95. sum_cli-3.0.0/tests/test_orchestrator_seed_site.py +130 -0
  96. sum_cli-3.0.0/tests/test_output.py +90 -0
  97. sum_cli-3.0.0/tests/test_prompts.py +88 -0
  98. sum_cli-3.0.0/tests/test_remote_themes.py +415 -0
  99. sum_cli-3.0.0/tests/test_run.py +91 -0
  100. sum_cli-3.0.0/tests/test_scaffold.py +523 -0
  101. sum_cli-3.0.0/tests/test_seed.py +281 -0
  102. sum_cli-3.0.0/tests/test_system_config.py +313 -0
  103. sum_cli-3.0.0/tests/test_theme_init.py +26 -0
  104. sum_cli-3.0.0/tests/test_themes_command.py +38 -0
  105. sum_cli-3.0.0/tests/test_validation.py +116 -0
  106. sum_cli-3.0.0/tests/test_venv.py +103 -0
sum_cli-3.0.0/LICENSE ADDED
@@ -0,0 +1,29 @@
1
+ BSD 3-Clause License
2
+
3
+ Copyright (c) 2025, Mark Ashton
4
+ All rights reserved.
5
+
6
+ Redistribution and use in source and binary forms, with or without
7
+ modification, are permitted provided that the following conditions are met:
8
+
9
+ 1. Redistributions of source code must retain the above copyright notice, this
10
+ list of conditions and the following disclaimer.
11
+
12
+ 2. Redistributions in binary form must reproduce the above copyright notice,
13
+ this list of conditions and the following disclaimer in the documentation
14
+ and/or other materials provided with the distribution.
15
+
16
+ 3. Neither the name of the copyright holder nor the names of its
17
+ contributors may be used to endorse or promote products derived from
18
+ this software without specific prior written permission.
19
+
20
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,4 @@
1
+ include LICENSE
2
+ include README.md
3
+ recursive-include sum/boilerplate *
4
+ recursive-exclude sum/boilerplate __pycache__ *.pyc
sum_cli-3.0.0/PKG-INFO ADDED
@@ -0,0 +1,127 @@
1
+ Metadata-Version: 2.4
2
+ Name: sum-cli
3
+ Version: 3.0.0
4
+ Summary: SUM Platform CLI: single control plane for site lifecycle management
5
+ Author: Mark Ashton
6
+ License-Expression: BSD-3-Clause
7
+ Project-URL: Homepage, https://github.com/markashton480/sum-platform
8
+ Project-URL: Repository, https://github.com/markashton480/sum-platform
9
+ Project-URL: Issues, https://github.com/markashton480/sum-platform/issues
10
+ Project-URL: Documentation, https://github.com/markashton480/sum-platform/tree/main/docs/dev/cli.md
11
+ Keywords: sum,cli,django,wagtail
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Environment :: Console
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3 :: Only
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Topic :: Software Development :: Build Tools
19
+ Classifier: Topic :: Software Development :: Code Generators
20
+ Requires-Python: >=3.12
21
+ Description-Content-Type: text/markdown
22
+ License-File: LICENSE
23
+ Requires-Dist: click>=8.1.7
24
+ Requires-Dist: pyyaml>=6.0
25
+ Provides-Extra: gitea
26
+ Requires-Dist: httpx>=0.27.0; extra == "gitea"
27
+ Dynamic: license-file
28
+
29
+ # SUM CLI (v3)
30
+
31
+ [![PyPI](https://img.shields.io/pypi/v/sum-cli.svg)](https://pypi.org/project/sum-cli/)
32
+
33
+ The SUM CLI is the single control plane for deploying and managing SUM Platform client sites.
34
+
35
+ ## Install
36
+
37
+ ```bash
38
+ pip install sum-cli
39
+ sum-platform --version
40
+ ```
41
+
42
+ ### With Gitea Support
43
+
44
+ If using Gitea instead of GitHub for repository hosting:
45
+
46
+ ```bash
47
+ pip install sum-cli[gitea]
48
+ ```
49
+
50
+ ## Quick Usage
51
+
52
+ ```bash
53
+ # Create a new production site (requires sudo)
54
+ sudo sum-platform init acme --theme theme_a
55
+
56
+ # Create site with custom content profile
57
+ sudo sum-platform init acme --content-path /path/to/profiles/acme
58
+
59
+ # Update a deployed site
60
+ sum-platform update acme
61
+
62
+ # Backup a site
63
+ sum-platform backup acme --include-media
64
+
65
+ # Promote staging to production
66
+ sum-platform promote acme --domain acme.example.com
67
+
68
+ # List available themes
69
+ sum-platform themes
70
+
71
+ # Validate a project setup
72
+ sum-platform check acme
73
+ ```
74
+
75
+ ## Commands
76
+
77
+ | Command | Description | Requires Sudo |
78
+ |---------|-------------|---------------|
79
+ | `init` | Create new site at `/srv/sum/<name>/` | Yes |
80
+ | `update` | Pull updates, migrate, restart | No (staging) |
81
+ | `backup` | Database and media backup | No |
82
+ | `promote` | Deploy staging site to production | No |
83
+ | `check` | Validate project setup | No |
84
+ | `themes` | List available themes | No |
85
+ | `run` | Start development server | No |
86
+
87
+ ## Git Provider Support
88
+
89
+ The CLI supports both GitHub and Gitea for repository hosting. Configure your provider in `/etc/sum/config.yml`:
90
+
91
+ **GitHub (default):**
92
+ ```yaml
93
+ agency:
94
+ name: "Your Agency"
95
+ git_provider: "github"
96
+ github_org: "your-org"
97
+ ```
98
+
99
+ **Gitea:**
100
+ ```yaml
101
+ agency:
102
+ name: "Your Agency"
103
+ git_provider: "gitea"
104
+ gitea_url: "https://gitea.example.com"
105
+ gitea_org: "your-org"
106
+ gitea_token_env: "GITEA_TOKEN"
107
+ ```
108
+
109
+ For Gitea, set the `GITEA_TOKEN` environment variable with your API token.
110
+
111
+ ## Development Install (monorepo)
112
+
113
+ ```bash
114
+ pip install -e ./cli
115
+ ```
116
+
117
+ ## Configuration
118
+
119
+ System-wide configuration is read from `/etc/sum/config.yml`. See `config.yml.example` for the full schema.
120
+
121
+ ## Documentation
122
+
123
+ The full User Guide is bundled with the package at `sum/docs/USER_GUIDE.md`.
124
+
125
+ For monorepo development:
126
+ - [User Guide](../docs/dev/cli/USER_GUIDE.md) - Full command reference
127
+ - [Developer Guide](../docs/dev/cli/DEVELOPER_GUIDE.md) - CLI architecture and contribution guide
@@ -0,0 +1,99 @@
1
+ # SUM CLI (v3)
2
+
3
+ [![PyPI](https://img.shields.io/pypi/v/sum-cli.svg)](https://pypi.org/project/sum-cli/)
4
+
5
+ The SUM CLI is the single control plane for deploying and managing SUM Platform client sites.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ pip install sum-cli
11
+ sum-platform --version
12
+ ```
13
+
14
+ ### With Gitea Support
15
+
16
+ If using Gitea instead of GitHub for repository hosting:
17
+
18
+ ```bash
19
+ pip install sum-cli[gitea]
20
+ ```
21
+
22
+ ## Quick Usage
23
+
24
+ ```bash
25
+ # Create a new production site (requires sudo)
26
+ sudo sum-platform init acme --theme theme_a
27
+
28
+ # Create site with custom content profile
29
+ sudo sum-platform init acme --content-path /path/to/profiles/acme
30
+
31
+ # Update a deployed site
32
+ sum-platform update acme
33
+
34
+ # Backup a site
35
+ sum-platform backup acme --include-media
36
+
37
+ # Promote staging to production
38
+ sum-platform promote acme --domain acme.example.com
39
+
40
+ # List available themes
41
+ sum-platform themes
42
+
43
+ # Validate a project setup
44
+ sum-platform check acme
45
+ ```
46
+
47
+ ## Commands
48
+
49
+ | Command | Description | Requires Sudo |
50
+ |---------|-------------|---------------|
51
+ | `init` | Create new site at `/srv/sum/<name>/` | Yes |
52
+ | `update` | Pull updates, migrate, restart | No (staging) |
53
+ | `backup` | Database and media backup | No |
54
+ | `promote` | Deploy staging site to production | No |
55
+ | `check` | Validate project setup | No |
56
+ | `themes` | List available themes | No |
57
+ | `run` | Start development server | No |
58
+
59
+ ## Git Provider Support
60
+
61
+ The CLI supports both GitHub and Gitea for repository hosting. Configure your provider in `/etc/sum/config.yml`:
62
+
63
+ **GitHub (default):**
64
+ ```yaml
65
+ agency:
66
+ name: "Your Agency"
67
+ git_provider: "github"
68
+ github_org: "your-org"
69
+ ```
70
+
71
+ **Gitea:**
72
+ ```yaml
73
+ agency:
74
+ name: "Your Agency"
75
+ git_provider: "gitea"
76
+ gitea_url: "https://gitea.example.com"
77
+ gitea_org: "your-org"
78
+ gitea_token_env: "GITEA_TOKEN"
79
+ ```
80
+
81
+ For Gitea, set the `GITEA_TOKEN` environment variable with your API token.
82
+
83
+ ## Development Install (monorepo)
84
+
85
+ ```bash
86
+ pip install -e ./cli
87
+ ```
88
+
89
+ ## Configuration
90
+
91
+ System-wide configuration is read from `/etc/sum/config.yml`. See `config.yml.example` for the full schema.
92
+
93
+ ## Documentation
94
+
95
+ The full User Guide is bundled with the package at `sum/docs/USER_GUIDE.md`.
96
+
97
+ For monorepo development:
98
+ - [User Guide](../docs/dev/cli/USER_GUIDE.md) - Full command reference
99
+ - [Developer Guide](../docs/dev/cli/DEVELOPER_GUIDE.md) - CLI architecture and contribution guide
@@ -0,0 +1,60 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "sum-cli"
7
+ version = "3.0.0"
8
+ description = "SUM Platform CLI: single control plane for site lifecycle management"
9
+ readme = "README.md"
10
+ requires-python = ">=3.12"
11
+ license = "BSD-3-Clause"
12
+ license-files = ["LICENSE"]
13
+ authors = [{ name = "Mark Ashton" }]
14
+ keywords = ["sum", "cli", "django", "wagtail"]
15
+ classifiers = [
16
+ "Development Status :: 4 - Beta",
17
+ "Environment :: Console",
18
+ "Intended Audience :: Developers",
19
+ "Programming Language :: Python :: 3",
20
+ "Programming Language :: Python :: 3 :: Only",
21
+ "Programming Language :: Python :: 3.12",
22
+ "Topic :: Software Development :: Build Tools",
23
+ "Topic :: Software Development :: Code Generators",
24
+ ]
25
+ dependencies = ["click>=8.1.7", "pyyaml>=6.0"]
26
+
27
+ [project.optional-dependencies]
28
+ gitea = ["httpx>=0.27.0"]
29
+
30
+ [project.urls]
31
+ Homepage = "https://github.com/markashton480/sum-platform"
32
+ Repository = "https://github.com/markashton480/sum-platform"
33
+ Issues = "https://github.com/markashton480/sum-platform/issues"
34
+ Documentation = "https://github.com/markashton480/sum-platform/tree/main/docs/dev/cli.md"
35
+
36
+ [project.scripts]
37
+ sum-platform = "sum.cli:cli"
38
+
39
+ [tool.setuptools]
40
+ include-package-data = true
41
+
42
+ [tool.setuptools.packages.find]
43
+ where = ["."]
44
+ include = ["sum*"]
45
+
46
+ [tool.setuptools.package-data]
47
+ sum = [
48
+ "boilerplate/**/*",
49
+ "boilerplate/.env.example",
50
+ "boilerplate/.gitignore",
51
+ "boilerplate/.github/**/*",
52
+ "boilerplate/.gitea/**/*",
53
+ "docs/**/*",
54
+ ]
55
+
56
+ [tool.setuptools.exclude-package-data]
57
+ sum = [
58
+ "boilerplate/**/__pycache__/*",
59
+ "boilerplate/**/*.pyc",
60
+ ]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1 @@
1
+ """CLI v2 core package."""
@@ -0,0 +1,124 @@
1
+ # =============================================================================
2
+ # SUM Client Environment Configuration
3
+ # =============================================================================
4
+ # Copy this file to .env and set values appropriate for your environment.
5
+ # All variables with defaults shown are optional unless noted otherwise.
6
+
7
+ # =============================================================================
8
+ # Django Core
9
+ # =============================================================================
10
+
11
+ # REQUIRED in production: Generate with `python -c "from django.core.management.utils import get_random_secret_key; print(get_random_secret_key())"`
12
+ DJANGO_SECRET_KEY=change-me-in-production
13
+
14
+ # REQUIRED in production: Comma-separated list of allowed hostnames
15
+ ALLOWED_HOSTS=localhost,127.0.0.1
16
+
17
+ # Settings module (default: project_name.settings.local)
18
+ # For production, set to: project_name.settings.production
19
+ # DJANGO_SETTINGS_MODULE=project_name.settings.local
20
+
21
+ # Wagtail admin base URL (for email links, etc.)
22
+ WAGTAILADMIN_BASE_URL=http://localhost:8001
23
+
24
+ # =============================================================================
25
+ # Database (PostgreSQL)
26
+ # =============================================================================
27
+ # REQUIRED: PostgreSQL is used for both local development and production.
28
+ # These must be configured before running migrations.
29
+
30
+ DJANGO_DB_NAME=sum_db
31
+ DJANGO_DB_USER=sum_user
32
+ DJANGO_DB_PASSWORD=sum_password
33
+ DJANGO_DB_HOST=localhost
34
+ DJANGO_DB_PORT=5432
35
+
36
+
37
+ # =============================================================================
38
+ # Static/Media Roots (Golden Path VPS)
39
+ # =============================================================================
40
+ # For the VPS golden path, set these to point outside the app checkout so Caddy can serve
41
+ # static/media directly. Example:
42
+ # DJANGO_STATIC_ROOT=/srv/sum/<site_slug>/static
43
+ # DJANGO_MEDIA_ROOT=/srv/sum/<site_slug>/media
44
+ #
45
+ # DJANGO_STATIC_ROOT=
46
+ # DJANGO_MEDIA_ROOT=
47
+
48
+ # Optional: used by infrastructure/scripts/deploy.sh smoke checks
49
+ # SITE_DOMAIN=example.com
50
+
51
+ # =============================================================================
52
+ # Redis / Cache
53
+ # =============================================================================
54
+ # Used for caching and Celery broker in production.
55
+ # Local development uses in-memory cache by default.
56
+
57
+ REDIS_URL=redis://localhost:6379/0
58
+
59
+ # =============================================================================
60
+ # Celery (Async Tasks)
61
+ # =============================================================================
62
+ # Falls back to synchronous execution if not configured.
63
+
64
+ CELERY_BROKER_URL=redis://localhost:6379/0
65
+ CELERY_RESULT_BACKEND=redis://localhost:6379/0
66
+
67
+ # =============================================================================
68
+ # Email Configuration (SMTP)
69
+ # =============================================================================
70
+ # Defaults to console backend for development (emails printed to stdout).
71
+ # Configure SMTP for production email delivery.
72
+ #
73
+ # We recommend Resend (https://resend.com) for transactional email.
74
+ # Sign up, verify your domain, and get an API key from the dashboard.
75
+ #
76
+ # Resend SMTP settings:
77
+ EMAIL_BACKEND=django.core.mail.backends.smtp.EmailBackend
78
+ EMAIL_HOST=smtp.resend.com
79
+ EMAIL_PORT=587
80
+ EMAIL_HOST_USER=resend
81
+ EMAIL_HOST_PASSWORD=re_YOUR_API_KEY_HERE
82
+ EMAIL_USE_TLS=True
83
+ EMAIL_USE_SSL=False
84
+ DEFAULT_FROM_EMAIL=noreply@yourdomain.com
85
+
86
+ # Lead notification recipient - where new lead alerts are sent.
87
+ # This MUST be set for lead notification emails to be delivered.
88
+ LEAD_NOTIFICATION_EMAIL=leads@yourdomain.com
89
+
90
+ # =============================================================================
91
+ # Zapier Integration (Optional)
92
+ # =============================================================================
93
+ # Configure per-site in Wagtail SiteSettings, or set globally here.
94
+
95
+ # ZAPIER_WEBHOOK_URL=https://hooks.zapier.com/hooks/catch/...
96
+
97
+ # =============================================================================
98
+ # Observability
99
+ # =============================================================================
100
+
101
+ # Sentry error tracking (optional, disabled if not set)
102
+ # SENTRY_DSN=https://xxx@xxx.ingest.sentry.io/xxx
103
+ # SENTRY_ENVIRONMENT=development
104
+ # SENTRY_TRACES_SAMPLE_RATE=0.0
105
+
106
+ # Logging configuration (optional)
107
+ # LOG_LEVEL=INFO
108
+ # LOG_FORMAT=auto # "auto", "json", or blank for console-friendly
109
+
110
+ # =============================================================================
111
+ # Build / Version Info (typically set by CI)
112
+ # =============================================================================
113
+ # These are included in /health/ endpoint and Sentry releases.
114
+
115
+ # GIT_SHA=abc123
116
+ # BUILD_ID=build-123
117
+ # RELEASE=v0.1.0
118
+
119
+ # =============================================================================
120
+ # Security (Production Only)
121
+ # =============================================================================
122
+ # Set to True to enforce HTTPS redirects (default: True in production.py)
123
+
124
+ # SECURE_SSL_REDIRECT=True
@@ -0,0 +1,33 @@
1
+ name: CI
2
+
3
+ on:
4
+ pull_request:
5
+ push:
6
+ branches:
7
+ - main
8
+
9
+ jobs:
10
+ test:
11
+ runs-on: ubuntu-latest
12
+
13
+ steps:
14
+ - name: Check out repository
15
+ uses: actions/checkout@v4
16
+
17
+ - name: Set up Python
18
+ uses: actions/setup-python@v5
19
+ with:
20
+ python-version: "3.12"
21
+ cache: "pip"
22
+ cache-dependency-path: requirements.txt
23
+
24
+ - name: Install dependencies
25
+ run: |
26
+ python -m pip install --upgrade pip
27
+ pip install -r requirements.txt
28
+
29
+ - name: Install test dependencies
30
+ run: pip install pytest pytest-django
31
+
32
+ - name: Run tests
33
+ run: pytest
@@ -0,0 +1,98 @@
1
+ name: Deploy Production
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+
7
+ concurrency:
8
+ group: deploy-production
9
+ cancel-in-progress: false
10
+
11
+ jobs:
12
+ deploy:
13
+ runs-on: ubuntu-latest
14
+ timeout-minutes: 15
15
+ env:
16
+ PRODUCTION_HOST: ${{ secrets.PRODUCTION_HOST }}
17
+ PRODUCTION_USER: ${{ secrets.PRODUCTION_USER }}
18
+ PRODUCTION_PATH: ${{ secrets.PRODUCTION_PATH }}
19
+ PRODUCTION_URL: ${{ secrets.PRODUCTION_URL }}
20
+
21
+ steps:
22
+ - name: Verify required secrets are present
23
+ run: |
24
+ set -euo pipefail
25
+ for var in PRODUCTION_HOST PRODUCTION_USER PRODUCTION_PATH PRODUCTION_URL; do
26
+ if [ -z "${!var}" ]; then
27
+ echo "Missing $var" >&2
28
+ exit 1
29
+ fi
30
+ done
31
+
32
+ - name: Validate SSH key secret
33
+ if: ${{ secrets.PRODUCTION_SSH_KEY == '' }}
34
+ run: |
35
+ echo "::error::PRODUCTION_SSH_KEY is not set"
36
+ exit 1
37
+
38
+ - name: Set up SSH
39
+ run: |
40
+ set -euo pipefail
41
+ mkdir -p ~/.ssh
42
+ chmod 700 ~/.ssh
43
+ echo "${{ secrets.PRODUCTION_SSH_KEY }}" > ~/.ssh/id_rsa
44
+ chmod 600 ~/.ssh/id_rsa
45
+ ssh-keyscan -H "$PRODUCTION_HOST" > ~/.ssh/known_hosts
46
+ if [ ! -s ~/.ssh/known_hosts ]; then
47
+ echo "ssh-keyscan returned no host keys for $PRODUCTION_HOST" >&2
48
+ exit 1
49
+ fi
50
+ chmod 600 ~/.ssh/known_hosts
51
+
52
+ # Rollback: ssh $PRODUCTION_USER@$PRODUCTION_HOST "/srv/sum/bin/deploy.sh --site-slug <site-slug> --ref <previous-tag>"
53
+ - name: Deploy release tag
54
+ run: |
55
+ set -euo pipefail
56
+ SITE_SLUG=$(basename "$PRODUCTION_PATH")
57
+ RELEASE_TAG="${{ gitea.event.release.tag_name }}"
58
+ if [ -z "$RELEASE_TAG" ]; then
59
+ echo "Release tag not found in event payload" >&2
60
+ exit 1
61
+ fi
62
+ ssh -o BatchMode=yes -o StrictHostKeyChecking=yes \
63
+ "${PRODUCTION_USER}@${PRODUCTION_HOST}" \
64
+ "/srv/sum/bin/deploy.sh --site-slug \"$SITE_SLUG\" --ref \"$RELEASE_TAG\""
65
+
66
+ - name: Health check (blocking)
67
+ run: |
68
+ set -euo pipefail
69
+ BASE_URL="${PRODUCTION_URL%/}"
70
+ for attempt in 1 2 3; do
71
+ echo "Health check attempt $attempt..."
72
+ if curl --fail --show-error --silent --location --max-redirs 0 --max-time 60 \
73
+ "$BASE_URL/health/" >/dev/null; then
74
+ echo "Health check OK"
75
+ exit 0
76
+ fi
77
+ if [ "$attempt" -lt 3 ]; then
78
+ echo "Health check failed, retrying in 10s..."
79
+ sleep 10
80
+ fi
81
+ done
82
+ echo "::error::Health check failed after 3 attempts"
83
+ exit 1
84
+
85
+ - name: Sitemap check (non-blocking)
86
+ run: |
87
+ set -euo pipefail
88
+ BASE_URL="${PRODUCTION_URL%/}"
89
+ if curl --fail --show-error --silent --location --max-redirs 0 --max-time 60 \
90
+ "$BASE_URL/sitemap.xml" >/dev/null; then
91
+ echo "Sitemap check OK"
92
+ else
93
+ echo "::warning::Sitemap check failed (non-blocking)"
94
+ fi
95
+
96
+ - name: Clean up SSH key
97
+ if: always()
98
+ run: rm -f ~/.ssh/id_rsa