djaploy 1.5.2__tar.gz → 1.5.4__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 (105) hide show
  1. {djaploy-1.5.2 → djaploy-1.5.4}/PKG-INFO +1 -1
  2. {djaploy-1.5.2 → djaploy-1.5.4}/djaploy/infra/charts/django-app/Chart.yaml +1 -1
  3. {djaploy-1.5.2 → djaploy-1.5.4}/djaploy/infra/charts/django-app/templates/configmap.yaml +27 -0
  4. {djaploy-1.5.2 → djaploy-1.5.4}/djaploy/infra/charts/django-app/templates/deployment.yaml +25 -2
  5. {djaploy-1.5.2 → djaploy-1.5.4}/djaploy/infra/charts/django-app/values.yaml +8 -0
  6. djaploy-1.5.4/djaploy/version.py +1 -0
  7. {djaploy-1.5.2 → djaploy-1.5.4}/djaploy.egg-info/PKG-INFO +1 -1
  8. {djaploy-1.5.2 → djaploy-1.5.4}/pyproject.toml +1 -1
  9. {djaploy-1.5.2 → djaploy-1.5.4}/tests/test_k3s.py +1 -1
  10. djaploy-1.5.2/djaploy/version.py +0 -1
  11. {djaploy-1.5.2 → djaploy-1.5.4}/LICENSE +0 -0
  12. {djaploy-1.5.2 → djaploy-1.5.4}/README.md +0 -0
  13. {djaploy-1.5.2 → djaploy-1.5.4}/djaploy/__init__.py +0 -0
  14. {djaploy-1.5.2 → djaploy-1.5.4}/djaploy/app.py +0 -0
  15. {djaploy-1.5.2 → djaploy-1.5.4}/djaploy/apps/__init__.py +0 -0
  16. {djaploy-1.5.2 → djaploy-1.5.4}/djaploy/apps/borg/__init__.py +0 -0
  17. {djaploy-1.5.2 → djaploy-1.5.4}/djaploy/apps/borg/infra/__init__.py +0 -0
  18. {djaploy-1.5.2 → djaploy-1.5.4}/djaploy/apps/borg/infra/djaploy_hooks.py +0 -0
  19. {djaploy-1.5.2 → djaploy-1.5.4}/djaploy/apps/janitor/__init__.py +0 -0
  20. {djaploy-1.5.2 → djaploy-1.5.4}/djaploy/apps/janitor/apps.py +0 -0
  21. {djaploy-1.5.2 → djaploy-1.5.4}/djaploy/apps/janitor/infra/__init__.py +0 -0
  22. {djaploy-1.5.2 → djaploy-1.5.4}/djaploy/apps/janitor/infra/commands/createjanitoruser.py +0 -0
  23. {djaploy-1.5.2 → djaploy-1.5.4}/djaploy/apps/janitor/infra/djaploy_hooks.py +0 -0
  24. {djaploy-1.5.2 → djaploy-1.5.4}/djaploy/apps/nginx/__init__.py +0 -0
  25. {djaploy-1.5.2 → djaploy-1.5.4}/djaploy/apps/nginx/apps.py +0 -0
  26. {djaploy-1.5.2 → djaploy-1.5.4}/djaploy/apps/nginx/infra/__init__.py +0 -0
  27. {djaploy-1.5.2 → djaploy-1.5.4}/djaploy/apps/nginx/infra/djaploy_hooks.py +0 -0
  28. {djaploy-1.5.2 → djaploy-1.5.4}/djaploy/apps/rclone/__init__.py +0 -0
  29. {djaploy-1.5.2 → djaploy-1.5.4}/djaploy/apps/rclone/apps.py +0 -0
  30. {djaploy-1.5.2 → djaploy-1.5.4}/djaploy/apps/rclone/infra/__init__.py +0 -0
  31. {djaploy-1.5.2 → djaploy-1.5.4}/djaploy/apps/rclone/infra/djaploy_hooks.py +0 -0
  32. {djaploy-1.5.2 → djaploy-1.5.4}/djaploy/apps/sync_certs/__init__.py +0 -0
  33. {djaploy-1.5.2 → djaploy-1.5.4}/djaploy/apps/sync_certs/apps.py +0 -0
  34. {djaploy-1.5.2 → djaploy-1.5.4}/djaploy/apps/sync_certs/infra/__init__.py +0 -0
  35. {djaploy-1.5.2 → djaploy-1.5.4}/djaploy/apps/sync_certs/infra/djaploy_hooks.py +0 -0
  36. {djaploy-1.5.2 → djaploy-1.5.4}/djaploy/apps/systemd/__init__.py +0 -0
  37. {djaploy-1.5.2 → djaploy-1.5.4}/djaploy/apps/systemd/apps.py +0 -0
  38. {djaploy-1.5.2 → djaploy-1.5.4}/djaploy/apps/systemd/infra/__init__.py +0 -0
  39. {djaploy-1.5.2 → djaploy-1.5.4}/djaploy/apps/systemd/infra/djaploy_hooks.py +0 -0
  40. {djaploy-1.5.2 → djaploy-1.5.4}/djaploy/apps/tailscale/__init__.py +0 -0
  41. {djaploy-1.5.2 → djaploy-1.5.4}/djaploy/apps/tailscale/apps.py +0 -0
  42. {djaploy-1.5.2 → djaploy-1.5.4}/djaploy/apps/tailscale/infra/__init__.py +0 -0
  43. {djaploy-1.5.2 → djaploy-1.5.4}/djaploy/apps/tailscale/infra/djaploy_hooks.py +0 -0
  44. {djaploy-1.5.2 → djaploy-1.5.4}/djaploy/apps/versioning/__init__.py +0 -0
  45. {djaploy-1.5.2 → djaploy-1.5.4}/djaploy/apps/versioning/apps.py +0 -0
  46. {djaploy-1.5.2 → djaploy-1.5.4}/djaploy/apps/versioning/infra/__init__.py +0 -0
  47. {djaploy-1.5.2 → djaploy-1.5.4}/djaploy/apps/versioning/infra/djaploy_hooks.py +0 -0
  48. {djaploy-1.5.2 → djaploy-1.5.4}/djaploy/artifact.py +0 -0
  49. {djaploy-1.5.2 → djaploy-1.5.4}/djaploy/bin/__init__.py +0 -0
  50. {djaploy-1.5.2 → djaploy-1.5.4}/djaploy/bin/django_pyinfra.py +0 -0
  51. {djaploy-1.5.2 → djaploy-1.5.4}/djaploy/bin/gunicornherder.py +0 -0
  52. {djaploy-1.5.2 → djaploy-1.5.4}/djaploy/builtin_hooks.py +0 -0
  53. {djaploy-1.5.2 → djaploy-1.5.4}/djaploy/certificates.py +0 -0
  54. {djaploy-1.5.2 → djaploy-1.5.4}/djaploy/changelog.py +0 -0
  55. {djaploy-1.5.2 → djaploy-1.5.4}/djaploy/commands/__init__.py +0 -0
  56. {djaploy-1.5.2 → djaploy-1.5.4}/djaploy/commands/_utils.py +0 -0
  57. {djaploy-1.5.2 → djaploy-1.5.4}/djaploy/commands/activate.py +0 -0
  58. {djaploy-1.5.2 → djaploy-1.5.4}/djaploy/commands/configure.py +0 -0
  59. {djaploy-1.5.2 → djaploy-1.5.4}/djaploy/commands/deploy.py +0 -0
  60. {djaploy-1.5.2 → djaploy-1.5.4}/djaploy/commands/restore.py +0 -0
  61. {djaploy-1.5.2 → djaploy-1.5.4}/djaploy/commands/rollback.py +0 -0
  62. {djaploy-1.5.2 → djaploy-1.5.4}/djaploy/commands/status.py +0 -0
  63. {djaploy-1.5.2 → djaploy-1.5.4}/djaploy/commands/sync_certs.py +0 -0
  64. {djaploy-1.5.2 → djaploy-1.5.4}/djaploy/config.py +0 -0
  65. {djaploy-1.5.2 → djaploy-1.5.4}/djaploy/deploy.py +0 -0
  66. {djaploy-1.5.2 → djaploy-1.5.4}/djaploy/discovery.py +0 -0
  67. {djaploy-1.5.2 → djaploy-1.5.4}/djaploy/hooks.py +0 -0
  68. {djaploy-1.5.2 → djaploy-1.5.4}/djaploy/infra/__init__.py +0 -0
  69. {djaploy-1.5.2 → djaploy-1.5.4}/djaploy/infra/bluegreen.py +0 -0
  70. {djaploy-1.5.2 → djaploy-1.5.4}/djaploy/infra/charts/django-app/templates/_helpers.tpl +0 -0
  71. {djaploy-1.5.2 → djaploy-1.5.4}/djaploy/infra/charts/django-app/templates/cronjobs.yaml +0 -0
  72. {djaploy-1.5.2 → djaploy-1.5.4}/djaploy/infra/charts/django-app/templates/ingress.yaml +0 -0
  73. {djaploy-1.5.2 → djaploy-1.5.4}/djaploy/infra/charts/django-app/templates/onepassword.yaml +0 -0
  74. {djaploy-1.5.2 → djaploy-1.5.4}/djaploy/infra/charts/django-app/templates/pvc.yaml +0 -0
  75. {djaploy-1.5.2 → djaploy-1.5.4}/djaploy/infra/charts/django-app/templates/service.yaml +0 -0
  76. {djaploy-1.5.2 → djaploy-1.5.4}/djaploy/infra/charts/django-app/templates/workers.yaml +0 -0
  77. {djaploy-1.5.2 → djaploy-1.5.4}/djaploy/infra/djaploy_hooks.py +0 -0
  78. {djaploy-1.5.2 → djaploy-1.5.4}/djaploy/infra/k3s.py +0 -0
  79. {djaploy-1.5.2 → djaploy-1.5.4}/djaploy/infra/templates.py +0 -0
  80. {djaploy-1.5.2 → djaploy-1.5.4}/djaploy/infra/utils.py +0 -0
  81. {djaploy-1.5.2 → djaploy-1.5.4}/djaploy/management/__init__.py +0 -0
  82. {djaploy-1.5.2 → djaploy-1.5.4}/djaploy/management/commands/__init__.py +0 -0
  83. {djaploy-1.5.2 → djaploy-1.5.4}/djaploy/management/commands/djaploy.py +0 -0
  84. {djaploy-1.5.2 → djaploy-1.5.4}/djaploy/management/commands/restore_backup.py +0 -0
  85. {djaploy-1.5.2 → djaploy-1.5.4}/djaploy/management/commands/sync_certs.py +0 -0
  86. {djaploy-1.5.2 → djaploy-1.5.4}/djaploy/management/commands/update_certs.py +0 -0
  87. {djaploy-1.5.2 → djaploy-1.5.4}/djaploy/management/commands/verify.py +0 -0
  88. {djaploy-1.5.2 → djaploy-1.5.4}/djaploy/management/utils.py +0 -0
  89. {djaploy-1.5.2 → djaploy-1.5.4}/djaploy/notifications.py +0 -0
  90. {djaploy-1.5.2 → djaploy-1.5.4}/djaploy/utils.py +0 -0
  91. {djaploy-1.5.2 → djaploy-1.5.4}/djaploy/versioning.py +0 -0
  92. {djaploy-1.5.2 → djaploy-1.5.4}/djaploy.egg-info/SOURCES.txt +0 -0
  93. {djaploy-1.5.2 → djaploy-1.5.4}/djaploy.egg-info/dependency_links.txt +0 -0
  94. {djaploy-1.5.2 → djaploy-1.5.4}/djaploy.egg-info/entry_points.txt +0 -0
  95. {djaploy-1.5.2 → djaploy-1.5.4}/djaploy.egg-info/requires.txt +0 -0
  96. {djaploy-1.5.2 → djaploy-1.5.4}/djaploy.egg-info/top_level.txt +0 -0
  97. {djaploy-1.5.2 → djaploy-1.5.4}/setup.cfg +0 -0
  98. {djaploy-1.5.2 → djaploy-1.5.4}/tests/test_bluegreen.py +0 -0
  99. {djaploy-1.5.2 → djaploy-1.5.4}/tests/test_borg.py +0 -0
  100. {djaploy-1.5.2 → djaploy-1.5.4}/tests/test_config.py +0 -0
  101. {djaploy-1.5.2 → djaploy-1.5.4}/tests/test_deploy_scripts.py +0 -0
  102. {djaploy-1.5.2 → djaploy-1.5.4}/tests/test_discovery.py +0 -0
  103. {djaploy-1.5.2 → djaploy-1.5.4}/tests/test_gunicornherder.py +0 -0
  104. {djaploy-1.5.2 → djaploy-1.5.4}/tests/test_hooks.py +0 -0
  105. {djaploy-1.5.2 → djaploy-1.5.4}/tests/test_versioning.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: djaploy
