Skip to content

Commit dd087ac

Browse files
rsdystunningpixelsaxonasif
authored
Gitpod integration (BloopAI#672)
* Add default devshell * Don't pull git by default * ? * Testing gitpod conf * Try and fix git lfs * Delete .envrc * Try and fix sync done/await not triggering * Update gitpod setup * Use a lightweight base image since we're not using system dependencies but nix flakes * Revert "Use a lightweight base image since we're not using system dependencies but nix flakes" This reverts commit e689c09. * Use nix * Add cachix * Resurrect envrc * Make sure npm deps are installed * Package cargo target dir * Meh * Create tarball with cargo build files * Add qdrant pane * LFS brute force? * Also add .cargo * We only need a little lfs * Pass arguments correctly * Add answer-api * Update deps & tweak linker * Fix gitpod caches * Force LLVM stdenv in dev shell * Use mold on linux * Customize stdenv with llvm bintools * Stick with original linker here * Use correct branch * Don't set custom linker * Use cachix * Force docker build * Update flake * Docker build is weirdly different than local * Bump Cargo.lock * Cache cache cache? * Let's try this then * Not sure what's happening here * Correct redirect & http settings * Base64 PEM * More gitpod workaround * Use Mold & fix answer API URL * Attempt to reset timestamps in the codebase * Always use fully qualified branch ref * Move target.tar.gz out of the git repo * Enable debug log in dev console --------- Co-authored-by: Louis Knight-Webb <[email protected]> Co-authored-by: Aminur Rahman <[email protected]>
1 parent e00d807 commit dd087ac

File tree

11 files changed

+488
-478
lines changed

11 files changed

+488
-478
lines changed

.cargo/config.toml

-2
This file was deleted.

.gitignore

+6
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,9 @@ playwright-report
4141
apps/desktop/src-tauri/dylibs/*.so
4242
apps/desktop/src-tauri/dylibs/*.dll
4343
apps/desktop/src-tauri/frameworks/*.dylib
44+
45+
# qdrant
46+
/qdrant/storage
47+
/qdrant/snapshots
48+
.qdrant-initialized
49+

.gitpod.Dockerfile

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
FROM gitpod/workspace-nix:2023-05-09-03-02-39
2+
3+
ARG onetime_cache_dir="/tmp/.workdir"
4+
5+
RUN mkdir -p "${onetime_cache_dir}"
6+
COPY --chown=gitpod:gitpod . "${onetime_cache_dir}"
7+
8+
# Cache nix compilation for saving time
9+
WORKDIR "${onetime_cache_dir}"
10+
SHELL [ "/bin/bash", "-c" ]
11+
RUN source "$HOME/.nix-profile/etc/profile.d/nix.sh" \
12+
&& nix run nixpkgs#cachix use bloopai \
13+
&& nix develop

.gitpod.yml

+81
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# This configuration file was automatically generated by Gitpod.
2+
# Please adjust to your needs (see https://www.gitpod.io/docs/introduction/learn-gitpod/gitpod-yaml)
3+
# and commit this file to your remote git repository to share the goodness with others.
4+
5+
# Learn more from ready-to-use templates: https://www.gitpod.io/docs/introduction/getting-started/quickstart
6+
7+
image:
8+
file: .gitpod.Dockerfile
9+
10+
ports:
11+
- name: Bloop Web Interface
12+
port: 7878
13+
protocol: http
14+
15+
additionalRepositories:
16+
- url: https://github.com/bloopai/answer-api
17+
checkoutLocation: answer-api
18+
19+
tasks:
20+
- name: Backend
21+
init: |
22+
nix run nixpkgs#cachix use bloopai
23+
24+
# Setup Git LFS
25+
git lfs pull model
26+
git lfs install --skip-smudge
27+
28+
# Cache build artifacts
29+
nix develop -c cargo build --locked -p bleep
30+
nix develop -c npm i
31+
32+
# this is working around a gitpod bug
33+
# https://github.com/gitpod-io/gitpod/issues/524
34+
cp -a ~/.cargo .
35+
tar czpf /workspace/target.tar.gz target .cargo
36+
rm -rf .cargo target
37+
38+
command: |
39+
tar -C /workspace -xzpf /workspace/target.tar.gz
40+
rm -rf ~/.cargo target
41+
mv /workspace/.cargo ~
42+
mv /workspace/target .
43+
44+
echo "$BLOOP_GITHUB_SECRET_KEY" |base64 -d > /workspace/github-app-private-key.pem
45+
bloop_url=$(gp url 7878 | sed 's;https://;;')
46+
47+
git reset --hard
48+
49+
nix develop -c cargo watch -w server -- \
50+
cargo run --locked --features=ee -p bleep -- \
51+
\
52+
--qdrant-url http://localhost:6334 \
53+
--answer-api-url http://localhost:7879 \
54+
--model-dir /workspace/bloop/model \
55+
--frontend-dist /workspace/bloop/client/dist \
56+
--instance-domain $bloop_url \
57+
--github-app-id $BLOOP_GITHUB_APP_ID \
58+
--github-app-install-id $BLOOP_GITHUB_APP_INSTALL_ID \
59+
--github-client-id $BLOOP_GITHUB_CLIENT_ID \
60+
--github-client-secret $BLOOP_GITHUB_CLIENT_SECRET \
61+
--github-app-private-key /workspace/github-app-private-key.pem
62+
63+
openMode: split-left
64+
65+
- name: Frontend
66+
command: |
67+
nix develop -c npm i
68+
nix develop -c npm run build-web -- -- --watch
69+
openMode: split-right
70+
71+
- name: Qdrant
72+
command: |
73+
nix run nixpkgs#qdrant -- --config-path qdrant/config.yaml
74+
openMode: tab-after
75+
76+
- name: answer-api
77+
command: |
78+
cd /workspace/answer-api
79+
git checkout nix-cachix
80+
nix run /workspace/answer-api?ref=origin/nix-cachix#
81+
openMode: tab-after

0 commit comments

Comments
 (0)