diff --git a/Environment-Variables.md b/Environment-Variables.md index 09c1705..45b1518 100644 --- a/Environment-Variables.md +++ b/Environment-Variables.md @@ -13,6 +13,37 @@ weed master # Weed prefix For `v`, `logtostderr`, `stderrthreshold`, `vmoudle`, `options`, `logdir`, `alsologtostderr`, `log_backtrace_at` , and `config_dir` you have to use `WEED_` as prefix for environment variable like this `WEED_CONFIG_DIR=/tmp` +# S3 Admin Credentials +For S3 API server, you can use standard AWS environment variables to set default admin credentials: + +```shell +export AWS_ACCESS_KEY_ID=your_access_key +export AWS_SECRET_ACCESS_KEY=your_secret_key +weed s3 -filer=localhost:8888 +``` + +These environment variables will supplement existing configuration by adding admin credentials when: +- Both `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` are set +- No identity with the same access key already exists + +**Configuration Priority:** +1. **File or Filer configuration** is loaded first (if provided) +2. **Environment variables** are added second, supplementing the existing configuration +3. Environment variables are **skipped** if an access key conflict exists + +This approach ensures that: +- Existing S3 configuration files (with `admin_access` etc.) are preserved +- Environment variables provide additional admin access without conflicts +- AWS standard environment variables work seamlessly alongside existing setups + +The admin identity from environment variables will have: +- Name: `admin-` followed by the access key (or first 8 characters if longer than 8) +- Access Key: value of `AWS_ACCESS_KEY_ID` +- Secret Key: value of `AWS_SECRET_ACCESS_KEY` +- Permissions: Full admin access to all S3 operations + +This follows the standard AWS credential convention, making it compatible with existing AWS tooling and workflows. + # Docker This is useful for using docker and docker compose You have to override entrypoint to `weed` because defautl [entrypoint](https://github.com/seaweedfs/seaweedfs/blob/master/docker/entrypoint.sh) use default values for `volumeSizeLimitMB`, `volumePreallocate`, `mdir`, `dir`, and `max` and setting environment variables won't change these values. @@ -39,3 +70,29 @@ services: entrypoint: weed command: master ``` + +## Docker Compose with S3 Admin Credentials +```yaml +version: '3.9' +services: + filer: + image: chrislusf/seaweedfs:latest + ports: + - 8888:8888 + environment: + # ... other filer environment variables + entrypoint: weed + command: filer -master=master:9333 + + s3: + image: chrislusf/seaweedfs:latest + ports: + - 8333:8333 + environment: + AWS_ACCESS_KEY_ID: s3admin + AWS_SECRET_ACCESS_KEY: s3secret + entrypoint: weed + command: s3 -filer=filer:8888 + depends_on: + - filer +```