codex-django-cli 0.2.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (212) hide show
  1. codex_django_cli/__init__.py +12 -0
  2. codex_django_cli/blueprints/apps/default/__init__.py +0 -0
  3. codex_django_cli/blueprints/apps/default/admin/__init__.py +0 -0
  4. codex_django_cli/blueprints/apps/default/apps.py.j2 +0 -0
  5. codex_django_cli/blueprints/apps/default/forms/__init__.py +0 -0
  6. codex_django_cli/blueprints/apps/default/models/__init__.py +0 -0
  7. codex_django_cli/blueprints/apps/default/modules/__init__.py +0 -0
  8. codex_django_cli/blueprints/apps/default/selector/__init__.py +0 -0
  9. codex_django_cli/blueprints/apps/default/services/__init__.py +0 -0
  10. codex_django_cli/blueprints/apps/default/tests/__init__.py +0 -0
  11. codex_django_cli/blueprints/apps/default/translations.py.j2 +0 -0
  12. codex_django_cli/blueprints/apps/default/urls.py.j2 +0 -0
  13. codex_django_cli/blueprints/apps/default/views/__init__.py +0 -0
  14. codex_django_cli/blueprints/deploy/shared/.dockerignore.j2 +24 -0
  15. codex_django_cli/blueprints/deploy/shared/.env.example.j2 +64 -0
  16. codex_django_cli/blueprints/deploy/shared/backend/Dockerfile.j2 +36 -0
  17. codex_django_cli/blueprints/deploy/shared/backend/entrypoint.sh.j2 +20 -0
  18. codex_django_cli/blueprints/deploy/shared/nginx/Dockerfile.local.j2 +14 -0
  19. codex_django_cli/blueprints/deploy/shared/nginx/nginx-main.conf.j2 +67 -0
  20. codex_django_cli/blueprints/deploy/shared/nginx/site-local.conf.j2 +66 -0
  21. codex_django_cli/blueprints/deploy/shared/worker/Dockerfile.j2 +25 -0
  22. codex_django_cli/blueprints/deploy/stack/docker/base.Dockerfile.j2 +38 -0
  23. codex_django_cli/blueprints/deploy/stack/docker/django.Dockerfile.j2 +27 -0
  24. codex_django_cli/blueprints/deploy/stack/docker/entrypoint.sh.j2 +19 -0
  25. codex_django_cli/blueprints/deploy/stack/docker-compose.apps.yml.j2 +41 -0
  26. codex_django_cli/blueprints/deploy/stack/docker-compose.infra.yml.j2 +80 -0
  27. codex_django_cli/blueprints/deploy/stack/docker-compose.local.apps.yml.j2 +41 -0
  28. codex_django_cli/blueprints/deploy/stack/docker-compose.local.infra.yml.j2 +94 -0
  29. codex_django_cli/blueprints/deploy/stack/docker-compose.test.yml.j2 +63 -0
  30. codex_django_cli/blueprints/deploy/stack/nginx/Dockerfile.j2 +12 -0
  31. codex_django_cli/blueprints/deploy/stack/nginx/conf.d/default.conf.j2 +68 -0
  32. codex_django_cli/blueprints/deploy/stack/nginx/site.conf.template.j2 +81 -0
  33. codex_django_cli/blueprints/deploy/stack_workflows/ci-develop.yml.j2 +42 -0
  34. codex_django_cli/blueprints/deploy/stack_workflows/ci-main.yml.j2 +165 -0
  35. codex_django_cli/blueprints/deploy/stack_workflows/deploy-cluster.yml.j2 +112 -0
  36. codex_django_cli/blueprints/deploy/standalone/docker-compose.prod.yml.j2 +118 -0
  37. codex_django_cli/blueprints/deploy/standalone/docker-compose.test.yml.j2 +86 -0
  38. codex_django_cli/blueprints/deploy/standalone/docker-compose.yml.j2 +151 -0
  39. codex_django_cli/blueprints/deploy/standalone/nginx/Dockerfile.j2 +18 -0
  40. codex_django_cli/blueprints/deploy/standalone/nginx/site.conf.template.j2 +168 -0
  41. codex_django_cli/blueprints/deploy/standalone_workflows/ci-develop.yml.j2 +42 -0
  42. codex_django_cli/blueprints/deploy/standalone_workflows/ci-main.yml.j2 +113 -0
  43. codex_django_cli/blueprints/deploy/standalone_workflows/deploy-production-tag.yml.j2 +211 -0
  44. codex_django_cli/blueprints/features/booking/booking/__init__.py.j2 +0 -0
  45. codex_django_cli/blueprints/features/booking/booking/admin.py.j2 +52 -0
  46. codex_django_cli/blueprints/features/booking/booking/apps.py.j2 +8 -0
  47. codex_django_cli/blueprints/features/booking/booking/models.py.j2 +142 -0
  48. codex_django_cli/blueprints/features/booking/booking/selectors.py.j2 +102 -0
  49. codex_django_cli/blueprints/features/booking/booking/urls.py.j2 +12 -0
  50. codex_django_cli/blueprints/features/booking/booking/views.py.j2 +174 -0
  51. codex_django_cli/blueprints/features/booking/booking/wiki.md.j2 +142 -0
  52. codex_django_cli/blueprints/features/booking/cabinet/templates/cabinet/booking/my_bookings.html +249 -0
  53. codex_django_cli/blueprints/features/booking/cabinet/views/booking.py.j2 +70 -0
  54. codex_django_cli/blueprints/features/booking/system/admin/booking_settings.py.j2 +31 -0
  55. codex_django_cli/blueprints/features/booking/system/models/booking_settings.py.j2 +7 -0
  56. codex_django_cli/blueprints/features/booking/templates/booking/booking_page.html +137 -0
  57. codex_django_cli/blueprints/features/booking/templates/booking/partials/step_confirm.html +143 -0
  58. codex_django_cli/blueprints/features/booking/templates/booking/partials/step_date.html +184 -0
  59. codex_django_cli/blueprints/features/booking/templates/booking/partials/step_service.html +78 -0
  60. codex_django_cli/blueprints/features/booking/templates/booking/partials/step_time.html +89 -0
  61. codex_django_cli/blueprints/features/client_cabinet/cabinet/adapters.py.j2 +21 -0
  62. codex_django_cli/blueprints/features/client_cabinet/cabinet/templates/cabinet/client/my_appointments.html +58 -0
  63. codex_django_cli/blueprints/features/client_cabinet/cabinet/templates/cabinet/client/profile.html +107 -0
  64. codex_django_cli/blueprints/features/client_cabinet/cabinet/templates/cabinet/client/settings.html +106 -0
  65. codex_django_cli/blueprints/features/client_cabinet/cabinet/templates/cabinet/client/settings_notifications.html +106 -0
  66. codex_django_cli/blueprints/features/client_cabinet/cabinet/templates/cabinet/client/settings_privacy.html +135 -0
  67. codex_django_cli/blueprints/features/client_cabinet/cabinet/views/client.py.j2 +49 -0
  68. codex_django_cli/blueprints/features/client_cabinet/system/models/user_profile.py.j2 +22 -0
  69. codex_django_cli/blueprints/features/notifications/arq/client.j2 +22 -0
  70. codex_django_cli/blueprints/features/notifications/feature/models/email_content.j2 +15 -0
  71. codex_django_cli/blueprints/features/notifications/feature/selectors/email_content.j2 +23 -0
  72. codex_django_cli/blueprints/features/notifications/feature/services/notification.j2 +66 -0
  73. codex_django_cli/blueprints/project/cabinet/__init__.py +0 -0
  74. codex_django_cli/blueprints/project/cabinet/admin/__init__.py +0 -0
  75. codex_django_cli/blueprints/project/cabinet/apps.py.j2 +11 -0
  76. codex_django_cli/blueprints/project/cabinet/cabinet.py.j2 +33 -0
  77. codex_django_cli/blueprints/project/cabinet/forms/__init__.py +0 -0
  78. codex_django_cli/blueprints/project/cabinet/mock.py.j2 +110 -0
  79. codex_django_cli/blueprints/project/cabinet/models/__init__.py +0 -0
  80. codex_django_cli/blueprints/project/cabinet/modules/__init__.py +0 -0
  81. codex_django_cli/blueprints/project/cabinet/selector/__init__.py +3 -0
  82. codex_django_cli/blueprints/project/cabinet/selector/users.py.j2 +25 -0
  83. codex_django_cli/blueprints/project/cabinet/services/__init__.py +0 -0
  84. codex_django_cli/blueprints/project/cabinet/static/cabinet/css/base.css +11 -0
  85. codex_django_cli/blueprints/project/cabinet/static/cabinet/css/compiler_config.json +5 -0
  86. codex_django_cli/blueprints/project/cabinet/static/cabinet/css/theme/tokens.css +30 -0
  87. codex_django_cli/blueprints/project/cabinet/static/cabinet/js/app/cabinet.js +37 -0
  88. codex_django_cli/blueprints/project/cabinet/static/cabinet/js/compiler_config.json +7 -0
  89. codex_django_cli/blueprints/project/cabinet/templates/cabinet/users/detail.html +91 -0
  90. codex_django_cli/blueprints/project/cabinet/templates/cabinet/users/index.html +97 -0
  91. codex_django_cli/blueprints/project/cabinet/tests/__init__.py +0 -0
  92. codex_django_cli/blueprints/project/cabinet/translations.py.j2 +2 -0
  93. codex_django_cli/blueprints/project/cabinet/urls.py.j2 +22 -0
  94. codex_django_cli/blueprints/project/cabinet/views/__init__.py +3 -0
  95. codex_django_cli/blueprints/project/cabinet/views/users.py.j2 +17 -0
  96. codex_django_cli/blueprints/project/core/__init__.py.j2 +1 -0
  97. codex_django_cli/blueprints/project/core/apps.py.j2 +15 -0
  98. codex_django_cli/blueprints/project/core/asgi.py.j2 +7 -0
  99. codex_django_cli/blueprints/project/core/logger.py.j2 +57 -0
  100. codex_django_cli/blueprints/project/core/redis.py.j2 +4 -0
  101. codex_django_cli/blueprints/project/core/settings/__init__.py.j2 +4 -0
  102. codex_django_cli/blueprints/project/core/settings/base.py.j2 +67 -0
  103. codex_django_cli/blueprints/project/core/settings/dev.py.j2 +56 -0
  104. codex_django_cli/blueprints/project/core/settings/modules/__init__.py.j2 +1 -0
  105. codex_django_cli/blueprints/project/core/settings/modules/admin.py.j2 +72 -0
  106. codex_django_cli/blueprints/project/core/settings/modules/apps.py.j2 +64 -0
  107. codex_django_cli/blueprints/project/core/settings/modules/cache.py.j2 +49 -0
  108. codex_django_cli/blueprints/project/core/settings/modules/codex.py.j2 +39 -0
  109. codex_django_cli/blueprints/project/core/settings/modules/database.py.j2 +49 -0
  110. codex_django_cli/blueprints/project/core/settings/modules/internationalization.py.j2 +43 -0
  111. codex_django_cli/blueprints/project/core/settings/modules/logging.py.j2 +45 -0
  112. codex_django_cli/blueprints/project/core/settings/modules/middleware.py.j2 +17 -0
  113. codex_django_cli/blueprints/project/core/settings/modules/security.py.j2 +53 -0
  114. codex_django_cli/blueprints/project/core/settings/modules/sitemap.py.j2 +14 -0
  115. codex_django_cli/blueprints/project/core/settings/modules/static.py.j2 +36 -0
  116. codex_django_cli/blueprints/project/core/settings/modules/templates.py.j2 +29 -0
  117. codex_django_cli/blueprints/project/core/settings/prod.py.j2 +77 -0
  118. codex_django_cli/blueprints/project/core/settings/test.py.j2 +40 -0
  119. codex_django_cli/blueprints/project/core/sitemaps.py.j2 +26 -0
  120. codex_django_cli/blueprints/project/core/urls.py.j2 +71 -0
  121. codex_django_cli/blueprints/project/core/wsgi.py.j2 +7 -0
  122. codex_django_cli/blueprints/project/features/__init__.py.j2 +0 -0
  123. codex_django_cli/blueprints/project/features/main/admin/__init__.py +0 -0
  124. codex_django_cli/blueprints/project/features/main/apps.py.j2 +8 -0
  125. codex_django_cli/blueprints/project/features/main/forms/__init__.py +0 -0
  126. codex_django_cli/blueprints/project/features/main/models/__init__.py +0 -0
  127. codex_django_cli/blueprints/project/features/main/sitemaps.py.j2 +23 -0
  128. codex_django_cli/blueprints/project/features/main/tests/__init__.py +0 -0
  129. codex_django_cli/blueprints/project/features/main/translations.py.j2 +2 -0
  130. codex_django_cli/blueprints/project/features/main/urls.py.j2 +8 -0
  131. codex_django_cli/blueprints/project/features/main/views/__init__.py.j2 +9 -0
  132. codex_django_cli/blueprints/project/manage.py.j2 +39 -0
  133. codex_django_cli/blueprints/project/static/css/base/components.css +88 -0
  134. codex_django_cli/blueprints/project/static/css/base/footer.css +43 -0
  135. codex_django_cli/blueprints/project/static/css/base/header.css +76 -0
  136. codex_django_cli/blueprints/project/static/css/base/layout.css +58 -0
  137. codex_django_cli/blueprints/project/static/css/base/reset.css +65 -0
  138. codex_django_cli/blueprints/project/static/css/base/tokens.css +45 -0
  139. codex_django_cli/blueprints/project/static/css/base.css +31 -0
  140. codex_django_cli/blueprints/project/static/css/compiler_config.json +10 -0
  141. codex_django_cli/blueprints/project/static/css/pages/contacts.css +42 -0
  142. codex_django_cli/blueprints/project/static/css/pages/errors.css +11 -0
  143. codex_django_cli/blueprints/project/static/css/pages/home.css +120 -0
  144. codex_django_cli/blueprints/project/static/js/app/main.js +8 -0
  145. codex_django_cli/blueprints/project/static/js/vendor/alpine.min.js +9 -0
  146. codex_django_cli/blueprints/project/static/js/vendor/htmx.min.js +9 -0
  147. codex_django_cli/blueprints/project/static/manifest.json +15 -0
  148. codex_django_cli/blueprints/project/static/robots.txt +4 -0
  149. codex_django_cli/blueprints/project/system/__init__.py.j2 +1 -0
  150. codex_django_cli/blueprints/project/system/admin/__init__.py.j2 +15 -0
  151. codex_django_cli/blueprints/project/system/admin/seo.py.j2 +28 -0
  152. codex_django_cli/blueprints/project/system/admin/settings.py.j2 +65 -0
  153. codex_django_cli/blueprints/project/system/admin/static.py.j2 +18 -0
  154. codex_django_cli/blueprints/project/system/apps.py.j2 +9 -0
  155. codex_django_cli/blueprints/project/system/forms/__init__.py.j2 +1 -0
  156. codex_django_cli/blueprints/project/system/management/__init__.py +0 -0
  157. codex_django_cli/blueprints/project/system/management/commands/__init__.py +0 -0
  158. codex_django_cli/blueprints/project/system/management/commands/dev.py.j2 +5 -0
  159. codex_django_cli/blueprints/project/system/management/commands/menu.py.j2 +81 -0
  160. codex_django_cli/blueprints/project/system/management/commands/runserver_plus.py.j2 +46 -0
  161. codex_django_cli/blueprints/project/system/management/commands/update_all_content.py.j2 +17 -0
  162. codex_django_cli/blueprints/project/system/management/commands/update_site_settings.py.j2 +80 -0
  163. codex_django_cli/blueprints/project/system/models/__init__.py.j2 +15 -0
  164. codex_django_cli/blueprints/project/system/models/seo.py.j2 +37 -0
  165. codex_django_cli/blueprints/project/system/models/settings.py.j2 +31 -0
  166. codex_django_cli/blueprints/project/system/models/static.py.j2 +13 -0
  167. codex_django_cli/blueprints/project/system/services/__init__.py.j2 +1 -0
  168. codex_django_cli/blueprints/project/system/urls.py.j2 +7 -0
  169. codex_django_cli/blueprints/project/system/views/__init__.py.j2 +1 -0
  170. codex_django_cli/blueprints/project/system/views/errors.py.j2 +13 -0
  171. codex_django_cli/blueprints/project/templates/base.html.j2 +53 -0
  172. codex_django_cli/blueprints/project/templates/errors/400.html +9 -0
  173. codex_django_cli/blueprints/project/templates/errors/403.html +9 -0
  174. codex_django_cli/blueprints/project/templates/errors/404.html +16 -0
  175. codex_django_cli/blueprints/project/templates/errors/500.html +16 -0
  176. codex_django_cli/blueprints/project/templates/includes/_analytics_body.html +2 -0
  177. codex_django_cli/blueprints/project/templates/includes/_analytics_head.html +2 -0
  178. codex_django_cli/blueprints/project/templates/includes/_cookie_consent.html +2 -0
  179. codex_django_cli/blueprints/project/templates/includes/_critical_css.html +38 -0
  180. codex_django_cli/blueprints/project/templates/includes/_footer.html +57 -0
  181. codex_django_cli/blueprints/project/templates/includes/_header.html.j2 +75 -0
  182. codex_django_cli/blueprints/project/templates/includes/_hreflang_tags.html.j2 +11 -0
  183. codex_django_cli/blueprints/project/templates/includes/_meta.html +44 -0
  184. codex_django_cli/blueprints/project/templates/main/contacts.html +38 -0
  185. codex_django_cli/blueprints/project/templates/main/home.html +128 -0
  186. codex_django_cli/blueprints/project/templates/main/home.html.j2 +129 -0
  187. codex_django_cli/blueprints/project/templates/sitemap.xml +16 -0
  188. codex_django_cli/blueprints/repo/.env.example.j2 +15 -0
  189. codex_django_cli/blueprints/repo/.github/workflows/.gitkeep +1 -0
  190. codex_django_cli/blueprints/repo/.gitignore +38 -0
  191. codex_django_cli/blueprints/repo/README.md.j2 +32 -0
  192. codex_django_cli/blueprints/repo/docs/README.md +5 -0
  193. codex_django_cli/blueprints/repo/pyproject.toml.j2 +46 -0
  194. codex_django_cli/blueprints/repo/tools/dev/check.py.j2 +23 -0
  195. codex_django_cli/blueprints/repo/tools/dev/generate_project_tree.py +15 -0
  196. codex_django_cli/commands/__init__.py +1 -0
  197. codex_django_cli/commands/add_app.py +56 -0
  198. codex_django_cli/commands/booking.py +92 -0
  199. codex_django_cli/commands/client_cabinet.py +66 -0
  200. codex_django_cli/commands/deploy.py +96 -0
  201. codex_django_cli/commands/init.py +216 -0
  202. codex_django_cli/commands/notifications.py +59 -0
  203. codex_django_cli/commands/quality.py +116 -0
  204. codex_django_cli/engine.py +113 -0
  205. codex_django_cli/main.py +470 -0
  206. codex_django_cli/prompts.py +258 -0
  207. codex_django_cli/py.typed +0 -0
  208. codex_django_cli/utils.py +25 -0
  209. codex_django_cli-0.2.0.dist-info/METADATA +66 -0
  210. codex_django_cli-0.2.0.dist-info/RECORD +212 -0
  211. codex_django_cli-0.2.0.dist-info/WHEEL +4 -0
  212. codex_django_cli-0.2.0.dist-info/entry_points.txt +2 -0
