stable-diffusion-react-nextjs-mui-pwa icon indicating copy to clipboard operation
stable-diffusion-react-nextjs-mui-pwa copied to clipboard

Running with docker

Open phirestalker opened this issue 2 years ago • 5 comments

Does anyone have a recommended Dockerfile to run this with, or at least a good image to start with?

phirestalker avatar Sep 24 '23 15:09 phirestalker

Hey, this is on the roadmap but no ETA as unfortunately there are a lot of more pressing issues to be prioritized first.

However, I'd probably start with off with something like:

FROM node:20 # next LTS from end October

RUN apt-get update
RUN apt-get yarnpkg

# install mongo, at least for now
RUN apt-get install -yqqq mongodb-org

WORKDIR /usr/src/app
COPY package.json yarn.lock .
RUN yarn install

COPY . . 
EXPOSE 3000
CMD [ "yarn", "dev" ]

This is just a starting point though and I haven't tested this... if you come up with something good, please send as a PR! :pray: :grin:

gadicc avatar Sep 27 '23 14:09 gadicc

On a related note, is there somewhere with a list of the environment variables. I imagine it wouldn't be difficult to read them from the source code, but where would I look?

phirestalker avatar Sep 27 '23 14:09 phirestalker

Heh, no, I mean, here:

$ $ grep -E 'getenv|environ.get' `find . -type f -name \*.py`
./api/utils/storage/S3Storage.py:AWS_S3_ENDPOINT_URL = os.environ.get("AWS_S3_ENDPOINT_URL", None)
./api/utils/storage/S3Storage.py:AWS_S3_DEFAULT_BUCKET = os.environ.get("AWS_S3_DEFAULT_BUCKET", None)
./api/getScheduler.py:HF_AUTH_TOKEN = os.getenv("HF_AUTH_TOKEN")
./api/getScheduler.py:DEFAULT_SCHEDULER = os.getenv("DEFAULT_SCHEDULER", SCHEDULERS[0])
./api/precision.py:MODEL_REVISION = os.getenv("MODEL_REVISION")
./api/send.py:SEND_URL = os.getenv("SEND_URL")
./api/send.py:SIGN_KEY = os.getenv("SIGN_KEY", "")
./api/send.py:container_id = os.getenv("CONTAINER_ID")
./api/download_checkpoint.py:CHECKPOINT_URL = os.environ.get("CHECKPOINT_URL", None)
./api/lib/vars.py:RUNTIME_DOWNLOADS = os.getenv("RUNTIME_DOWNLOADS") == "1"
./api/lib/vars.py:USE_DREAMBOOTH = os.getenv("USE_DREAMBOOTH") == "1"
./api/lib/vars.py:MODEL_ID = os.environ.get("MODEL_ID")
./api/lib/vars.py:PIPELINE = os.environ.get("PIPELINE")
./api/lib/vars.py:HF_AUTH_TOKEN = os.getenv("HF_AUTH_TOKEN")
./api/convert_to_diffusers.py:CHECKPOINT_CONFIG_URL = os.environ.get("CHECKPOINT_CONFIG_URL", None)
./api/convert_to_diffusers.py:CHECKPOINT_ARGS = os.environ.get("CHECKPOINT_ARGS", None)
./api/download.py:HF_AUTH_TOKEN = os.environ.get("HF_AUTH_TOKEN")
./api/download.py:RUNTIME_DOWNLOADS = os.environ.get("RUNTIME_DOWNLOADS")
./api/download.py:            model_url=os.environ.get("MODEL_URL"),
./api/download.py:            model_id=os.environ.get("MODEL_ID"),
./api/download.py:            hf_model_id=os.environ.get("HF_MODEL_ID"),
./api/download.py:            model_revision=os.environ.get("MODEL_REVISION"),
./api/download.py:            model_precision=os.environ.get("MODEL_PRECISION"),
./api/download.py:            checkpoint_url=os.environ.get("CHECKPOINT_URL"),
./api/download.py:            checkpoint_config_url=os.environ.get("CHECKPOINT_CONFIG_URL"),
./api/loadModel.py:PIPELINE = os.getenv("PIPELINE")
./api/server.py:server.config.CORS_ORIGINS = os.getenv("CORS_ORIGINS") or "*"

(with duplicates deleted) but you're right this should be more accessible. Maybe it will be a good idea to put them all in one file with comments. Note also the AWS code uses that bota3 library which uses some of its own environment variables too.

gadicc avatar Sep 27 '23 19:09 gadicc

That's great thanks. I don't see anything about mongo. I installed mongo, but it said something about a password, and I thought there would be more things I need to set.

EDIT: tires screeching This is a node project, where did Python come from? Did you change to Python for your live site?

phirestalker avatar Sep 27 '23 21:09 phirestalker

Hey again.

  1. Mongo... yeah, that's just a warning... you don't need a password for local development and sd-mui will work with the default settings with no additional setup.

  2. Env vars. Big apologies from me! Sorry! I was answering issues on both repos and got confused. The docker-diffusers-api is indeed all in python, but is already all dockerized in a nice container. The above environment variables have nothing to do with the webui. Sorry again. Take two:

  • MONGO_URL - no need to set with default dev settings / mongo port.
  • NODE_ENV - set automatically to development, production, etc.
  • REQUIRE_REGISTRATION=0 and NEXT_PUBLIC_REQUIRE_REGISTRATION=0 - originally turned off all the mongo and credit stuff but hasn't been well looked after and doesn't guarantee that anymore - for now!
  • MONGODB_RELAY_PASSWORD=1 probably required for the latest commits
  • KIRI_API_KEY=xxxx, BANANA_API_KEY=xxx, RUNPOD_API_KEY=xxx etc depending on APIs used
  • BANANA_MODEL_KEY_{MODEL_ID}=xxx, for each model, if banana used.
  • Any client keys/secrets for auth in ./pages/api/auth/[...nextauth

I believe that's it... but let me know if you run into any thing else, and thanks for helping me consolidate these all in one place :sweat_smile:

gadicc avatar Sep 28 '23 08:09 gadicc