3
- Version: 1.5.2
3
+ Version: 1.5.4
4
4
  Summary: Modular Django deployment system based on pyinfra
5
5
  Author-email: Johanna Mae Dimayuga <johanna@techco.fi>
6
6
  License: MIT License
@@ -2,4 +2,4 @@ apiVersion: v2
2
2
  name: django-app
3
3
  description: A Django app the way djaploy ran it (gunicorn + nginx + SQLite/media on local disk), on k3s.
4
4
  type: application
5
- version: 0.2.2
5
+ version: 0.2.4
@@ -57,10 +57,37 @@ data:
57
57
  {{- if and (eq .Values.database.engine "sqlite") .Values.database.sqlite.snapshotBeforeMigrate }}
58
58
  python /scripts/snapshot.py {{ .Values.database.sqlite.keepSnapshots }}
59
59
  {{- end }}
60
+ {{- if .Values.django.settingsModule }}
61
+ python /scripts/rollout.py
62
+ {{- else }}
63
+ {{- /* no settings module: let manage.py pick its default, one process per command */}}
60
64
  python {{ .Values.django.managePy }} migrate --noinput
61
65
  {{- range .Values.migrations.extraCommands }}
62
66
  python {{ $.Values.django.managePy }} {{ . }}
63
67
  {{- end }}
