5 Environment Variables
Dmitry edited this page 2023-06-15 22:46:36 +03:00

Environment Variables

You can use environment variables instead of arguments for weed.
For example:
instead of weed master -port 5000 -mdir /tmp -volumePreallocate -ip.bind 0.0.0.0 you can use

export IP_BIND=0.0.0.0
export PORT=5000
export MDIR=/tmp
export VOLUMEPREALLOCATE=true # or export VOLUMEPREALLOCATE=
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

Docker

This is useful for using docker and docker compose
You have to override entrypoint to weed because defautl entrypoint use default values for volumeSizeLimitMB, volumePreallocate, mdir, dir, and max and setting environment variables won't change these values.

Docker

docker run --entrypoint weed -it -e IP_BIND=0.0.0.0 -e MDIR=/tmp -e PORT=5000 -e VOLUMEPREALLOCATE=true chrislusf/seaweedfs:3.45 master

Docker Compose

version: '3.9'
services:
  master:
    image: chrislusf/seaweedfs:3.45
    ports:
      - 9333:9333
      - 19333:19333
    environment:
      IP_BIND: 0.0.0.0
      MDIR: /data
      PORT: 9333
      VOLUMEPREALLOCATE: 'true'
      # or `VOLUMEPREALLOCATE:`
    entrypoint: weed
    command: master