Implement per-extension initialisation

(Plansee)
pull/17/head
Atinoda 10 months ago
parent 4c24344796
commit b6b1ca1391

@ -55,7 +55,7 @@ Three commonly used ports are exposed:
### Volumes
The provided example docker compose maps several volumes from the local `config` directory into the container: `loras, models, presets, prompts, training, extensions`. If these folders are empty, they will be initialised when the container is run.
Extensions will persist their state between container launches if you use the mapped folder - **but they will not automatically update when a new image is released, so this feature is disabled by default.** You must uncomment the mapping in `docker-compose.yml` to enable this extension persistence.
Extensions will persist their state between container launches if you use a mapped folder - **but they will not automatically update when a new image is released, so this feature is disabled by default.** The whole extensions folder can be mapped (all extensions are persisted) or individual extensions can be mapped one at a time. Examples are given in the `docker-compose.yml`.
*If you are getting an error about missing files, try clearing these folders and letting the service re-populate them.*

@ -18,7 +18,8 @@ services:
- ./config/prompts:/app/prompts
- ./config/softprompts:/app/softprompts
- ./config/training:/app/training
# - ./config/extensions:/app/extensions
# - ./config/extensions:/app/extensions # Persist all extensions
# - ./config/extensions/silero_tts:/app/extensions/silero_tts # Persist a single extension
logging:
driver: json-file
options:

@ -22,7 +22,8 @@ services:
- ./config/prompts:/app/prompts
- ./config/softprompts:/app/softprompts
- ./config/training:/app/training
# - ./config/extensions:/app/extensions
# - ./config/extensions:/app/extensions # Persist all extensions
# - ./config/extensions/silero_tts:/app/extensions/silero_tts # Persist a single extension
logging:
driver: json-file
options:

@ -10,7 +10,7 @@ function ctrl_c {
trap ctrl_c SIGTERM SIGINT SIGQUIT SIGHUP
# Generate default configs if empty
CONFIG_DIRECTORIES=("loras" "models" "presets" "prompts" "training/datasets" "training/formats" "extensions")
CONFIG_DIRECTORIES=("loras" "models" "presets" "prompts" "training/datasets" "training/formats")
for config_dir in "${CONFIG_DIRECTORIES[@]}"; do
if [ -z "$(ls /app/"$config_dir")" ]; then
echo "*** Initialising config for: '$config_dir' ***"
@ -19,6 +19,18 @@ for config_dir in "${CONFIG_DIRECTORIES[@]}"; do
fi
done
# Populate extension folders if empty
EXTENSIONS_SRC="/src/extensions"
EXTENSIONS_DEFAULT=($(find "$EXTENSIONS_SRC" -mindepth 1 -maxdepth 1 -type d -exec basename {} \;))
for extension_dir in "${EXTENSIONS_DEFAULT[@]}"; do
if [ -z "$(ls /app/extensions/"$extension_dir" 2>/dev/null)" ]; then
echo "*** Initialising extension: '$extension_dir' ***"
mkdir -p /app/extensions/"$extension_dir"
cp -ar "$EXTENSIONS_SRC"/"$extension_dir"/* /app/extensions/"$extension_dir"/
fi
chown -R 1000:1000 /app/extensions/"$extension_dir" # Not ideal... but convenient.
done
# Runtime extension build
if [[ -n "$BUILD_EXTENSIONS_LIVE" ]]; then
eval "live_extensions=($BUILD_EXTENSIONS_LIVE)"

Loading…
Cancel
Save