68
+ {{- end }}
69
+ # migrate + extraCommands in one process: Django starts once (~1 s on the
70
+ # node) instead of once per command.
71
+ rollout.py: |
72
+ import os
73
+ import shlex
74
+ import sys
75
+
76
+ MANAGE_PY = {{ .Values.django.managePy | quote }}
77
+ EXTRA_COMMANDS = {{ toJson (.Values.migrations.extraCommands | default list) }}
78
+
79
+ # What `python manage.py` does: its folder goes first on the path.
80
+ sys.path.insert(0, os.path.dirname(os.path.abspath(MANAGE_PY)))
81
+
82
+ import django
83
+ from django.core.management import call_command
84
+
85
+ django.setup()
86
+ print("==> migrate", flush=True)
87
+ call_command("migrate", interactive=False, skip_checks=False) # system checks, as manage.py migrate
88
+ for command in EXTRA_COMMANDS:
89
+ print(f"==> {command}", flush=True)
90
+ call_command(*shlex.split(command))
64
91
  snapshot.py: |
65
92
  """Consistent copy of the SQLite DB before migrating (the rollback point)."""
66
93
  import glob, os, sqlite3, sys, time
@@ -1,5 +1,10 @@
1
1
  {{- $sqlite := eq .Values.database.engine "sqlite" -}}
