This project uses MinIO for object storage. We have separate buckets for different environments to avoid mixing production and development data.
- Production: Remote MinIO server (configured via environment variables)
- Development: Local MinIO in Docker (localhost:9000)
- Backup: Automatic sync from production to local storage
bun run minio:devThis uses docker-compose.dev.yml to ensure it only runs in development.
This starts MinIO on:
- API: http://localhost:9000
- Console: http://localhost:9001
Default credentials:
- Username:
minioadmin - Password:
minioadmin
Open MinIO Console at http://localhost:9001 and create:
barometers-dev- for local developmentbarometers-prod- for production mirror (optional)
Or use MinIO Client (mc):
mc alias set local http://localhost:9000 minioadmin minioadmin
mc mb local/barometers-devCreate .env.local for development:
# Local MinIO Configuration
MINIO_ENDPOINT=localhost:9000
MINIO_ACCESS_KEY=minioadmin
MINIO_SECRET_KEY=minioadmin
NEXT_PUBLIC_MINIO_URL=http://localhost:9000
NEXT_PUBLIC_MINIO_BUCKET=barometers-dev
# Other variables...Create .env.production for production:
# Production MinIO Configuration
MINIO_ENDPOINT=your-production-endpoint.com
MINIO_ACCESS_KEY=your-production-access-key
MINIO_SECRET_KEY=your-production-secret-key
NEXT_PUBLIC_MINIO_URL=https://your-production-endpoint.com
NEXT_PUBLIC_MINIO_BUCKET=barometers-prodSyncs production bucket to local Docker MinIO:
bun run minio:backup:localDownloads all files to ./minio-backups directory:
bun run minio:backup:filesystemCustom path:
bun scripts/minio-backup.ts --filesystem --path /custom/backup/pathSyncs to both local MinIO and filesystem:
bun run minio:backup:all-
Start development:
bun run minio:dev bun run dev
-
Work with local files - all uploads go to
barometers-devbucket -
Need production data? Run backup:
bun run minio:backup:local
-
Stop MinIO when done:
bun run minio:stop
Recommended backup schedule:
-
Daily: Filesystem backup (can be automated via cron)
0 2 * * * cd /path/to/project && bun run minio:backup:filesystem
-
Weekly: Full backup to both local MinIO and filesystem
bun run minio:backup:all
-
Before deployment: Always backup before major changes
Check if Docker container is running:
docker ps | grep barometers-minioRestart if needed:
bun run minio:stop
bun run minio:devIf ports 9000 or 9001 are taken, modify docker-compose.dev.yml:
- Check
.env.productionhas correct credentials - Verify network connectivity to production MinIO
- Check production bucket name is correct
If ports 9000 or 9001 are taken, modify docker-compose.dev.yml:
ports:
- '9002:9000' # Change host port
- '9003:9001' # Change host port⚠️ Never commit.env.localor.env.production- 🔒 Use strong passwords for production MinIO
- 📦 Keep backup files secure and encrypted
- 🚫 Don't expose local MinIO ports publicly
Current setup ensures:
- Development data →
barometers-devbucket (local) - Production data →
barometersbucket (remote) - No cross-contamination between environments
- Safe testing without affecting production