Configuration
Storage buckets
Give an app a private bucket for files such as uploads, exports and generated images.
An app's own disk is wiped whenever it restarts or scales, so files your app needs to keep belong in a storage bucket. Elula can give each app one private bucket. The bucket lives in your workspace's Google Cloud project, which Google bills to you directly. Its name is set as BUCKET_NAME in the app's environment.
Add a bucket
Open the app, go to the Storage tab and click Add storage bucket. Or from the app's folder:
elula storage create elula storage # show the bucket's name and region
Only the app's owner or a workspace owner or admin can add or delete a bucket. Imported apps can't have one.
The bucket is created in the app's region. BUCKET_NAME is set on the running app straight away. If a deploy is running, it's set from the deploy after that one.
Use it from your app
Your app can read and write the bucket without any keys or credentials file. Use Google's storage library with its default credentials.
Node.js (npm install @google-cloud/storage):
import { Storage } from "@google-cloud/storage";
const bucket = new Storage().bucket(process.env.BUCKET_NAME);
await bucket.file("reports/today.pdf").save(pdfBuffer, { contentType: "application/pdf" });
const [data] = await bucket.file("reports/today.pdf").download();Python (pip install google-cloud-storage):
import os
from google.cloud import storage
bucket = storage.Client().bucket(os.environ["BUCKET_NAME"])
bucket.blob("reports/today.pdf").upload_from_string(pdf_bytes, content_type="application/pdf")
data = bucket.blob("reports/today.pdf").download_as_bytes()Who can reach it
- Never public. Public access is blocked on the bucket itself and can't be turned on. To let a browser download a file, serve it through your app or create a signed URL.
- Shared within the workspace. All apps in a workspace run as the same account, so any app in the workspace can read and write any of the workspace's buckets if it knows the name. Don't rely on buckets to keep data from your other apps.
Previews share the bucket
Pull request previews get the same BUCKET_NAME as the live app. A preview that writes or deletes files changes your production files.
Deleting
Delete a bucket from the Storage tab or with elula storage delete. Deleting an app with elula project delete, or Settings → Danger → Delete app, deletes its bucket too.
Either way the bucket and every file in it are deleted. For 7 days after, support can restore a deleted bucket. After that it's gone for good. Buckets of imported apps are never touched.