2
2
  {{- $fullname := include "django-app.fullname" . -}}
3
+ {{- $strategy := .Values.strategy | default (ternary "Recreate" "RollingUpdate" $sqlite) -}}
4
+ {{- if not (has $strategy (list "Recreate" "RollingUpdate")) }}
5
+ {{- fail (printf "strategy must be Recreate or RollingUpdate, not %q" $strategy) }}
6
+ {{- end }}
7
+ {{- $rolling := eq $strategy "RollingUpdate" -}}
3
8
  apiVersion: apps/v1
4
9
  kind: Deployment
5
10
  metadata:
@@ -7,11 +12,17 @@ metadata:
7
12
  labels:
8
13
  {{- include "django-app.labels" . | nindent 4 }}
9
14
  spec:
10
- # SQLite on a local disk + in-process background work: never two pods at once.
15
+ # SQLite: one pod (a rolling update briefly runs the new one beside it).
11
16
  replicas: {{ if .Values.suspended }}0{{ else if $sqlite }}1{{ else }}{{ .Values.replicas }}{{ end }}
12
17
  revisionHistoryLimit: 5
13
18
  strategy:
14
- type: {{ if $sqlite }}Recreate{{ else }}RollingUpdate{{ end }}
19
+ type: {{ $strategy }}
20
+ {{- if $rolling }}
21
+ # Start the new pod, wait until it's ready, then stop the old one.
22
+ rollingUpdate:
23
+ maxSurge: 1
24
+ maxUnavailable: 0
25
+ {{- end }}
15
26
  selector:
