diff --git a/Dockerfile b/Dockerfile index 707bd57a..7fad3541 100644 --- a/Dockerfile +++ b/Dockerfile @@ -87,9 +87,6 @@ ENV DATABASE_URL="postgresql://postgres@localhost:5432/sourcebot" ENV REDIS_URL="redis://localhost:6379" ENV SRC_TENANT_ENFORCEMENT_MODE=strict -# @nocheckin: we likely want to have a better solution for the self host case -ENV BACKEND_CORES_FACTOR="0.5" - ARG SOURCEBOT_VERSION=unknown ENV SOURCEBOT_VERSION=$SOURCEBOT_VERSION RUN echo "Sourcebot Version: $SOURCEBOT_VERSION" diff --git a/entrypoint.sh b/entrypoint.sh index c281843a..5d1d9f82 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -203,30 +203,5 @@ fi echo -e "\e[34m[Info] Running database migration...\e[0m" yarn workspace @sourcebot/db prisma:migrate:prod -# Get total CPU cores -TOTAL_CORES=$(nproc) -echo -e "\e[34m[Info] Total CPU cores available: $TOTAL_CORES\e[0m" - -# Default to 50/50 split if BACKEND_CORES_FACTOR not set -BACKEND_CORES_FACTOR=${BACKEND_CORES_FACTOR:-0.5} - -# Calculate number of cores for backend (rounded down) -BACKEND_CORES=$(printf "%.0f" $(echo "$TOTAL_CORES * $BACKEND_CORES_FACTOR" | bc)) - -# Ensure at least 1 core for each -if [ $BACKEND_CORES -lt 1 ]; then - BACKEND_CORES=1 -fi -if [ $BACKEND_CORES -ge $TOTAL_CORES ]; then - BACKEND_CORES=$(($TOTAL_CORES - 1)) -fi - -# Generate CPU lists -export BACKEND_CPU_LIST=$(seq -s, 0 $(($BACKEND_CORES - 1))) -export FRONTEND_CPU_LIST=$(seq -s, $BACKEND_CORES $(($TOTAL_CORES - 1))) - -echo -e "\e[34m[Info] Backend will use CPUs: $BACKEND_CPU_LIST\e[0m" -echo -e "\e[34m[Info] Frontend will use CPUs: $FRONTEND_CPU_LIST\e[0m" - # Run supervisord exec supervisord -c /etc/supervisor/conf.d/supervisord.conf \ No newline at end of file diff --git a/packages/schemas/src/v3/connection.schema.ts b/packages/schemas/src/v3/connection.schema.ts index de1a5c70..d92f7d24 100644 --- a/packages/schemas/src/v3/connection.schema.ts +++ b/packages/schemas/src/v3/connection.schema.ts @@ -48,6 +48,7 @@ const schema = { "type": "string", "pattern": "^[\\w.-]+$" }, + "default": [], "examples": [ [ "torvalds", @@ -80,6 +81,7 @@ const schema = { "type": "string", "pattern": "^[\\w.-]+\\/[\\w.-]+$" }, + "default": [], "description": "List of individual repositories to sync with. Expected to be formatted as '{orgName}/{repoName}' or '{userName}/{repoName}'." }, "topics": { @@ -88,6 +90,7 @@ const schema = { "type": "string" }, "minItems": 1, + "default": [], "description": "List of repository topics to include when syncing. Only repositories that match at least one of the provided `topics` will be synced. If not specified, all repositories will be synced, unless explicitly defined in the `exclude` property. Glob patterns are supported.", "examples": [ [ @@ -122,6 +125,7 @@ const schema = { "items": { "type": "string" }, + "default": [], "description": "List of repository topics to exclude when syncing. Repositories that match one of the provided `topics` will be excluded from syncing. Glob patterns are supported.", "examples": [ [ diff --git a/packages/schemas/src/v3/github.schema.ts b/packages/schemas/src/v3/github.schema.ts index 412ea9d3..31ec3b87 100644 --- a/packages/schemas/src/v3/github.schema.ts +++ b/packages/schemas/src/v3/github.schema.ts @@ -44,6 +44,7 @@ const schema = { "type": "string", "pattern": "^[\\w.-]+$" }, + "default": [], "examples": [ [ "torvalds", @@ -76,6 +77,7 @@ const schema = { "type": "string", "pattern": "^[\\w.-]+\\/[\\w.-]+$" }, + "default": [], "description": "List of individual repositories to sync with. Expected to be formatted as '{orgName}/{repoName}' or '{userName}/{repoName}'." }, "topics": { @@ -84,6 +86,7 @@ const schema = { "type": "string" }, "minItems": 1, + "default": [], "description": "List of repository topics to include when syncing. Only repositories that match at least one of the provided `topics` will be synced. If not specified, all repositories will be synced, unless explicitly defined in the `exclude` property. Glob patterns are supported.", "examples": [ [ @@ -118,6 +121,7 @@ const schema = { "items": { "type": "string" }, + "default": [], "description": "List of repository topics to exclude when syncing. Repositories that match one of the provided `topics` will be excluded from syncing. Glob patterns are supported.", "examples": [ [ diff --git a/supervisord.conf b/supervisord.conf index b2dcc53a..068076a7 100644 --- a/supervisord.conf +++ b/supervisord.conf @@ -4,7 +4,7 @@ logfile=/dev/null logfile_maxbytes=0 [program:zoekt] -command=taskset -c %(ENV_BACKEND_CPU_LIST)s ./prefix-output.sh zoekt-webserver -index %(ENV_DATA_CACHE_DIR)s/index -rpc +command=./prefix-output.sh zoekt-webserver -index %(ENV_DATA_CACHE_DIR)s/index -rpc autostart=true autorestart=true startretries=3 @@ -13,7 +13,7 @@ stdout_logfile_maxbytes=0 redirect_stderr=true [program:web] -command=taskset -c %(ENV_FRONTEND_CPU_LIST)s ./prefix-output.sh node packages/web/server.js +command=./prefix-output.sh node packages/web/server.js autostart=true autorestart=true startretries=3