Skip to content

feat: store static files on s3

Keith Grootboom requested to merge keith/s3-static-storage into main

Description

Adds a new setting, GROVE_ENABLE_S3_STATIC_FILES that uploads all static files to S3 when enabled.

We would've preferred just setting the storage to ProductionS3Storage, but then we ran into issues with uploading files to S3. Django's built-in collectstatic command uploads the files one by one, resulting in 30minute plus delays on every deploy.

The changes here work by setting setting the STATIC_URL to the S3 bucket and using aws s3 sync to upload the files. Since the aws command isn't included in the image by default, we have to include it here.

Supporting information

grove!184 (merged)

Testing instructions

Steps to test the changes:

  1. View the steps in the linked PR.

Checklist

If any of the items below is not applicable, do not remove them, but put a check in it.

  • Git commit history is clean
  • Git commits are following conventional-commit practices
  • Unit tests are added/updated
  • Documentation is added/updated

Additional context

Add any other context about the merge request here.

Edited by Keith Grootboom

Merge request reports