Skip to content

Commit 9a8117f

Browse files
authored
Fix permission errors on the /tmp volume (#4457)
1 parent f0f3dc3 commit 9a8117f

File tree

5 files changed

+13
-24
lines changed

5 files changed

+13
-24
lines changed

backend/Dockerfile

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,8 @@ COPY --chown=app:app --from=js-stage ${FUNCTION_DIR}/dist/_astro ${FUNCTION_DIR}
8080
COPY --chown=app:app --from=build-stage ${FUNCTION_DIR}/.venv ${FUNCTION_DIR}/.venv
8181

8282
COPY --chown=app:app . ${FUNCTION_DIR}
83-
84-
USER app
83+
COPY ./entrypoint.sh /entrypoint.sh
8584

8685
RUN mkdir -p assets && .venv/bin/python manage.py collectstatic --noinput
8786

88-
ENTRYPOINT ["/home/app/.venv/bin/gunicorn"]
89-
CMD [ "pycon.wsgi" ]
87+
ENTRYPOINT ["/entrypoint.sh"]

backend/entrypoint.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/sh
2+
set -e
3+
4+
chown -R app:app /tmp
5+
6+
exec su -p app -c "exec $*"

infrastructure/applications/pycon_backend/web_task.tf

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,9 @@ resource "aws_ecs_task_definition" "web" {
77
image = "${data.aws_ecr_repository.be_repo.repository_url}@${data.aws_ecr_image.be_arm_image.image_digest}"
88
memoryReservation = local.is_prod ? 400 : 10
99
essential = true
10-
entrypoint = [
11-
"/home/app/.venv/bin/gunicorn",
12-
]
1310

1411
command = [
15-
"-w", "5", "-b", "0.0.0.0:8000", "pycon.wsgi"
12+
"/home/app/.venv/bin/gunicorn", "-w", "5", "-b", "0.0.0.0:8000", "pycon.wsgi"
1613
]
1714

1815
dockerLabels = {

infrastructure/applications/pycon_backend/worker.tf

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -218,12 +218,9 @@ resource "aws_ecs_task_definition" "worker" {
218218
image = "${data.aws_ecr_repository.be_repo.repository_url}@${data.aws_ecr_image.be_arm_image.image_digest}"
219219
memoryReservation = local.is_prod ? 200 : 10
220220
essential = true
221-
entrypoint = [
222-
"/home/app/.venv/bin/celery",
223-
]
224221

225222
command = [
226-
"-A", "pycon", "worker", "-l", "info", "-E"
223+
"/home/app/.venv/bin/celery", "-A", "pycon", "worker", "-l", "info", "-E"
227224
]
228225

229226
environment = local.env_vars
@@ -262,12 +259,9 @@ resource "aws_ecs_task_definition" "worker" {
262259
image = "${data.aws_ecr_repository.be_repo.repository_url}@${data.aws_ecr_image.be_arm_image.image_digest}"
263260
memoryReservation = local.is_prod ? 200 : 10
264261
essential = false
265-
entrypoint = [
266-
"/home/app/.venv/bin/python",
267-
]
268262

269263
command = [
270-
"manage.py", "migrate"
264+
"/home/app/.venv/bin/python", "manage.py", "migrate"
271265
]
272266

273267
environment = local.env_vars
@@ -316,12 +310,9 @@ resource "aws_ecs_task_definition" "beat" {
316310
image = "${data.aws_ecr_repository.be_repo.repository_url}@${data.aws_ecr_image.be_arm_image.image_digest}"
317311
memoryReservation = local.is_prod ? 200 : 10
318312
essential = true
319-
entrypoint = [
320-
"/home/app/.venv/bin/celery",
321-
]
322313

323314
command = [
324-
"-A", "pycon", "beat", "-l", "info"
315+
"/home/app/.venv/bin/celery", "-A", "pycon", "beat", "-l", "info"
325316
]
326317

327318
environment = local.env_vars

infrastructure/applications/pycon_backend/worker_heavy_processing.tf

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,9 @@ resource "aws_ecs_task_definition" "heavy_processing_worker" {
2222
image = "${data.aws_ecr_repository.be_repo.repository_url}@${data.aws_ecr_image.be_arm_image.image_digest}"
2323
memoryReservation = 16384
2424
essential = true
25-
entrypoint = [
26-
"/home/app/.venv/bin/celery",
27-
]
2825

2926
command = [
30-
"-A", "pycon", "worker", "-l", "info", "-Q", "heavy_processing", "--hostname", "heavyprocessing@%h", "-E"
27+
"/home/app/.venv/bin/celery", "-A", "pycon", "worker", "-l", "info", "-Q", "heavy_processing", "--hostname", "heavyprocessing@%h", "-E"
3128
]
3229

3330
environment = local.env_vars

0 commit comments

Comments
 (0)