Skip to content

Commit 805ca50

Browse files
committed
Update NodeJS buildpack workaround to only be present in Package.json
1 parent 19f1376 commit 805ca50

File tree

7 files changed

+10
-39
lines changed

7 files changed

+10
-39
lines changed

.copilot/phases/install.sh

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
#!/usr/bin/env bash
22

33
set -e
4-
5-
# Add commands below to run as part of the install phase

.copilot/phases/post_build.sh

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
#!/usr/bin/env bash
22

33
set -e
4-
5-
# Add commands below to run as part of the post_build phase

.copilot/phases/pre_build.sh

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
#!/usr/bin/env bash
22

33
set -e
4-
5-
# Add commands below to run as part of the pre_build phase

Procfile

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
web: scripts/web-worker-entrypoint.sh
2-
app: scripts/web-worker-entrypoint.sh
32
worker: celery -A common.celery worker -O fair -l info -Q standard
43
beat: celery -A common.celery beat -l info
54
rule-check-worker: celery -A common.celery worker -O fair -l info -Q rule-check --concurrency 1

common/views.py

+8-29
Original file line numberDiff line numberDiff line change
@@ -317,9 +317,7 @@ def check_s3(self) -> Tuple[str, int]:
317317
endpoint_url=settings.S3_ENDPOINT_URL,
318318
region_name=settings.HMRC_PACKAGING_S3_REGION_NAME,
319319
)
320-
client.head_bucket(
321-
Bucket=settings.HMRC_PACKAGING_STORAGE_BUCKET_NAME,
322-
)
320+
client.head_bucket(Bucket=settings.HMRC_PACKAGING_STORAGE_BUCKET_NAME)
323321
return "OK", 200
324322
except (ClientError, EndpointConnectionError):
325323
return "S3 health check failed", 503
@@ -441,14 +439,10 @@ def get_context_data(self, **kwargs):
441439
data["APP_UPDATED_TIME"] = AppInfoView.timestamp_to_datetime_string(
442440
os.path.getmtime(__file__),
443441
)
444-
last_transaction = Transaction.objects.order_by(
445-
"updated_at",
446-
).last()
442+
last_transaction = Transaction.objects.order_by("updated_at").last()
447443
data["LAST_TRANSACTION_TIME"] = (
448444
format(
449-
last_transaction.updated_at.strftime(
450-
AppInfoView.DATETIME_FORMAT,
451-
),
445+
last_transaction.updated_at.strftime(AppInfoView.DATETIME_FORMAT),
452446
)
453447
if last_transaction
454448
else "No transactions"
@@ -535,9 +529,7 @@ def get_object(self, queryset: Optional[QuerySet] = None) -> Model:
535529
try:
536530
obj = queryset.get()
537531
except queryset.model.DoesNotExist:
538-
raise Http404(
539-
f"No {self.model.__name__} matching the query {self.kwargs}",
540-
)
532+
raise Http404(f"No {self.model.__name__} matching the query {self.kwargs}")
541533

542534
return obj
543535

@@ -670,15 +662,10 @@ def get_ordering(self):
670662
self,
671663
"sort_by_fields",
672664
), "SortingMixin requires class attribute sort_by_fields to be set"
673-
assert isinstance(
674-
self.sort_by_fields,
675-
list,
676-
), "sort_by_fields must be a list"
665+
assert isinstance(self.sort_by_fields, list), "sort_by_fields must be a list"
677666

678667
if sort_by and sort_by in self.sort_by_fields:
679-
if hasattr(self, "custom_sorting") and self.custom_sorting.get(
680-
sort_by,
681-
):
668+
if hasattr(self, "custom_sorting") and self.custom_sorting.get(sort_by):
682669
sort_by = self.custom_sorting.get(sort_by)
683670

684671
if ordered == "desc":
@@ -691,19 +678,11 @@ def get_ordering(self):
691678

692679

693680
def handler403(request, *args, **kwargs):
694-
return TemplateResponse(
695-
request=request,
696-
template="common/403.jinja",
697-
status=403,
698-
)
681+
return TemplateResponse(request=request, template="common/403.jinja", status=403)
699682

700683

701684
def handler500(request, *args, **kwargs):
702-
return TemplateResponse(
703-
request=request,
704-
template="common/500.jinja",
705-
status=500,
706-
)
685+
return TemplateResponse(request=request, template="common/500.jinja", status=500)
707686

708687

709688
class MaintenanceView(TemplateView):

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
"clean": "rm -f ./run/static/webpack_bundles/*",
4545
"heroku-prebuild": "",
4646
"heroku-postbuild": "npm run build",
47-
"start": "echo starting",
47+
"start": "bash scripts/web-worker-entrypoint.sh", // Workaround for the Paketo NodeJS buildpack on DBT Platform
4848
"test": "jest",
4949
"lint:js": "npx eslint . --ext .jsx,.js",
5050
"lint:js:fix": "npx eslint . --ext .jsx,.js --fix",

settings/common.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@
282282
ALLOWED_HOSTS = setup_allowed_hosts(ALLOWED_HOSTS)
283283
# Govuk PaaS
284284
elif "VCAP_APPLICATION" in os.environ:
285-
# Under PaaS, if ALLOW_PAAS_URIS is set fetch trusted domains from VCAP_APPLICATION env var
285+
# Under PaaS, if ALLOW_PAAS_URIS is set, fetch trusted domains from VCAP_APPLICATION env var
286286
paas_hosts = json.loads(os.environ["VCAP_APPLICATION"])["uris"]
287287
ALLOWED_HOSTS.extend(paas_hosts)
288288

@@ -861,7 +861,6 @@
861861
},
862862
}
863863

864-
865864
TRANSACTION_SCHEMA = os.getenv("TRANSACTION_SCHEMA", "workbaskets.models.SEED_FIRST")
866865

867866
# Default max number of objects that will be accurately counted by LimitedPaginator.

0 commit comments

Comments
 (0)