pulumi-django-azure 1.0.38__tar.gz → 1.0.39__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.
Potentially problematic release.
This version of pulumi-django-azure might be problematic. Click here for more details.
- {pulumi_django_azure-1.0.38 → pulumi_django_azure-1.0.39}/PKG-INFO +6 -4
- {pulumi_django_azure-1.0.38 → pulumi_django_azure-1.0.39}/pyproject.toml +8 -22
- {pulumi_django_azure-1.0.38 → pulumi_django_azure-1.0.39}/src/pulumi_django_azure/django_deployment.py +51 -67
- {pulumi_django_azure-1.0.38 → pulumi_django_azure-1.0.39}/src/pulumi_django_azure/settings.py +17 -0
- {pulumi_django_azure-1.0.38 → pulumi_django_azure-1.0.39}/README.md +0 -0
- {pulumi_django_azure-1.0.38 → pulumi_django_azure-1.0.39}/src/pulumi_django_azure/__init__.py +0 -0
- {pulumi_django_azure-1.0.38 → pulumi_django_azure-1.0.39}/src/pulumi_django_azure/azure_helper.py +0 -0
- {pulumi_django_azure-1.0.38 → pulumi_django_azure-1.0.39}/src/pulumi_django_azure/context_processors.py +0 -0
- {pulumi_django_azure-1.0.38 → pulumi_django_azure-1.0.39}/src/pulumi_django_azure/management/commands/__init__.py +0 -0
- {pulumi_django_azure-1.0.38 → pulumi_django_azure-1.0.39}/src/pulumi_django_azure/management/commands/purge_cache.py +0 -0
- {pulumi_django_azure-1.0.38 → pulumi_django_azure-1.0.39}/src/pulumi_django_azure/management/commands/purge_cdn.py +0 -0
- {pulumi_django_azure-1.0.38 → pulumi_django_azure-1.0.39}/src/pulumi_django_azure/management/commands/test_redis.py +0 -0
- {pulumi_django_azure-1.0.38 → pulumi_django_azure-1.0.39}/src/pulumi_django_azure/middleware.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pulumi-django-azure
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.39
|
|
4
4
|
Summary: Simply deployment of Django on Azure with Pulumi
|
|
5
5
|
License-Expression: MIT
|
|
6
6
|
Keywords: django,pulumi,azure
|
|
@@ -9,7 +9,7 @@ Author-email: maarten@youreal.eu
|
|
|
9
9
|
Requires-Python: >=3.11,<3.14
|
|
10
10
|
Classifier: Programming Language :: Python
|
|
11
11
|
Classifier: Programming Language :: Python :: 3
|
|
12
|
-
Requires-Dist: azure-identity (>=1.25.
|
|
12
|
+
Requires-Dist: azure-identity (>=1.25.1,<2.0.0)
|
|
13
13
|
Requires-Dist: azure-keyvault-secrets (>=4.10.0,<5.0.0)
|
|
14
14
|
Requires-Dist: azure-mgmt-cdn (>=13.1.1,<14.0.0)
|
|
15
15
|
Requires-Dist: azure-mgmt-resource (>=24.0.0,<25.0.0)
|
|
@@ -18,9 +18,11 @@ Requires-Dist: django-azure-communication-email (>=1.4.0,<2.0.0)
|
|
|
18
18
|
Requires-Dist: django-environ (>=0.12.0,<0.13.0)
|
|
19
19
|
Requires-Dist: django-redis (>=6.0.0,<7.0.0)
|
|
20
20
|
Requires-Dist: django-storages[azure] (>=1.14.6,<2.0.0)
|
|
21
|
-
Requires-Dist:
|
|
21
|
+
Requires-Dist: django-tasks[rq] (>=0.8.0,<0.10.0)
|
|
22
|
+
Requires-Dist: pulumi (>=3.203.0)
|
|
23
|
+
Requires-Dist: pulumi-azure (>=6.28.0,<7.0.0)
|
|
22
24
|
Requires-Dist: pulumi-azure-native (>=3.8.0)
|
|
23
|
-
Requires-Dist: pulumi-random (>=4.18.
|
|
25
|
+
Requires-Dist: pulumi-random (>=4.18.4)
|
|
24
26
|
Requires-Dist: redis[hiredis] (>=6.4.0,<7.0.0)
|
|
25
27
|
Requires-Dist: tenacity (>=9.1.2,<10.0.0)
|
|
26
28
|
Project-URL: Homepage, https://gitlab.com/MaartenUreel/pulumi-django-azure
|
|
@@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "pulumi-django-azure"
|
|
7
|
-
version = "1.0.
|
|
7
|
+
version = "1.0.39"
|
|
8
8
|
description = "Simply deployment of Django on Azure with Pulumi"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
authors = [{ name = "Maarten Ureel", email = "maarten@youreal.eu" }]
|
|
@@ -15,7 +15,7 @@ classifiers = [
|
|
|
15
15
|
]
|
|
16
16
|
keywords = ["django", "pulumi", "azure"]
|
|
17
17
|
dependencies = [
|
|
18
|
-
"azure-identity (>=1.25.
|
|
18
|
+
"azure-identity (>=1.25.1,<2.0.0)",
|
|
19
19
|
"azure-keyvault-secrets (>=4.10.0,<5.0.0)",
|
|
20
20
|
"azure-mgmt-cdn (>=13.1.1,<14.0.0)",
|
|
21
21
|
"azure-mgmt-resource (>=24.0.0,<25.0.0)",
|
|
@@ -24,9 +24,11 @@ dependencies = [
|
|
|
24
24
|
"django-environ (>=0.12.0,<0.13.0)",
|
|
25
25
|
"django-redis (>=6.0.0,<7.0.0)",
|
|
26
26
|
"django-storages[azure] (>=1.14.6,<2.0.0)",
|
|
27
|
-
"
|
|
27
|
+
"django-tasks[rq] (>=0.8.0,<0.10.0)",
|
|
28
|
+
"pulumi (>=3.203.0)",
|
|
29
|
+
"pulumi-azure (>=6.28.0,<7.0.0)",
|
|
28
30
|
"pulumi-azure-native (>=3.8.0)",
|
|
29
|
-
"pulumi-random (>=4.18.
|
|
31
|
+
"pulumi-random (>=4.18.4)",
|
|
30
32
|
"redis[hiredis] (>=6.4.0,<7.0.0)",
|
|
31
33
|
"tenacity (>=9.1.2,<10.0.0)"
|
|
32
34
|
]
|
|
@@ -35,28 +37,12 @@ requires-python = ">=3.11,<3.14"
|
|
|
35
37
|
[project.urls]
|
|
36
38
|
Homepage = "https://gitlab.com/MaartenUreel/pulumi-django-azure"
|
|
37
39
|
|
|
38
|
-
[tool.poetry.dependencies]
|
|
39
|
-
python = "^3.11,<3.14"
|
|
40
|
-
azure-identity = "^1.25.0"
|
|
41
|
-
azure-keyvault-secrets = "^4.10.0"
|
|
42
|
-
azure-mgmt-cdn = "^13.1.1"
|
|
43
|
-
azure-mgmt-resource = "^24.0.0"
|
|
44
|
-
django = "^5.2.7"
|
|
45
|
-
django-azure-communication-email = "^1.4.0"
|
|
46
|
-
django-environ = "^0.12.0"
|
|
47
|
-
django-redis = "^6.0.0"
|
|
48
|
-
django-storages = {extras = ["azure"], version = "^1.14.6"}
|
|
49
|
-
pulumi = ">=3.199.0"
|
|
50
|
-
pulumi-azure-native = ">=3.8.0"
|
|
51
|
-
pulumi-random = ">=4.18.3"
|
|
52
|
-
redis = {extras = ["hiredis"], version = "^6.4.0"}
|
|
53
|
-
tenacity = "^9.1.2"
|
|
54
40
|
|
|
55
41
|
[tool.poetry.group.dev.dependencies]
|
|
56
42
|
build = "^1.3.0"
|
|
57
|
-
mkdocs-material = "^9.6.
|
|
43
|
+
mkdocs-material = "^9.6.22"
|
|
58
44
|
pre-commit = "^4.3.0"
|
|
59
|
-
ruff = "^0.
|
|
45
|
+
ruff = "^0.14.1"
|
|
60
46
|
twine = "^6.2.0"
|
|
61
47
|
|
|
62
48
|
[tool.ruff]
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
from collections.abc import Sequence
|
|
2
2
|
|
|
3
3
|
import pulumi
|
|
4
|
+
import pulumi_azure as azure_classic
|
|
4
5
|
import pulumi_azure_native as azure
|
|
5
6
|
import pulumi_random
|
|
6
7
|
|
|
7
|
-
REDIS_IMAGE = "redis:8.2"
|
|
8
|
+
REDIS_IMAGE = "redis:8.2-alpine"
|
|
8
9
|
|
|
9
10
|
|
|
10
11
|
class HostDefinition:
|
|
@@ -478,16 +479,6 @@ class DjangoDeployment(pulumi.ComponentResource):
|
|
|
478
479
|
},
|
|
479
480
|
)
|
|
480
481
|
|
|
481
|
-
def _get_existing_web_app_host_name_binding(self, resource_group_name: str, app_name: str, host_name: str):
|
|
482
|
-
try:
|
|
483
|
-
return azure.web.get_web_app_host_name_binding(
|
|
484
|
-
resource_group_name=resource_group_name,
|
|
485
|
-
name=app_name,
|
|
486
|
-
host_name=host_name,
|
|
487
|
-
)
|
|
488
|
-
except Exception:
|
|
489
|
-
return None
|
|
490
|
-
|
|
491
482
|
def _add_webapp_host(
|
|
492
483
|
self,
|
|
493
484
|
app: azure.web.WebApp,
|
|
@@ -495,13 +486,9 @@ class DjangoDeployment(pulumi.ComponentResource):
|
|
|
495
486
|
suffix: str,
|
|
496
487
|
identifier: str,
|
|
497
488
|
depends_on: Sequence[pulumi.Resource] | None = None,
|
|
498
|
-
):
|
|
489
|
+
) -> azure.web.WebAppHostNameBinding:
|
|
499
490
|
"""
|
|
500
|
-
|
|
501
|
-
First we create a binding without a certificate,
|
|
502
|
-
then we create the certificate and then we update the binding.
|
|
503
|
-
|
|
504
|
-
The certificate needs the binding, and the binding needs the thumbprint of the certificate.
|
|
491
|
+
We need to use a few steps and CertificateBinding from Azure Classic to make this work.
|
|
505
492
|
|
|
506
493
|
See also: https://github.com/pulumi/pulumi-azure-native/issues/578
|
|
507
494
|
|
|
@@ -514,52 +501,37 @@ class DjangoDeployment(pulumi.ComponentResource):
|
|
|
514
501
|
if not depends_on:
|
|
515
502
|
depends_on = []
|
|
516
503
|
|
|
517
|
-
#
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
504
|
+
# Create a binding without a certificate
|
|
505
|
+
binding = azure.web.WebAppHostNameBinding(
|
|
506
|
+
f"host-binding-{suffix}-{identifier}",
|
|
507
|
+
resource_group_name=self._rg,
|
|
508
|
+
name=app.name,
|
|
509
|
+
host_name=host,
|
|
510
|
+
ssl_state=azure.web.SslState.DISABLED,
|
|
511
|
+
# Ignore changes in SSL state and thumbprint
|
|
512
|
+
opts=pulumi.ResourceOptions(depends_on=depends_on, ignore_changes=["ssl_state", "thumbprint"]),
|
|
524
513
|
)
|
|
525
514
|
|
|
526
|
-
# Create
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
server_farm_id=app.server_farm_id,
|
|
535
|
-
canonical_name=host,
|
|
536
|
-
host_names=[host],
|
|
537
|
-
opts=pulumi.ResourceOptions(depends_on=depends_on),
|
|
538
|
-
)
|
|
539
|
-
|
|
540
|
-
# Create a new binding, replacing the old one,
|
|
541
|
-
# with the certificate
|
|
542
|
-
azure.web.WebAppHostNameBinding(
|
|
543
|
-
f"host-binding-{suffix}-{identifier}",
|
|
544
|
-
resource_group_name=self._rg,
|
|
545
|
-
name=app.name,
|
|
546
|
-
host_name=host,
|
|
547
|
-
ssl_state=azure.web.SslState.SNI_ENABLED,
|
|
548
|
-
thumbprint=certificate.thumbprint,
|
|
549
|
-
opts=pulumi.ResourceOptions(depends_on=depends_on),
|
|
550
|
-
)
|
|
515
|
+
# Create a certificate that depends on the binding
|
|
516
|
+
certificate = azure.web.Certificate(
|
|
517
|
+
f"cert-{suffix}-{identifier}",
|
|
518
|
+
resource_group_name=self._rg,
|
|
519
|
+
server_farm_id=app.server_farm_id,
|
|
520
|
+
canonical_name=host,
|
|
521
|
+
opts=pulumi.ResourceOptions(depends_on=[binding] + depends_on),
|
|
522
|
+
)
|
|
551
523
|
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
524
|
+
# Create CertificateBinding from Azure Classic to link it together
|
|
525
|
+
# Inspired by https://github.com/pulumi/pulumi-azure-native/issues/578#issuecomment-2705952672
|
|
526
|
+
azure_classic.appservice.CertificateBinding(
|
|
527
|
+
f"cert-binding-{suffix}-{identifier}",
|
|
528
|
+
hostname_binding_id=binding.id,
|
|
529
|
+
certificate_id=certificate.id,
|
|
530
|
+
ssl_state="SniEnabled",
|
|
531
|
+
opts=pulumi.ResourceOptions(depends_on=depends_on, ignore_changes=["hostname_binding_id"]),
|
|
532
|
+
)
|
|
561
533
|
|
|
562
|
-
|
|
534
|
+
return binding
|
|
563
535
|
|
|
564
536
|
def _create_comms_dns_records(self, suffix, host: HostDefinition, records: dict) -> list[azure.dns.RecordSet]:
|
|
565
537
|
created_records = []
|
|
@@ -773,7 +745,8 @@ class DjangoDeployment(pulumi.ComponentResource):
|
|
|
773
745
|
comms_domains: list[HostDefinition] | None = None,
|
|
774
746
|
dedicated_app_service_sku: azure.web.SkuDescriptionArgs | None = None,
|
|
775
747
|
vault_administrators: list[str] | None = None,
|
|
776
|
-
|
|
748
|
+
redis_sidecar: bool = True,
|
|
749
|
+
django_tasks: bool = True,
|
|
777
750
|
startup_timeout: int = 300,
|
|
778
751
|
) -> azure.web.WebApp:
|
|
779
752
|
"""
|
|
@@ -794,7 +767,7 @@ class DjangoDeployment(pulumi.ComponentResource):
|
|
|
794
767
|
:param comms_domains: The list of custom domains for the E-mail Communication Services (optional).
|
|
795
768
|
:param dedicated_app_service_sku: The SKU for the dedicated App Service Plan (optional).
|
|
796
769
|
:param vault_administrators: The principal IDs of the vault administrators (optional).
|
|
797
|
-
:param
|
|
770
|
+
:param redis_sidecar: Whether to create a Redis sidecar container.
|
|
798
771
|
:param startup_timeout: The startup timeout for the App Service (default is 300 seconds).
|
|
799
772
|
"""
|
|
800
773
|
|
|
@@ -825,9 +798,15 @@ class DjangoDeployment(pulumi.ComponentResource):
|
|
|
825
798
|
)
|
|
826
799
|
|
|
827
800
|
# Redis cache environment variable
|
|
828
|
-
if
|
|
801
|
+
if redis_sidecar:
|
|
829
802
|
environment_variables["REDIS_SIDECAR"] = "true"
|
|
830
803
|
|
|
804
|
+
if django_tasks:
|
|
805
|
+
if not redis_sidecar:
|
|
806
|
+
raise ValueError("django-tasks requires redis-sidecar to be enabled.")
|
|
807
|
+
|
|
808
|
+
environment_variables["DJANGO_TASKS"] = "true"
|
|
809
|
+
|
|
831
810
|
# Communication Services (optional)
|
|
832
811
|
if comms_data_location:
|
|
833
812
|
if not comms_domains:
|
|
@@ -891,6 +870,7 @@ class DjangoDeployment(pulumi.ComponentResource):
|
|
|
891
870
|
python_version=python_version,
|
|
892
871
|
# scm_type=azure.web.ScmType.EXTERNAL_GIT,
|
|
893
872
|
linux_fx_version=f"PYTHON|{python_version}",
|
|
873
|
+
http20_enabled=True,
|
|
894
874
|
app_settings=[
|
|
895
875
|
# Startup settings
|
|
896
876
|
azure.web.NameValuePairArgs(name="WEBSITES_CONTAINER_START_TIME_LIMIT", value=str(startup_timeout)),
|
|
@@ -929,13 +909,13 @@ class DjangoDeployment(pulumi.ComponentResource):
|
|
|
929
909
|
)
|
|
930
910
|
|
|
931
911
|
# Redis cache
|
|
932
|
-
if
|
|
912
|
+
if redis_sidecar:
|
|
933
913
|
azure.web.WebAppSiteContainer(
|
|
934
|
-
f"redis-
|
|
914
|
+
f"redis-sidecar-{name}-{self._name}",
|
|
935
915
|
resource_group_name=self._rg,
|
|
936
916
|
name=app.name,
|
|
937
917
|
is_main=False,
|
|
938
|
-
container_name="redis-
|
|
918
|
+
container_name="redis-sidecar",
|
|
939
919
|
image=REDIS_IMAGE,
|
|
940
920
|
target_port="6379",
|
|
941
921
|
)
|
|
@@ -962,8 +942,10 @@ class DjangoDeployment(pulumi.ComponentResource):
|
|
|
962
942
|
|
|
963
943
|
pulumi.export(f"{name}_deploy_url", pulumi.Output.concat(credentials.scm_uri, "/deploy"))
|
|
964
944
|
|
|
945
|
+
bindings = []
|
|
965
946
|
for host in website_hosts:
|
|
966
|
-
|
|
947
|
+
# Only one binding can be created at a time, so we need to depend on the previous one.
|
|
948
|
+
dependencies = bindings or []
|
|
967
949
|
|
|
968
950
|
if host.zone:
|
|
969
951
|
# Create a DNS record in the zone.
|
|
@@ -1004,7 +986,7 @@ class DjangoDeployment(pulumi.ComponentResource):
|
|
|
1004
986
|
dependencies.append(txt_validation)
|
|
1005
987
|
|
|
1006
988
|
# Add the host with optional dependencies
|
|
1007
|
-
self._add_webapp_host(
|
|
989
|
+
binding = self._add_webapp_host(
|
|
1008
990
|
app=app,
|
|
1009
991
|
host=host.full_host,
|
|
1010
992
|
suffix=f"{name}-{self._name}",
|
|
@@ -1012,6 +994,8 @@ class DjangoDeployment(pulumi.ComponentResource):
|
|
|
1012
994
|
depends_on=dependencies,
|
|
1013
995
|
)
|
|
1014
996
|
|
|
997
|
+
bindings.append(binding)
|
|
998
|
+
|
|
1015
999
|
# To enable deployment from GitLab
|
|
1016
1000
|
azure.web.WebAppSourceControl(
|
|
1017
1001
|
f"app-{name}-sourcecontrol-{self._name}",
|
{pulumi_django_azure-1.0.38 → pulumi_django_azure-1.0.39}/src/pulumi_django_azure/settings.py
RENAMED
|
@@ -151,3 +151,20 @@ if REDIS_SIDECAR:
|
|
|
151
151
|
},
|
|
152
152
|
},
|
|
153
153
|
}
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
# Django tasks
|
|
157
|
+
DJANGO_TASKS = env("DJANGO_TASKS", default=False)
|
|
158
|
+
if DJANGO_TASKS and REDIS_SIDECAR:
|
|
159
|
+
RQ_QUEUES = {
|
|
160
|
+
"default": {
|
|
161
|
+
"USE_REDIS_CACHE": "default",
|
|
162
|
+
"QUEUES": ["default"],
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
TASKS = {
|
|
167
|
+
"default": {
|
|
168
|
+
"BACKEND": "django_tasks.backends.rq.RQBackend",
|
|
169
|
+
}
|
|
170
|
+
}
|
|
File without changes
|
{pulumi_django_azure-1.0.38 → pulumi_django_azure-1.0.39}/src/pulumi_django_azure/__init__.py
RENAMED
|
File without changes
|
{pulumi_django_azure-1.0.38 → pulumi_django_azure-1.0.39}/src/pulumi_django_azure/azure_helper.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pulumi_django_azure-1.0.38 → pulumi_django_azure-1.0.39}/src/pulumi_django_azure/middleware.py
RENAMED
|
File without changes
|