Janady07 commited on
Commit
3dd842d
·
verified ·
1 Parent(s): fcd9b46

Deploy MEGAMIND CODEBRAIN with updated binary

Browse files
Files changed (6) hide show
  1. .gitattributes +1 -0
  2. Dockerfile +17 -12
  3. README.md +10 -4
  4. config.json +7 -16
  5. megamind +3 -0
  6. startup.sh +11 -23
.gitattributes CHANGED
@@ -1 +1,2 @@
1
  megamind-linux-amd64 filter=lfs diff=lfs merge=lfs -text
 
 
1
  megamind-linux-amd64 filter=lfs diff=lfs merge=lfs -text
2
+ megamind filter=lfs diff=lfs merge=lfs -text
Dockerfile CHANGED
@@ -1,21 +1,26 @@
1
  FROM alpine:3.19
2
 
3
- RUN apk add --no-cache ca-certificates git curl iptables ip6tables
 
4
 
5
  # Install Tailscale
6
- RUN curl -fsSL https://pkgs.tailscale.com/stable/tailscale_1.58.2_amd64.tgz \
7
- | tar xz -C /usr/local/bin --strip-components=1 tailscale_1.58.2_amd64/tailscale tailscale_1.58.2_amd64/tailscaled
8
 
9
- # Create state directories
10
- RUN mkdir -p /var/run/tailscale /var/lib/tailscale /home/megamind/data
11
  RUN adduser -D -u 1000 megamind
12
- RUN chown -R megamind:megamind /home/megamind /var/run/tailscale /var/lib/tailscale
 
13
 
14
- WORKDIR /home/megamind
15
- COPY megamind-linux-amd64 /usr/local/bin/megamind
16
- COPY config.json /home/megamind/config.json
17
- COPY startup.sh /home/megamind/startup.sh
18
- RUN chmod +x /home/megamind/startup.sh /usr/local/bin/megamind
19
 
 
 
 
 
 
 
 
 
20
  EXPOSE 7860
21
- CMD ["/home/megamind/startup.sh"]
 
 
1
  FROM alpine:3.19
2
 
3
+ # Install dependencies
4
+ RUN apk add --no-cache ca-certificates curl iptables ip6tables iproute2 bash
5
 
6
  # Install Tailscale
7
+ RUN curl -fsSL https://pkgs.tailscale.com/stable/tailscale_1.56.1_amd64.tgz | tar xz -C /usr/local/bin --strip-components=1
 
8
 
9
+ # Create user
 
10
  RUN adduser -D -u 1000 megamind
11
+ RUN mkdir -p /app/data /var/run/tailscale /var/lib/tailscale
12
+ RUN chown -R megamind:megamind /app /var/run/tailscale /var/lib/tailscale
13
 
14
+ WORKDIR /app
 
 
 
 
15
 
16
+ # Copy binary and config
17
+ COPY megamind /app/megamind
18
+ COPY config.json /app/config.json
19
+ COPY startup.sh /app/startup.sh
20
+
21
+ RUN chmod +x /app/megamind /app/startup.sh
22
+
23
+ # HF Spaces uses port 7860
24
  EXPOSE 7860
25
+
26
+ CMD ["/app/startup.sh"]
README.md CHANGED
@@ -1,10 +1,16 @@
1
  ---
2
- title: Megamind Codebrain
3
- emoji: 🏃
4
- colorFrom: gray
5
  colorTo: blue
6
  sdk: docker
7
  pinned: false
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
1
  ---
2
+ title: MEGAMIND CODEBRAIN
3
+ emoji: 🧠
4
+ colorFrom: purple
5
  colorTo: blue
6
  sdk: docker
7
  pinned: false
8
  ---
9
 
10
+ # MEGAMIND CODEBRAIN
11
+
12
+ Part of the MEGAMIND distributed AGI federation.
13
+
14
+ **Specialty:** programming and code
15
+
16
+ This mind connects to the federation via NATS and contributes to collective intelligence queries.
config.json CHANGED
@@ -1,21 +1,12 @@
1
  {
2
- "name": "CodeBrain",
3
- "number": 7,
4
- "goal": "code implementation, algorithms, data structures, system design patterns, testing strategies, refactoring, performance optimization, clean code, architecture patterns",
5
- "seed_urls": [
6
- "https://github.com/trending",
7
- "https://leetcode.com/",
8
- "https://refactoring.guru/"
9
- ],
10
- "neurons": 512,
11
- "crawler_workers": 15,
12
- "crawler_delay_sec": 2.5,
13
- "language": "en",
14
  "federation": {
 
15
  "relay": "wss://josephs-mac-mini.taildf8f6b.ts.net",
16
- "heartbeat_sec": 10
17
  },
18
- "persistence": {
19
- "repo": "Janady07/megamind-codebrain"
20
- }
21
  }
 
1
  {
2
+ "name": "CODEBRAIN",
3
+ "goal": "MEGAMIND federation node specializing in programming and code",
4
+ "neurons": 50000,
 
 
 
 
 
 
 
 
 
5
  "federation": {
6
+ "enabled": true,
7
  "relay": "wss://josephs-mac-mini.taildf8f6b.ts.net",
8
+ "nats_url": "nats://100.115.192.101:4222"
9
  },
10
+ "seed_urls": [],
11
+ "specialty": "programming and code"
 
12
  }
megamind ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3628d79fe13422aa131980600dd67202a17f633debcfd487940a166cf3b1384f
3
+ size 19126031
startup.sh CHANGED
@@ -1,29 +1,17 @@
1
- #!/bin/sh
2
  set -e
3
 
4
- # Extract mind name from config for Tailscale hostname
5
- MIND_NAME=$(cat /home/megamind/config.json | sed -n 's/.*"name"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p' | head -1 | tr '[:upper:]' '[:lower:]' | tr ' ' '-')
6
- TS_HOSTNAME="megamind-${MIND_NAME}"
7
 
8
- # Start Tailscale if auth key is available
9
  if [ -n "$TS_AUTHKEY" ]; then
10
- echo "[startup] Starting Tailscale as ${TS_HOSTNAME}..."
11
- tailscaled --tun=userspace-networking \
12
- --statedir=/var/lib/tailscale \
13
- --socket=/var/run/tailscale/tailscaled.sock &
14
- sleep 2
15
-
16
- tailscale up \
17
- --authkey="$TS_AUTHKEY" \
18
- --hostname="$TS_HOSTNAME" \
19
- --accept-routes \
20
- --socket=/var/run/tailscale/tailscaled.sock
21
-
22
- echo "[startup] Tailscale connected as ${TS_HOSTNAME}"
23
- tailscale status --socket=/var/run/tailscale/tailscaled.sock 2>/dev/null || true
24
- else
25
- echo "[startup] No TS_AUTHKEY set, running without Tailscale"
26
  fi
27
 
28
- echo "[startup] Starting MEGAMIND: ${MIND_NAME}"
29
- exec megamind -config /home/megamind/config.json -port 7860
 
 
1
+ #!/bin/bash
2
  set -e
3
 
4
+ echo "=== MEGAMIND CODEBRAIN Starting ==="
 
 
5
 
6
+ # Start Tailscale daemon in background
7
  if [ -n "$TS_AUTHKEY" ]; then
8
+ echo "Starting Tailscale..."
9
+ tailscaled --state=/var/lib/tailscale/tailscaled.state --socket=/var/run/tailscale/tailscaled.sock &
10
+ sleep 3
11
+ tailscale up --authkey=$TS_AUTHKEY --hostname=megamind-codebrain || true
12
+ echo "Tailscale connected"
 
 
 
 
 
 
 
 
 
 
 
13
  fi
14
 
15
+ # Run megamind
16
+ echo "Starting MEGAMIND brain..."
17
+ exec /app/megamind -config /app/config.json -port 7860