Skip to content

Commit 8bf0648

Browse files
authored
Merge pull request #2 from vsilent/dev
Dev
2 parents c4d222e + a6aac14 commit 8bf0648

File tree

101 files changed

+3044
-2577
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

101 files changed

+3044
-2577
lines changed

.githooks/pre-commit

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/bin/sh
2+
set -e
3+
4+
echo "🐕 Stackdog pre-commit: running cargo fmt..."
5+
cargo fmt --all -- --check || {
6+
echo "❌ cargo fmt failed. Run 'cargo fmt --all' to fix."
7+
exit 1
8+
}
9+
10+
echo "🐕 Stackdog pre-commit: running cargo clippy..."
11+
cargo clippy 2>&1
12+
CLIPPY_EXIT=$?
13+
if [ $CLIPPY_EXIT -ne 0 ]; then
14+
echo "❌ cargo clippy failed to compile. Fix errors before committing."
15+
exit 1
16+
fi
17+
18+
echo "✅ Pre-commit checks passed."

.github/workflows/docker.yml

Lines changed: 49 additions & 118 deletions
Original file line numberDiff line numberDiff line change
@@ -2,163 +2,94 @@ name: Docker CICD
22

33
on:
44
push:
5-
branches:
6-
- master
7-
- testing
5+
branches: [main, dev]
86
pull_request:
9-
branches:
10-
- master
7+
branches: [main, dev]
118

129
jobs:
13-
cicd-linux-docker:
14-
name: Cargo and npm build
15-
#runs-on: ubuntu-latest
16-
runs-on: [self-hosted, linux]
10+
build:
11+
name: Build & Test
12+
runs-on: ubuntu-latest
1713
steps:
18-
- name: Checkout sources
19-
uses: actions/checkout@v4
14+
- uses: actions/checkout@v4
2015

21-
- name: Install stable toolchain
22-
uses: actions-rs/toolchain@v1
16+
- name: Install Rust toolchain
17+
uses: dtolnay/rust-toolchain@stable
2318
with:
24-
toolchain: stable
25-
profile: minimal
26-
override: true
2719
components: rustfmt, clippy
2820

29-
- name: Cache cargo registry
30-
uses: actions/cache@v4
31-
with:
32-
path: ~/.cargo/registry
33-
key: docker-registry-${{ hashFiles('**/Cargo.lock') }}
34-
restore-keys: |
35-
docker-registry-
36-
docker-
37-
38-
- name: Cache cargo index
39-
uses: actions/cache@v4
40-
with:
41-
path: ~/.cargo/git
42-
key: docker-index-${{ hashFiles('**/Cargo.lock') }}
43-
restore-keys: |
44-
docker-index-
45-
docker-
21+
- name: Cache Rust dependencies
22+
uses: Swatinem/rust-cache@v2
4623

4724
- name: Generate Secret Key
48-
run: |
49-
head -c16 /dev/urandom > src/secret.key
25+
run: head -c16 /dev/urandom > src/secret.key
5026

51-
- name: Cache cargo build
52-
uses: actions/cache@v4
53-
with:
54-
path: target
55-
key: docker-build-${{ hashFiles('**/Cargo.lock') }}
56-
restore-keys: |
57-
docker-build-
58-
docker-
59-
60-
- name: Cargo check
61-
uses: actions-rs/cargo@v1
62-
with:
63-
command: check
27+
- name: Check
28+
run: cargo check
6429

65-
- name: Cargo test
66-
if: ${{ always() }}
67-
uses: actions-rs/cargo@v1
68-
with:
69-
command: test
30+
- name: Format check
31+
run: cargo fmt --all -- --check
7032

71-
- name: Rustfmt
72-
uses: actions-rs/toolchain@v1
73-
with:
74-
toolchain: stable
75-
profile: minimal
76-
override: true
77-
components: rustfmt
78-
command: fmt
79-
args: --all -- --check
80-
81-
- name: Rustfmt
82-
uses: actions-rs/toolchain@v1
83-
with:
84-
toolchain: stable
85-
profile: minimal
86-
override: true
87-
components: clippy
88-
command: clippy
89-
args: -- -D warnings
90-
91-
- name: Run cargo build
92-
uses: actions-rs/cargo@v1
93-
with:
94-
command: build
95-
args: --release
33+
- name: Clippy
34+
run: cargo clippy -- -D warnings
35+
36+
- name: Test
37+
run: cargo test
9638