16
27
  matchLabels:
17
28
  {{- include "django-app.selectorLabels" (dict "root" . "component" "web") | nindent 6 }}
@@ -61,6 +72,12 @@ spec:
61
72
  {{- include "django-app.containerEnv" . | nindent 10 }}
62
73
  ports:
63
74
  - { name: gunicorn, containerPort: 8000 }
75
+ {{- if $rolling }}
76
+ # Keep serving while Traefik stops routing to this pod.
77
+ lifecycle:
78
+ preStop:
79
+ exec: { command: ["sleep", "5"] }
80
+ {{- end }}
64
81
  # Host + X-Forwarded-Proto so ALLOWED_HOSTS and SECURE_SSL_REDIRECT accept the probe.
65
82
  startupProbe:
66
83
  {{- include "django-app.probe" . | nindent 12 }}
@@ -84,6 +101,12 @@ spec:
84
101
  image: {{ .Values.nginx.image }}
85
102
  ports:
86
103
  - { name: http, containerPort: 8080 }
104
+ {{- if $rolling }}
105
+ # Keep serving while Traefik stops routing to this pod.
106
+ lifecycle:
107
+ preStop:
108
+ exec: { command: ["sleep", "5"] }
109
+ {{- end }}
87
110
  readinessProbe:
88
111
  tcpSocket: { port: http }
89
112
  periodSeconds: {{ .Values.probes.readinessPeriodSeconds }}
@@ -57,6 +57,14 @@ migrations:
57
57
  # -- Ignored (always 1) while database.engine is sqlite.
58
58
  replicas: 1
59
59
 
60
+ # -- Recreate (stop the old pod, then start the new one) or RollingUpdate (start
61
+ # the new pod beside the old one, switch when it's ready: no downtime). Default:
62
+ # Recreate for SQLite, RollingUpdate for Postgres. A SQLite app on RollingUpdate
63
+ # briefly has two pods on the same database, and the new one migrates while the
64
+ # old one still serves: its migrations must not break the running version, and
65
+ # startup work mustn't redo what the old pod is still doing.
66
+ strategy: ""
67
+
60
68
  storage:
61
69
  size: 10Gi
62
70
  storageClassName: local-path-retain
@@ -0,0 +1 @@
1
+ __version__ = "1.5.4"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: djaploy
3
- Version: 1.5.2
3
+ Version: 1.5.4
4
4
  Summary: Modular Django deployment system based on pyinfra
5
5
  Author-email: Johanna Mae Dimayuga <johanna@techco.fi>
6
6
  License: MIT License
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "djaploy"
3
- version = "1.5.2"
3
+ version = "1.5.4"
4
4
  description = "Modular Django deployment system based on pyinfra"
5
5
  authors = [
6
6
  {name = "Johanna Mae Dimayuga", email = "johanna@techco.fi"}
@@ -108,7 +108,7 @@ class ImageRefTests(unittest.TestCase):
108
108
 
109
109
  class ChartTests(unittest.TestCase):
110
110
  def test_bundled_chart_version(self):
111
- self.assertEqual(k3s.chart_version(), "0.2.2")
111
+ self.assertEqual(k3s.chart_version(), "0.2.4")
112
112
 
113
113
 
114
114
  class BuildModeTests(unittest.TestCase):
@@ -1 +0,0 @@
1
- __version__ = "1.5.2"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes