Skip to content

Commit

Permalink
Fix auto update
Browse files Browse the repository at this point in the history
  • Loading branch information
robballantyne committed Aug 15, 2024
1 parent cda8333 commit 8c6dcbe
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

function preflight_main() {
preflight_update_fooocus
printf "%s" "${FOOOCUS_FLAGS}" > /etc/fooocus_flags.conf
printf "%s" "${FOOOCUS_ARGS}" > /etc/fooocus_args.conf
}

function preflight_update_fooocus() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash

echo "$@" > /etc/fooocus_flags.conf
echo "$@" > /etc/fooocus_args.conf
supervisorctl restart fooocus
12 changes: 6 additions & 6 deletions build/COPY_ROOT_1/opt/ai-dock/bin/supervisor-fooocus.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,14 @@ function start() {

printf "Starting $SERVICE_NAME...\n"

PLATFORM_FLAGS=
PLATFORM_ARGS=
if [[ $XPU_TARGET = "CPU" ]]; then
PLATFORM_FLAGS="--always-cpu --disable-xformers"
PLATFORM_ARGS="--always-cpu --disable-xformers"
elif [[ $XPU_TARGET = "AMD_GPU" ]]; then
PLATFORM_FLAGS="--disable-xformers"
PLATFORM_ARGS="--disable-xformers"
fi

BASE_FLAGS=""
BASE_ARGS=""

# Delay launch until provisioning completes
if [[ -f /run/workspace_sync || -f /run/container_config ]]; then
Expand All @@ -72,13 +72,13 @@ function start() {
fuser -k -SIGKILL ${LISTEN_PORT}/tcp > /dev/null 2>&1 &
wait -n

FLAGS_COMBINED="${PLATFORM_FLAGS} ${BASE_FLAGS} $(cat /etc/fooocus_flags.conf)"
ARGS_COMBINED="${PLATFORM_ARGS} ${BASE_ARGS} $(cat /etc/fooocus_args.conf)"
printf "Starting %s...\n" "${SERVICE_NAME}"

cd /opt/Fooocus
source "$FOOOCUS_VENV/bin/activate"
LD_PRELOAD=libtcmalloc.so python launch.py \
${FLAGS_COMBINED} --port ${LISTEN_PORT}
${ARGS_COMBINED} --port ${LISTEN_PORT}
}

start 2>&1
6 changes: 5 additions & 1 deletion build/COPY_ROOT_1/opt/ai-dock/bin/update-fooocus.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
#!/bin/bash
umask 002
branch=main

source /opt/ai-dock/bin/venv-set.sh fooocus

if [[ -n "${FOOOCUS_BRANCH}" ]]; then
branch="${FOOOCUS_BRANCH}"
else
branch="$(curl -s https://api.github.com/repos/lllyasviel/Fooocus/tags | \
jq -r '.[0].name')"
fi

# -b flag has priority
Expand All @@ -16,6 +18,8 @@ do
esac
done

[[ -n $branch ]] || echo "Failed to get update target"; exit 1

printf "Updating Fooocus (${branch})...\n"

cd /opt/Fooocus
Expand Down

0 comments on commit 8c6dcbe

Please sign in to comment.