97-
- name: npm install, build, and test
39+
- name: Build release
40+
run: cargo build --release
41+
42+
- name: Build frontend
9843
working-directory: ./web
9944
run: |
100-
npm install
45+
if [ -f package-lock.json ]; then
46+
npm ci
47+
else
48+
npm install
49+
fi
10150
npm run build
102-
# npm test
10351
104-
- name: Archive production artifacts
105-
uses: actions/upload-artifact@v4
106-
with:
107-
name: dist-without-markdown
108-
path: |
109-
web/dist
110-
!web/dist/**/*.md
111-
112-
# - name: Archive code coverage results
113-
# uses: actions/upload-artifact@v4
114-
# with:
115-
# name: code-coverage-report
116-
# path: output/test/code-coverage.html
117-
- name: Display structure of downloaded files
118-
run: ls -R web/dist
119-
120-
- name: Copy app files and zip
52+
- name: Package app
12153
run: |
12254
mkdir -p app/stackdog/dist
123-
cp target/release/stackdog app/stackdog
124-
cp -a web/dist/. app/stackdog
55+
cp target/release/stackdog app/stackdog/
56+
cp -a web/dist/. app/stackdog/
12557
cp docker/prod/Dockerfile app/Dockerfile
126-
cd app
127-
touch .env
128-
tar -czvf ../app.tar.gz .
129-
cd ..
58+
touch app/.env
59+
tar -czf app.tar.gz -C app .
13060
131-
- name: Upload app archive for Docker job
61+
- name: Upload build artifact
13262
uses: actions/upload-artifact@v4
13363
with:
134-
name: artifact-linux-docker
64+
name: app-archive
13565
path: app.tar.gz
66+
retention-days: 1
13667

137-
cicd-docker:
138-
name: CICD Docker
139-
#runs-on: ubuntu-latest
140-
runs-on: [self-hosted, linux]
141-
needs: cicd-linux-docker
68+
docker:
69+
name: Docker Build & Push
70+
runs-on: ubuntu-latest
71+
needs: build
14272
steps:
143-
- name: Download app archive
73+
- name: Download build artifact
14474
uses: actions/download-artifact@v4
14575
with:
146-
name: artifact-linux-docker
76+
name: app-archive
14777

148-
- name: Extract app archive
149-
run: tar -zxvf app.tar.gz
78+
- name: Extract archive
79+
run: tar -xzf app.tar.gz
15080

151-
- name: Display structure of downloaded files
152-
run: ls -R
81+
- name: Set up Docker Buildx
82+
uses: docker/setup-buildx-action@v3
15383

15484
- name: Login to Docker Hub
15585
uses: docker/login-action@v3
15686
with:
15787
username: ${{ secrets.DOCKER_USERNAME }}
15888
password: ${{ secrets.DOCKER_PASSWORD }}
15989

160-
- name: Docker build and publish
90+
- name: Build and push
16191
uses: docker/build-push-action@v6
16292
with:
93+
context: .
16394
push: true
16495
tags: trydirect/stackdog:latest

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ jobs:
1818
strategy:
1919
matrix:
2020
include:
21-
- target: x86_64-unknown-linux-gnu
21+
- target: x86_64-unknown-linux-musl
2222
artifact: stackdog-linux-x86_64
23-
- target: aarch64-unknown-linux-gnu
23+
- target: aarch64-unknown-linux-musl
2424
artifact: stackdog-linux-aarch64
2525

2626
steps:

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ r2d2 = "0.8"
4848
bollard = "0.16"
4949

5050
# HTTP client (for LLM API)
51-
reqwest = { version = "0.12", features = ["json", "blocking"] }
51+
reqwest = { version = "0.12", default-features = false, features = ["json", "blocking", "rustls-tls"] }
5252

5353
# Compression
5454
zstd = "0.13"

VERSION.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.0.1
1+
0.2.0

docker/prod/Dockerfile

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,17 @@
11
# base image
2-
FROM debian:buster-slim
2+
FROM debian:bookworm-slim
33

4-
# create app directory
5-
RUN mkdir app
64
WORKDIR /app
75

8-
# install libpq
9-
RUN apt-get update; \
10-
apt-get install --no-install-recommends -y libpq-dev; \
6+
# install ca-certificates for HTTPS requests
7+
RUN apt-get update && \
8+
apt-get install --no-install-recommends -y ca-certificates && \
119
rm -rf /var/lib/apt/lists/*
1210

1311
# copy binary and configuration files
1412
COPY ./stackdog .
1513
COPY ./.env .
16-
# expose port
14+
1715
EXPOSE 5000
1816

19-
# run the binary
2017
ENTRYPOINT ["/app/stackdog"]

ebpf/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44
55
#![no_std]
66

7-
pub mod syscalls;
87
pub mod maps;
8+
pub mod syscalls;

0 commit comments

Comments
 (0)