Skip to main content
Skip to main content

Object Storage Integration on Zerops

Zerops Object Storage is S3-compatible (MinIO). Always set AWS_USE_PATH_STYLE_ENDPOINT: true. Use env var references ${storage_*} for credentials. Container filesystem is lost on deploy — use Object Storage for any files that must persist across deployments.

Environment Variables​

When you create an Object Storage service, Zerops auto-generates these env vars (prefix with hostname for cross-service access, e.g. ${storage_apiUrl}):

VariableDescription
apiUrlS3 endpoint URL — full https://... URL ready for any S3 SDK's endpoint option
apiHostS3 endpoint host only (no scheme); use only if the client library needs host separately
accessKeyIdS3 access key
secretAccessKeyS3 secret key
bucketNameAuto-generated bucket name (hostname + random prefix, immutable)
quotaGBytesBucket quota in GB
projectIdProject ID (Zerops-generated)
serviceIdService ID (Zerops-generated)
hostnameService hostname

Use ${storage_apiUrl} as the S3 endpoint — it carries the complete https:// scheme and is what every S3 SDK's endpoint option expects. The apiHost variant is host-only; if a client library requires host separately, combine https://${storage_apiHost} manually — never http://. The object-storage gateway rejects plaintext HTTP with a 301 redirect to the HTTPS equivalent, and most S3 SDKs don't follow the redirect automatically. The symptom of a misconfigured endpoint is UnknownError or connection-refused on the first bucket call.

Reference them in zerops.yml run.envVariables:

S3_ENDPOINT: ${storage_apiUrl}
S3_ACCESS_KEY: ${storage_accessKeyId}
S3_SECRET_KEY: ${storage_secretAccessKey}
S3_BUCKET: ${storage_bucketName}
S3_REGION: us-east-1
AWS_USE_PATH_STYLE_ENDPOINT: "true"

Path Style Endpoint (Required)​

Zerops uses MinIO which requires path-style URLs (not virtual-hosted):

https://endpoint.com/bucket-name/object-key

https://bucket-name.endpoint.com/object-key

Every S3 client must be configured for path-style access (the SDK-specific flag: forcePathStyle/use_path_style_endpoint/addressing_style: path/ pathStyleAccessEnabled). Framework wiring lives in the recipe for that stack.

import.yaml Definition​

services:
- hostname: storage
type: object-storage # or "objectstorage" (both valid)
objectStorageSize: 2 # GB (1-100, changeable in GUI later)
objectStoragePolicy: public-read # predefined policy
priority: 10

Predefined policies (objectStoragePolicy):

  • private — no anonymous access (documents, backups)
  • public-read — anonymous list + get (media, avatars, static assets)
  • public-objects-read — anonymous get only, no listing (direct links only)
  • public-write — anonymous put only
  • public-read-write — full anonymous access

Custom policy: use objectStorageRawPolicy with IAM Policy JSON instead (template var {{ .BucketName }} available).

Each service = one bucket (auto-named, immutable). Need multiple buckets? Create multiple services.

When to Use Object Storage​

ScenarioUse Object Storage?
User uploads (avatars, documents)Yes — lost on deploy
Media files (images, videos)Yes — serve via public URL
Build artifactsNo — deploy via zerops.yaml
Temporary filesNo — container disk is fine
LogsNo — use Zerops logging
Database dumpsYes — for backup storage

Gotchas​

  1. forcePathStyle: true / AWS_USE_PATH_STYLE_ENDPOINT: true is REQUIRED: Zerops uses MinIO which doesn't support virtual-hosted style
  2. Container filesystem is replaced on deploy: Files on disk survive restarts but are lost when a new container is created (deploy, scale-up). Use Object Storage for persistent data, or a Local Storage volume (run.volume) when the workload needs a real filesystem (SQLite, Prometheus, Gitea)
  3. Region is required but ignored: Set us-east-1 — MinIO ignores it but SDKs require it
  4. Public URL format: {apiUrl}/{bucketName}/path/to/file
  5. Independent infrastructure: Object Storage runs on separate infra from other services — accessible from Zerops and remotely over internet
  6. One bucket per service: Bucket name auto-generated (hostname + random prefix), cannot be changed. Need multiple buckets? Add more object-storage services
  7. No Zerops backup: Object Storage is not covered by the Zerops backup system
  8. No autoscaling: Quota (1-100 GB) must be set manually, changeable in GUI after creation