Skip to content

Config format V2 #42

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 23 commits into from
Oct 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
ca7a85d
Move webapp to packages/web directory. Spinup packages/backend
brendan-kellam Oct 7, 2024
5ea87cb
further wip
brendan-kellam Oct 9, 2024
22b4aeb
Fix Dockerfile to work with packages/ webapp
brendan-kellam Oct 9, 2024
c813185
Add docker support for backend
brendan-kellam Oct 9, 2024
139a43d
Support cloning private repositories
brendan-kellam Oct 9, 2024
a7739b0
Add main event loop for periodically re-indexing repositories
brendan-kellam Oct 10, 2024
21ee795
Added support for 'users' field to index all repositories owned by a …
brendan-kellam Oct 11, 2024
402f937
Add 'exclude' field to allow users to selectively exclude repositories
brendan-kellam Oct 11, 2024
40290f2
wip
brendan-kellam Oct 12, 2024
7346e59
Add progress callback for cloning
brendan-kellam Oct 12, 2024
72759c4
Add concept of 'operations' to track long-running tasks (like cloning)
brendan-kellam Oct 12, 2024
4731b30
Revert "Add concept of 'operations' to track long-running tasks (like…
brendan-kellam Oct 12, 2024
c84c5cb
Add progress logs for git.clone and git.fetch operations
brendan-kellam Oct 13, 2024
574fbe8
nit on logger
brendan-kellam Oct 13, 2024
7b188ef
GitLab support
brendan-kellam Oct 14, 2024
8219cee
Support environment variables for tokens
brendan-kellam Oct 16, 2024
215d4bc
Add configurable log level
brendan-kellam Oct 16, 2024
64ab838
strip comments from json & update some configs
brendan-kellam Oct 16, 2024
849fdad
Remove netrc config stuff. Improve logging readability by adding pref…
brendan-kellam Oct 16, 2024
5e0c8d9
Update README to reflect latest schema. Also add some example configs…
brendan-kellam Oct 17, 2024
9192e08
Add changelog entry
brendan-kellam Oct 17, 2024
540054e
Add web .env file
brendan-kellam Oct 17, 2024
ce0492c
review nits
brendan-kellam Oct 17, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
182 changes: 152 additions & 30 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,44 +1,166 @@
# Created by https://www.toptal.com/developers/gitignore/api/nextjs
# Edit at https://www.toptal.com/developers/gitignore?templates=nextjs
# Created by https://www.toptal.com/developers/gitignore/api/yarn,node
# Edit at https://www.toptal.com/developers/gitignore?templates=yarn,node

### NextJS ###
# dependencies
/node_modules
/.pnp
.pnp.js
### Node ###
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*

# testing
/coverage
# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# next.js
/.next/
/out/
# Runtime data
pids
*.pid
*.seed
*.pid.lock

# production
/build
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# misc
.DS_Store
*.pem
# Coverage directory used by tools like istanbul
coverage
*.lcov

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*
# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# local env files
.env*.local
# node-waf configuration
.lock-wscript

# vercel
.vercel
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# typescript
# Dependency directories
node_modules/
jspm_packages/

# Snowpack dependency directory (https://snowpack.dev/)
web_modules/

# TypeScript cache
*.tsbuildinfo
next-env.d.ts

# End of https://www.toptal.com/developers/gitignore/api/nextjs
# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional stylelint cache
.stylelintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variable files
.env
.env.development.local
.env.test.local
.env.production.local
.env.local

# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache

# Next.js build output
.next
out

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# vuepress v2.x temp and cache directory
.temp

# Docusaurus cache and generated files
.docusaurus

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port

# Stores VSCode versions used for testing VSCode extensions
.vscode-test

# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*

### Node Patch ###
# Serverless Webpack directories
.webpack/

# Optional stylelint cache

# SvelteKit build / generate output
.svelte-kit

### yarn ###
# https://yarnpkg.com/getting-started/qa#which-files-should-be-gitignored