@@ -0,0 +1,12 @@
1
+ """Interactive CLI entrypoints and scaffolding helpers for codex-django-cli.
2
+
3
+ The CLI package powers both the end-user `codex-django` command and the
4
+ lower-level blueprint rendering helpers used by individual scaffold commands.
5
+
6
+ Examples:
7
+ Launch the CLI entrypoint from Python::
8
+
9
+ from codex_django_cli.main import main
10
+
11
+ raise SystemExit(main())
12
+ """
File without changes
File without changes
File without changes
@@ -0,0 +1,24 @@
1
+ .git
2
+ .github
3
+ .venv
4
+ __pycache__
5
+ *.pyc
6
+ *.pyo
7
+ *.pyd
8
+ .Python
9
+ *.egg-info
10
+ dist/
11
+ build/
12
+ .mypy_cache
13
+ .ruff_cache
14
+ .pytest_cache
15
+ htmlcov/
16
+ .coverage
17
+ *.log
18
+ .env
19
+ .env.*
20
+ !.env.example
21
+ node_modules/
22
+ sandbox/
23
+ docs/
24
+ tests/
@@ -0,0 +1,64 @@
1
+ # =============================================================
2
+ # {{ project_name }} — Environment Variables
3
+ # Copy to .env and fill in values before running.
4
+ # =============================================================
5
+
6
+ # --- General ---
7
+ DEBUG=False
8
+ SECRET_KEY={{ secret_key }}
9
+ DOMAIN_NAME={{ domain_name }}
10
+ ALLOWED_HOSTS={{ domain_name }},www.{{ domain_name }}
11
+ SITE_BASE_URL=https://{{ domain_name }}/
12
+
13
+ DJANGO_SETTINGS_MODULE={{ project_name }}.core.settings.prod
14
+
15
+ # --- Database ---
16
+ DATABASE_URL=postgresql://user:password@localhost:5432/{{ project_name }} # pragma: allowlist secret
17
+
18
+ # --- Redis ---
19
+ REDIS_HOST=redis
20
+ REDIS_PORT=6379
21
+ REDIS_PASSWORD=change_me_redis_password
22
+
23
+ # --- Email (SMTP) ---
24
+ SMTP_HOST=smtp.example.com
25
+ SMTP_PORT=465
26
+ SMTP_USER=noreply@{{ domain_name }}
27
+ SMTP_PASSWORD=change_me
28
+ SMTP_FROM_EMAIL=noreply@{{ domain_name }}
29
+ SMTP_USE_TLS=False
30
+
31
+ EMAIL_HOST=${SMTP_HOST}
32
+ EMAIL_PORT=${SMTP_PORT}
33
+ EMAIL_HOST_USER=${SMTP_USER}
34
+ EMAIL_HOST_PASSWORD=${SMTP_PASSWORD}
35
+ DEFAULT_FROM_EMAIL=${SMTP_FROM_EMAIL}
36
+ EMAIL_USE_TLS=${SMTP_USE_TLS}
37
+
38
+ {% if with_bot %}
39
+ # --- Telegram Bot ---
40
+ BOT_TOKEN=your_bot_token_here
41
+ SUPERUSER_IDS=123456789
42
+ OWNER_IDS=123456789
43
+ BOT_DATA_MODE=api
44
+ BACKEND_API_URL=http://backend:8000
45
+ BOT_API_KEY=change_me_bot_api_key
46
+ BACKEND_API_KEY=change_me_backend_api_key
47
+ TELEGRAM_ADMIN_CHANNEL_ID=-1001234567890
48
+ {% endif %}
49
+
50
+ # --- Gunicorn ---
51
+ GUNICORN_WORKERS=2
52
+
53
+ # --- Logging ---
54
+ LOG_LEVEL=INFO
55
+
56
+ # --- Docker Images (prod) ---
57
+ DOCKER_IMAGE_BACKEND=ghcr.io/your-org/{{ project_name }}-backend:latest
58
+ {% if with_worker %}
59
+ DOCKER_IMAGE_WORKER=ghcr.io/your-org/{{ project_name }}-worker:latest
60
+ {% endif %}
61
+ {% if with_bot %}
62
+ DOCKER_IMAGE_BOT=ghcr.io/your-org/{{ project_name }}-bot:latest
63
+ {% endif %}
64
+ DOCKER_IMAGE_NGINX=ghcr.io/your-org/{{ project_name }}-nginx:latest
@@ -0,0 +1,36 @@
1
+ # === STAGE 1: Builder ===
2
+ FROM python:{{ python_version }}-slim AS builder
3
+ WORKDIR /app
4
+ RUN apt-get update && apt-get install -y gcc g++ libpq-dev && rm -rf /var/lib/apt/lists/*
5
+
6
+ COPY pyproject.toml README.md ./
7
+ COPY src ./src
8
+
9
+ RUN python -m venv /venv
10
+ RUN /venv/bin/pip install --upgrade pip
11
+ RUN /venv/bin/pip install --no-cache-dir .
12
+
13
+ # === STAGE 2: Runtime ===
14
+ FROM python:{{ python_version }}-slim
15
+ WORKDIR /app
16
+ RUN apt-get update && apt-get install -y libpq5 curl procps && rm -rf /var/lib/apt/lists/* && \
17
+ useradd -m -u 1000 appuser
18
+
19
+ COPY --from=builder /venv /venv
20
+ COPY src/{{ project_name }} /app
21
+ COPY deploy/backend/entrypoint.sh /entrypoint.sh
22
+
23
+ RUN mkdir -p /app/staticfiles /app/media /app/logs/backend && \
24
+ chown -R appuser:appuser /app && \
25
+ chmod -R 755 /app/media /app/logs/backend && \
26
+ chmod +x /entrypoint.sh
27
+
28
+ USER appuser
29
+
30
+ ENV PATH="/venv/bin:$PATH"
31
+ ENV DJANGO_SETTINGS_MODULE="{{ project_name }}.core.settings.dev"
32
+
33
+ HEALTHCHECK --interval=30s --timeout=10s --retries=3 CMD curl -f http://localhost:8000/api/v1/health || exit 1
34
+
35
+ WORKDIR /app
36
+ ENTRYPOINT ["/entrypoint.sh"]
@@ -0,0 +1,20 @@
1
+ #!/bin/sh
2
+ set -e
3
+
4
+ # If a command is passed (e.g. migrate), run only that
5
+ if [ "$#" -gt 0 ]; then
6
+ echo "Running command: $@"
7
+ exec "$@"
8
+ fi
9
+
10
+ echo "Running collectstatic..."
11
+ python /app/manage.py collectstatic --noinput
12
+
13
+ echo "Running migrations..."
14
+ python /app/manage.py migrate --noinput
15
+
16
+ echo "Starting gunicorn..."
17
+ exec gunicorn {{ project_name }}.core.wsgi:application \
18
+ --bind 0.0.0.0:8000 \
19
+ --workers ${GUNICORN_WORKERS:-2} \
20
+ --timeout 90
@@ -0,0 +1,14 @@
1
+ FROM nginx:alpine
2
+
3
+ # Remove default configs
4
+ RUN rm /etc/nginx/conf.d/*
5
+
6
+ # Copy main nginx config
7
+ COPY deploy/nginx/nginx-main.conf /etc/nginx/nginx.conf
8
+
9
+ # Copy local development site config (HTTP only)
10
+ COPY deploy/nginx/site-local.conf /etc/nginx/conf.d/default.conf
11
+
12
+ EXPOSE 80
13
+
14
+ CMD ["nginx", "-g", "daemon off;"]
@@ -0,0 +1,67 @@
1
+ events {
2
+ worker_connections 1024;
3
+ }
4
+
5
+ http {
6
+ server_tokens off;
7
+ include /etc/nginx/mime.types;
8
+ default_type application/octet-stream;
9
+
10
+ {% if enable_i18n %}
11
+ # --- Language Detection ---
12
+ map $http_accept_language $lang {
13
+ default en;
14
+ ~*^ru ru;
15
+ ~*^uk uk;
16
+ ~*^de de;
17
+ ~*^en en;
18
+ }
19
+ {% endif %}
20
+
21
+ # --- Logging Format (JSON) ---
22
+ log_format json_combined escape=json
23
+ '{'
24
+ '"time_local":"$time_local",'
25
+ '"remote_addr":"$remote_addr",'
26
+ '"remote_user":"$remote_user",'
27
+ '"request":"$request",'
28
+ '"status": "$status",'
29
+ '"body_bytes_sent":"$body_bytes_sent",'
30
+ '"request_time":"$request_time",'
31
+ '"http_referrer":"$http_referer",'
32
+ '"http_user_agent":"$http_user_agent",'
33
+ '"upstream_addr":"$upstream_addr",'
34
+ '"upstream_response_time":"$upstream_response_time"'
35
+ '}';
36
+
37
+ # --- Logging ---
38
+ access_log /var/log/nginx/access.log json_combined;
39
+ error_log /var/log/nginx/error.log warn;
40
+
41
+ # --- Performance ---
42
+ sendfile on;
43
+ tcp_nopush on;
44
+ tcp_nodelay on;
45
+ keepalive_timeout 65;
46
+
47
+ # --- Gzip ---
48
+ gzip on;
49
+ gzip_vary on;
50
+ gzip_proxied any;
51
+ gzip_comp_level 6;
52
+ gzip_types text/plain text/css application/json application/javascript
53
+ text/xml application/xml application/xml+rss text/javascript
54
+ image/svg+xml;
55
+
56
+ # --- Upstream (Backend) ---
57
+ upstream backend {
58
+ server backend:8000;
59
+ }
60
+
61
+ # --- Rate Limiting ---
62
+ limit_req_zone $binary_remote_addr zone=api_limit:10m rate=10r/s;
63
+ limit_req_zone $binary_remote_addr zone=general_limit:10m rate=30r/s;
64
+
65
+ # --- Site Configs ---
66
+ include /etc/nginx/conf.d/*.conf;
67
+ }
@@ -0,0 +1,66 @@
1
+ # ============================================
2
+ # Local Development — HTTP Only (No SSL)
3
+ # ============================================
4
+
5
+ server {
6
+ listen 80;
7
+ server_name localhost;
8
+
9
+ client_max_body_size 10M;
10
+
11
+ # === Static Files ===
12
+ location /static/ {
13
+ alias /app/staticfiles/;
14
+ expires 1y;
15
+ add_header Cache-Control "public, immutable";
16
+ }
17
+
18
+ # === Media ===
19
+ location /media/ {
20
+ alias /app/media/;
21
+ expires 1y;
22
+ add_header Cache-Control "public, immutable";
23
+ add_header Access-Control-Allow-Origin "*";
24
+ }
25
+
26
+ # === API → Backend ===
27
+ location /api/ {
28
+ proxy_pass http://backend;
29
+ proxy_http_version 1.1;
30
+ proxy_set_header Host $host;
31
+ proxy_set_header X-Real-IP $remote_addr;
32
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
33
+ proxy_set_header X-Forwarded-Proto $scheme;
34
+ proxy_connect_timeout 60s;
35
+ proxy_send_timeout 60s;
36
+ proxy_read_timeout 60s;
37
+ }
38
+
39
+ # === Swagger / OpenAPI ===
40
+ location /docs {
41
+ proxy_pass http://backend;
42
+ proxy_http_version 1.1;
43
+ proxy_set_header Host $host;
44
+ proxy_set_header X-Real-IP $remote_addr;
45
+ }
46
+
47
+ location /openapi.json {
48
+ proxy_pass http://backend;
49
+ }
50
+
51
+ # === Health ===
52
+ location /health {
53
+ proxy_pass http://backend/api/v1/health;
54
+ access_log off;
55
+ }
56
+
57
+ # === All other requests → Django Backend ===
58
+ location / {
59
+ proxy_pass http://backend;
60
+ proxy_http_version 1.1;
61
+ proxy_set_header Host $host;
62
+ proxy_set_header X-Real-IP $remote_addr;
63
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
64
+ proxy_set_header X-Forwarded-Proto $scheme;
65
+ }
66
+ }
@@ -0,0 +1,25 @@
1
+ # === STAGE 1: Builder ===
2
+ FROM python:{{ python_version }}-slim AS builder
3
+ WORKDIR /app
4
+
5
+ COPY pyproject.toml README.md ./
6
+ COPY src ./src
7
+
8
+ RUN python -m venv /app/.venv
9
+ RUN /app/.venv/bin/pip install --upgrade pip
10
+ RUN /app/.venv/bin/pip install --no-cache-dir .
11
+
12
+ # === STAGE 2: Runtime ===
13
+ FROM python:{{ python_version }}-slim
14
+ WORKDIR /app
15
+ RUN useradd -m -u 1000 appuser
16
+ COPY --from=builder /app/.venv /app/.venv
17
+
18
+ COPY src/workers /app/src/workers
19
+ COPY src/{{ project_name }} /app/src/{{ project_name }}
20
+
21
+ RUN mkdir -p /app/logs && chown -R appuser:appuser /app
22
+
23
+ USER appuser
24
+ ENV PATH="/app/.venv/bin:$PATH"
25
+ ENV PYTHONPATH="/app:$PYTHONPATH"
@@ -0,0 +1,38 @@
1
+ # === Base Image for {{ cluster_name }} Cluster (Multi-Stage) ===
2
+
3
+ # ── Stage 1: Builder ──────────────────────────────────────────
4
+ FROM python:{{ python_version }}-slim AS builder
5
+
6
+ ENV PYTHONDONTWRITEBYTECODE=1 \
7
+ PYTHONUNBUFFERED=1
8
+
9
+ RUN apt-get update && apt-get install -y \
10
+ gcc \
11
+ g++ \
12
+ libpq-dev \
13
+ && rm -rf /var/lib/apt/lists/*
14
+
15
+ WORKDIR /app
16
+
17
+ COPY pyproject.toml README.md ./
18
+ COPY src ./src
19
+ RUN pip install --no-cache-dir --upgrade pip
20
+ RUN pip install --no-cache-dir .
21
+
22
+ # ── Stage 2: Runtime ──────────────────────────────────────────
23
+ FROM python:{{ python_version }}-slim
24
+
25
+ ENV PYTHONDONTWRITEBYTECODE=1 \
26
+ PYTHONUNBUFFERED=1 \
27
+ IS_DOCKER=True
28
+
29
+ RUN apt-get update && apt-get install -y \
30
+ libpq5 \
31
+ curl \
32
+ procps \
33
+ && rm -rf /var/lib/apt/lists/*
34
+
35
+ COPY --from=builder /usr/local/lib/python{{ python_version }}/site-packages/ /usr/local/lib/python{{ python_version }}/site-packages/
36
+ COPY --from=builder /usr/local/bin/ /usr/local/bin/
37
+
38
+ WORKDIR /app
@@ -0,0 +1,27 @@
1
+ # === Django Project Image ===
2
+ ARG BASE_IMAGE={{ project_name }}-base:latest
3
+ FROM ${BASE_IMAGE}
4
+
5
+ WORKDIR /app
6
+
7
+ RUN useradd -m -u 1000 appuser
8
+
9
+ # PROJECT_ID is set per-project during CI/CD build
10
+ ARG PROJECT_ID={{ project_name }}
11
+ COPY src/${PROJECT_ID} /app
12
+
13
+ RUN mkdir -p /app/staticfiles /app/media /app/logs/backend && \
14
+ chown -R appuser:appuser /app && \
15
+ chmod -R 755 /app/media /app/logs/backend
16
+
17
+ COPY deploy/docker/entrypoint.sh /entrypoint.sh
18
+ RUN chmod +x /entrypoint.sh
19
+
20
+ USER appuser
21
+
22
+ ENV PYTHONPATH="/app:$PYTHONPATH"
23
+
24
+ HEALTHCHECK --interval=30s --timeout=10s --retries=3 \
25
+ CMD curl -f http://localhost:8000/api/v1/health || exit 1
26
+
27
+ ENTRYPOINT ["/entrypoint.sh"]
@@ -0,0 +1,19 @@
1
+ #!/bin/sh
2
+ set -e
3
+
4
+ if [ "$#" -gt 0 ]; then
5
+ echo "Running command: $@"
6
+ exec "$@"
7
+ fi
8
+
9
+ echo "Running collectstatic..."
10
+ python /app/manage.py collectstatic --noinput
11
+
12
+ echo "Running migrations..."
13
+ python /app/manage.py migrate --noinput
14
+
15
+ echo "Starting gunicorn..."
16
+ exec gunicorn {{ project_name }}.core.wsgi:application \
17
+ --bind 0.0.0.0:8000 \
18
+ --workers ${GUNICORN_WORKERS:-2} \
19
+ --timeout 90
@@ -0,0 +1,41 @@
1
+ services:
2
+ # --- Project Backend ---
3
+ backend:
4
+ image: ${DOCKER_IMAGE_BACKEND}
5
+ container_name: ${PROJECT_NAME:-{{ project_name }}}-backend
6
+ env_file:
7
+ - .env
8
+ - src/{{ project_name }}/.env
9
+ environment:
10
+ DJANGO_SETTINGS_MODULE: "{{ project_name }}.core.settings.prod"
11
+ PROJECT_NAME: ${PROJECT_NAME:-{{ project_name }}}
12
+ volumes:
13
+ - static_volume:/app/staticfiles/${PROJECT_NAME:-{{ project_name }}}
14
+ - media_volume:/app/media/${PROJECT_NAME:-{{ project_name }}}
15
+ - logs_volume:/app/logs/backend
16
+ expose:
17
+ - "8000"
18
+ healthcheck:
19
+ test: ["CMD", "curl", "-f", "http://localhost:8000/api/v1/health"]
20
+ interval: 30s
21
+ timeout: 10s
22
+ retries: 3
23
+ start_period: 40s
24
+ restart: always
25
+ networks:
26
+ - {{ cluster_name }}-cluster-network
27
+
28
+ volumes:
29
+ static_volume:
30
+ external: true
31
+ name: {{ cluster_name }}_cluster_static
32
+ media_volume:
33
+ external: true
34
+ name: {{ cluster_name }}_cluster_media
35
+ logs_volume:
36
+ driver: local
37
+
38
+ networks:
39
+ {{ cluster_name }}-cluster-network:
40
+ external: true
41
+ name: {{ cluster_name }}-cluster-network
@@ -0,0 +1,80 @@
1
+ services:
2
+ # --- Shared Redis ---
3
+ redis:
4
+ image: redis:7-alpine
5
+ container_name: {{ cluster_name }}-cluster-redis
6
+ environment:
7
+ - REDIS_PASSWORD=${REDIS_PASSWORD:-change_me}
8
+ command: >
9
+ sh -c "redis-server --requirepass $${REDIS_PASSWORD} --appendonly yes"
10
+ volumes:
11
+ - redis-data:/data
12
+ healthcheck:
13
+ test: ["CMD", "sh", "-c", "REDISCLI_AUTH=$${REDIS_PASSWORD} redis-cli ping"]
14
+ interval: 10s
15
+ timeout: 5s
16
+ retries: 3
17
+ restart: unless-stopped
18
+ networks:
19
+ - {{ cluster_name }}-cluster-network
20
+ {% if with_worker %}
21
+
22
+ # --- Shared Worker (Notifications) ---
23
+ worker:
24
+ image: ${DOCKER_IMAGE_WORKER}
25
+ container_name: {{ cluster_name }}-cluster-worker
26
+ env_file: .env
27
+ depends_on:
28
+ redis:
29
+ condition: service_healthy
30
+ command: arq src.workers.notification_worker.worker.WorkerSettings
31
+ restart: always
32
+ networks:
33
+ - {{ cluster_name }}-cluster-network
34
+ {% endif %}
35
+
36
+ # --- Shared Nginx ---
37
+ nginx:
38
+ image: ${DOCKER_IMAGE_NGINX}
39
+ container_name: {{ cluster_name }}-cluster-nginx
40
+ ports:
41
+ - "80:80"
42
+ - "443:443"
43
+ volumes:
44
+ - ./nginx/conf.d:/etc/nginx/conf.d:ro
45
+ - static_volume:/app/staticfiles:ro
46
+ - media_volume:/app/media:ro
47
+ - certs_volume:/etc/letsencrypt:ro
48
+ - certbot_challenge_volume:/var/www/certbot:ro
49
+ depends_on:
50
+ - redis
51
+ restart: always
52
+ networks:
53
+ - {{ cluster_name }}-cluster-network
54
+
55
+ # --- Shared Certbot ---
56
+ certbot:
57
+ image: certbot/certbot:latest
58
+ container_name: {{ cluster_name }}-cluster-certbot
59
+ volumes:
60
+ - certs_volume:/etc/letsencrypt
61
+ - certbot_challenge_volume:/var/www/certbot
62
+ entrypoint: "/bin/sh -c 'trap exit TERM; while :; do certbot renew; sleep 12h & wait $${!}; done;'"
63
+ networks:
64
+ - {{ cluster_name }}-cluster-network
65
+
66
+ volumes:
67
+ redis-data:
68
+ static_volume:
69
+ name: {{ cluster_name }}_cluster_static
70
+ media_volume:
71
+ name: {{ cluster_name }}_cluster_media
72
+ certs_volume:
73
+ name: {{ cluster_name }}_cluster_certs
74
+ certbot_challenge_volume:
75
+ name: {{ cluster_name }}_cluster_certbot_challenge
76
+
77
+ networks:
78
+ {{ cluster_name }}-cluster-network:
79
+ name: {{ cluster_name }}-cluster-network
80
+ driver: bridge
@@ -0,0 +1,41 @@
1
+ services:
2
+ # --- Project Backend (Local with Hot-Reload) ---
3
+ backend:
4
+ build:
5
+ context: ..
6
+ dockerfile: deploy/docker/django.Dockerfile
7
+ args:
8
+ BASE_IMAGE: {{ project_name }}-base:latest
9
+ PROJECT_ID: {{ project_name }}
10
+ image: {{ project_name }}-backend:local
11
+ container_name: {{ project_name }}-backend-local
12
+ env_file: ../.env
13
+ environment:
14
+ - PROJECT_NAME={{ project_name }}
15
+ - DEBUG=True
16
+ - DJANGO_SETTINGS_MODULE={{ project_name }}.core.settings.dev
17
+ volumes:
18
+ - ../src/{{ project_name }}:/app
19
+ - static_local:/app/staticfiles/{{ project_name }}
20
+ - media_local:/app/media/{{ project_name }}
21
+ expose:
22
+ - "8000"
23
+ command: python manage.py runserver 0.0.0.0:8000
24
+ depends_on:
25
+ - redis
26
+ - db
27
+ networks:
28
+ - {{ cluster_name }}-cluster-local-network
29
+
30
+ volumes:
31
+ static_local:
32
+ external: true
33
+ name: {{ cluster_name }}_cluster_static_local
34
+ media_local:
35
+ external: true
36
+ name: {{ cluster_name }}_cluster_media_local
37
+
38
+ networks:
39
+ {{ cluster_name }}-cluster-local-network:
40
+ external: true
41
+ name: {{ cluster_name }}-cluster-local-network