Skip to content

Latest commit

 

History

History
66 lines (48 loc) · 2.26 KB

File metadata and controls

66 lines (48 loc) · 2.26 KB

File Storage

The abstract class FileStoreManager is used to store user-generated assets, such as uploaded user and org image avatars to Parabol.

The following storage providers are (so far) supported:

  • Local File Storage
  • Amazon S3

General Configuration

In order to specify your storage provider of choice, whether local or cloud, set the env var FILE_STORE_PROVIDER in .env file.

Provider Env Var Value
Local Storage local
Amazon S3 s3

If you're using local storage for file storage, that's it! Make sure you have enough disk space on the machine to support the expected asset load.

On the local file system, the directory structure will be as follows:

   Parabol Project Root
   ====================
    |
    |--- self-hosted/
        |--- :model/
          |--- :id/
              |--- :field/
                |--- :asset.ext

S3 Configuration

After setting the FILE_STORE_PROVIDER env var, there are a couple other env vars that must be set. These are:

  • AWS_ACCESS_KEY_ID="XXXXXXXXXXXXXXXXXXXX"
  • AWS_REGION="some-region-1"
  • AWS_SECRET_ACCESS_KEY="YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY"
  • CDN_BASE_URL="//some.url.com/instance"

AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY are optional. Leave both unset to fall back to the AWS SDK's default credential chain, which covers IRSA (EKS IAM Roles for Service Accounts), EC2/ECS instance profiles, and the shared config file. On EKS, annotate the pod's service account with eks.amazonaws.com/role-arn and leave the two key vars out of the pod spec entirely — if either is present the SDK will prefer it over the projected web identity token.

After these vars are set correctly, all should be good to go to begin uploading images to the configured S3 bucket.

Within the bucket, the directory structure will be as follows:

   S3 Bucket
   =========
   |
   |--- static/                     1) Manually managed assets
   |
   |--- :instance/
      |--- build/                   2) Builds bundled with webpack
      |  |--- :vX.Y.Z/
      |
      |--- store/                   3) User-generated assets
         |--- :model/
            |--- :id/
               |--- :field/
                  |--- :asset.ext