.yarn/*
!.yarn/releases
!.yarn/patches
!.yarn/plugins
!.yarn/sdks
!.yarn/versions

# if you are NOT using Zero-installs, then:
# comment the following lines
!.yarn/cache

# and uncomment the following lines
# .pnp.*

# End of https://www.toptal.com/developers/gitignore/api/yarn,node

.sourcebot
/bin
/config.json
/config.json
.DS_Store
6 changes: 6 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"files.associations": {
"*.json": "jsonc",
"index.json": "json"
}
}
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

- [**Breaking Change**] Added index schema v2. This new schema brings many quality of life features like clearer syntax, ability to specify individual `repos`, `projects`, `groups`, and `orgs`, and the ability to easily `exclude` repositories.
- Added a `SOURCEBOT_VERSION` build argument to the Docker image. ([#41](https://github.com/sourcebot-dev/sourcebot/pull/41))
- Added the `sourcebot_version` property to all PostHog events for versioned telemetry. ([#41](https://github.com/sourcebot-dev/sourcebot/pull/41)

Expand Down
36 changes: 26 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,29 @@ RUN CGO_ENABLED=0 GOOS=linux go build -o /cmd/ ./cmd/...
FROM node-alpine AS web-builder
RUN apk add --no-cache libc6-compat
WORKDIR /app

COPY package.json yarn.lock* ./
COPY ./packages/web ./packages/web

# Fixes arm64 timeouts
RUN yarn config set registry https://registry.npmjs.org/
RUN yarn config set network-timeout 1200000
RUN yarn --frozen-lockfile
COPY . .
RUN yarn workspace @sourcebot/web install --frozen-lockfile
ENV NEXT_TELEMETRY_DISABLED=1
# @see: https://phase.dev/blog/nextjs-public-runtime-variables/
ARG NEXT_PUBLIC_SOURCEBOT_TELEMETRY_DISABLED=BAKED_NEXT_PUBLIC_SOURCEBOT_TELEMETRY_DISABLED
ARG NEXT_PUBLIC_SOURCEBOT_VERSION=BAKED_NEXT_PUBLIC_SOURCEBOT_VERSION
RUN yarn run build
RUN yarn workspace @sourcebot/web build

# ------ Build Backend ------
FROM node-alpine AS backend-builder
WORKDIR /app

COPY package.json yarn.lock* ./
COPY ./schemas ./schemas
COPY ./packages/backend ./packages/backend
RUN yarn workspace @sourcebot/backend install --frozen-lockfile
RUN yarn workspace @sourcebot/backend build

# ------ Runner ------
FROM node-alpine AS runner
Expand All @@ -40,8 +51,8 @@ ARG SOURCEBOT_VERSION=unknown
ENV SOURCEBOT_VERSION=$SOURCEBOT_VERSION
RUN echo "Sourcebot Version: $SOURCEBOT_VERSION"

ENV GITHUB_HOSTNAME=github.com
ENV GITLAB_HOSTNAME=gitlab.com
# Valid values are: debug, info, warn, error
ENV SOURCEBOT_LOG_LEVEL=info

# @note: This is also set in .env
ENV NEXT_PUBLIC_POSTHOG_KEY=phc_VFn4CkEGHRdlVyOOw8mfkoj1DKVoG6y1007EClvzAnS
Expand All @@ -50,7 +61,7 @@ ENV NEXT_PUBLIC_POSTHOG_KEY=phc_VFn4CkEGHRdlVyOOw8mfkoj1DKVoG6y1007EClvzAnS
# ENV SOURCEBOT_TELEMETRY_DISABLED=1

# Configure dependencies
RUN apk add --no-cache git ca-certificates bind-tools tini jansson wget supervisor uuidgen curl
RUN apk add --no-cache git ca-certificates bind-tools tini jansson wget supervisor uuidgen curl perl

# Configure zoekt
COPY vendor/zoekt/install-ctags-alpine.sh .
Expand All @@ -68,12 +79,17 @@ COPY --from=zoekt-builder \
/usr/local/bin/

# Configure the webapp
COPY --from=web-builder /app/public ./public
RUN mkdir .next
COPY --from=web-builder /app/.next/standalone ./
COPY --from=web-builder /app/.next/static ./.next/static
COPY --from=web-builder /app/packages/web/public ./packages/web/public
COPY --from=web-builder /app/packages/web/.next/standalone ./
COPY --from=web-builder /app/packages/web/.next/static ./packages/web/.next/static

# Configure the backend
COPY --from=backend-builder /app/node_modules ./node_modules
COPY --from=backend-builder /app/packages/backend ./packages/backend

COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
COPY prefix-output.sh ./prefix-output.sh
RUN chmod +x ./prefix-output.sh
COPY entrypoint.sh ./entrypoint.sh
RUN chmod +x ./entrypoint.sh

Expand Down
11 changes: 10 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,17 @@ ui:
zoekt:
mkdir -p bin
go build -C vendor/zoekt -o $(PWD)/bin ./cmd/...
export PATH=$(PWD)/bin:$(PATH)
export CTAGS_COMMANDS=ctags

clean:
rm -rf bin node_modules .next .sourcebot
rm -rf \
bin \
node_modules \
packages/web/node_modules \
packages/web/.next \
packages/backend/dist \
packages/backend/node_modules \
.sourcebot

.PHONY: bin
Loading