#!/bin/bash # startup.sh - runs as merlyn user if [ -z "$STORAGE_DIR" ]; then echo "================================================================" echo "⚠️ WARNING: STORAGE_DIR environment variable is not set!" echo "================================================================" fi umask 002 # Force git to use HTTPS instead of SSH git config --global url."https://".insteadOf ssh:// git config --global url."https://github.com/".insteadOf git@github.com: # Install server dependencies echo "Installing server dependencies..." cd /app/server && yarn install --production --frozen-lockfile --no-cache --network-timeout 100000 # Install collector dependencies echo "Installing collector dependencies..." cd /app/collector && yarn install --production --frozen-lockfile --no-cache --network-timeout 100000 # NODE_ENV must be set to development for frontend install # otherwise yarn skips devDependencies (including vite) # NODE_ENV=production is set in the Dockerfile for the server # Build frontend if public folder doesn't exist if [ ! -d "/app/server/public" ]; then echo "Building frontend..." cd /app/frontend NODE_ENV=development yarn install --frozen-lockfile --no-cache --network-timeout 100000 yarn build cp -r /app/frontend/dist /app/server/public fi # Run Prisma migrations and start AnythingLLM { cd /app/server/ && export CHECKPOINT_DISABLE=1 && npx prisma generate --schema=./prisma/schema.prisma && npx prisma migrate deploy --schema=./prisma/schema.prisma && node /app/server/index.js } & { node /app/collector/index.js; } & wait -n exit $?