Add environment variables

SmsS4 2023-04-20 16:41:13 +03:30
parent cc6a289b52
commit 3f26403bda

36
Environment-Variables.md Normal file

@ -0,0 +1,36 @@
# Environment Variables
You can use environment variables instead of arguments for `weed`.
For example:
instead of `weed master -port 5000 -mdir /tmp -volumePreallocate` you can use
```shell
export PORT=5000
export MDIR=/tmp
export VOLUMEPREALLOCATE=true # or export VOLUMEPREALLOCATE=
weed master
```
# 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`, `max` argumants and setting environment variables won't change these values.
## Dcoker
```shell
docker run --entrypoint weed -it -e MDIR=/tmp -e PORT=5000 -e VOLUMEPREALLOCATE=true chrislusf/seaweedfs:3.45 master
```
## Docker Compose
```yaml
version: '3.9'
services:
master:
image: chrislusf/seaweedfs:3.45
ports:
- 9333:9333
- 19333:19333
environment:
MDIR: /data
PORT: 9333
VOLUMEPREALLOCATE: 'true'
# or `VOLUMEPREALLOCATE:`
entrypoint: weed
command: master
```