Skip to content

Commit 26440cc

Browse files
authored
Merge pull request #1 from GraphDone/dev-startup-repair
Complete startup automation and external access fixes
2 parents d776888 + 926b959 commit 26440cc

11 files changed

Lines changed: 762 additions & 52 deletions

File tree

.gitignore

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,11 @@ logs/
5656

5757
# Cache
5858
.cache/
59-
.parcel-cache/
59+
.parcel-cache/
60+
61+
# TypeScript
62+
*.tsbuildinfo
63+
tsconfig.tsbuildinfo
64+
65+
# Prisma
66+
prisma/dev.db

README.md

Lines changed: 67 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,25 +44,82 @@ GraphDone is built on the belief that:
4444

4545
## Quick Start
4646

47-
### One-Command Setup
47+
### Prerequisites
48+
49+
GraphDone requires:
50+
- **Node.js 18+** - JavaScript runtime (our setup script can install this automatically)
51+
- **Docker** - For running PostgreSQL database ([Install Docker](https://docs.docker.com/get-docker/))
52+
- **Git** - For version control (usually pre-installed)
53+
54+
### One Command to Rule Them All
4855

4956
```bash
50-
git clone https://github.com/your-org/graphdone.git
51-
cd graphdone
52-
./tools/setup.sh
53-
./tools/run.sh
57+
git clone https://github.com/GraphDone/GraphDone-Core.git
58+
cd GraphDone-Core
59+
./start
5460
```
5561

56-
Visit http://localhost:3000 to see the working application!
62+
That's it! The script will automatically:
63+
- Check prerequisites and offer to install Node.js if needed
64+
- Install all dependencies
65+
- Set up your environment
66+
- Start the database
67+
- Build the packages
68+
- Launch the development servers
69+
70+
Visit **http://localhost:3127** when you see the "GraphDone is Ready!" message.
71+
72+
> 💡 **Don't have Node.js?** No problem! The setup script will detect this and offer to install Node.js 18 for you using nvm (Node Version Manager).
5773
5874
### What You Get
5975

60-
- 🌐 **Web Application**: Full graph visualization and collaboration interface
61-
- 🔗 **GraphQL API**: Complete backend with real-time subscriptions
76+
- 🌐 **Web Application**: http://localhost:3127 - Full graph visualization and collaboration interface
77+
- 🔗 **GraphQL API**: http://localhost:4127/graphql - Complete backend with real-time subscriptions
78+
- 🩺 **Health Check**: http://localhost:4127/health - Service status monitoring
6279
- 🗄️ **Database**: PostgreSQL with graph-optimized schema
63-
- 🐳 **Docker Setup**: Development and production containers
80+
- 🐳 **Docker Setup**: Development and production containers ready to go
6481
- 🧪 **Testing**: Comprehensive test suite with coverage reporting
6582

83+
### Alternative Quick Commands
84+
85+
```bash
86+
# Minimal launcher (less verbose)
87+
./launch.sh
88+
89+
# Manual control (advanced users)
90+
./tools/setup.sh # One-time setup
91+
./tools/run.sh # Start development servers
92+
```
93+
94+
### Troubleshooting
95+
96+
**Docker Permission Denied?**
97+
```bash
98+
# Fix Docker permissions (then restart terminal)
99+
sudo usermod -aG docker $USER
100+
newgrp docker
101+
102+
# Or run the setup with sudo assistance
103+
./start # Will offer to use sudo automatically
104+
```
105+
106+
**Node.js Missing?**
107+
```bash
108+
./start # Will offer to install Node.js 18 automatically
109+
```
110+
111+
**Port Already in Use?**
112+
```bash
113+
./tools/cleanup.sh # Kill any hanging processes
114+
./start # Try starting again
115+
```
116+
117+
**Cannot Find Module Errors?**
118+
```bash
119+
./tools/fix-workspace.sh # Fix workspace dependencies
120+
./start # Try starting again
121+
```
122+
66123
## Core Concepts
67124

68125
### Graph Structure
@@ -96,7 +153,7 @@ GraphDone is built for and by teams who think differently. We welcome contributi
96153
- Performance for large graphs
97154

98155
**Get Started:**
99-
1. Run `./tools/setup.sh && ./tools/run.sh` to see the system working
156+
1. Run `./start` to see the system working locally
100157
2. Read our [philosophy](./docs/philosophy.md) and [architecture](./docs/guides/architecture-overview.md)
101158
3. Pick an area that excites you and matches your skills
102159
4. Join discussions in GitHub Issues and pull requests

deployment/docker-compose.yml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
version: '3.8'
2-
31
services:
42
postgres:
53
image: postgres:15-alpine
@@ -37,10 +35,10 @@ services:
3735
environment:
3836
- NODE_ENV=production
3937
- DATABASE_URL=postgresql://graphdone:graphdone_password@postgres:5432/graphdone
40-
- PORT=4000
41-
- CORS_ORIGIN=http://localhost:3000
38+
- PORT=4127
39+
- CORS_ORIGIN=http://localhost:3127
4240
ports:
43-
- "4000:4000"
41+
- "4127:4127"
4442
depends_on:
4543
postgres:
4644
condition: service_healthy
@@ -59,10 +57,10 @@ services:
5957
context: ..
6058
dockerfile: packages/web/Dockerfile
6159
environment:
62-
- VITE_GRAPHQL_URL=http://localhost:4000/graphql
63-
- VITE_GRAPHQL_WS_URL=ws://localhost:4000/graphql
60+
- VITE_GRAPHQL_URL=http://localhost:4127/graphql
61+
- VITE_GRAPHQL_WS_URL=ws://localhost:4127/graphql
6462
ports:
65-
- "3000:3000"
63+
- "3127:3127"
6664
depends_on:
6765
- server
6866
volumes:

launch.sh

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/bin/bash
2+
3+
# GraphDone Simple Launcher
4+
# Super quick way to start GraphDone
5+
6+
echo "🚀 GraphDone Quick Start"
7+
echo "========================"
8+
echo ""
9+
10+
# Quick check for dependencies
11+
if ! command -v node &> /dev/null || ! command -v docker &> /dev/null; then
12+
echo "❌ Missing dependencies. Please ensure Node.js and Docker are installed."
13+
exit 1
14+
fi
15+
16+
# Run setup if needed, then start
17+
if [ ! -f "packages/server/.env" ]; then
18+
echo "⚡ Running quick setup..."
19+
./tools/setup.sh
20+
fi
21+
22+
echo "🎯 Starting development servers..."
23+
./tools/run.sh
24+
25+
echo ""
26+
echo "✅ GraphDone is running at http://localhost:3000"

packages/web/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"scripts": {
77
"dev": "npm run kill-port && vite",
88
"dev:force": "vite",
9-
"kill-port": "lsof -ti:${PORT:-3000} | xargs -r kill || true",
9+
"kill-port": "lsof -ti:${PORT:-3127} | xargs -r kill -9 || true",
1010
"build": "tsc && vite build",
1111
"preview": "vite preview",
1212
"test": "vitest",

packages/web/vite.config.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { defineConfig } from 'vite';
22
import react from '@vitejs/plugin-react';
33
import { resolve } from 'path';
4+
import { hostname } from 'os';
45

56
export default defineConfig({
67
plugins: [react()],
@@ -11,11 +12,13 @@ export default defineConfig({
1112
}
1213
},
1314
server: {
14-
port: Number(process.env.PORT) || 3000,
15+
host: '0.0.0.0', // Listen on all interfaces for external access
16+
port: Number(process.env.PORT) || 3127,
1517
strictPort: true, // Exit if port is already in use instead of trying next available
18+
allowedHosts: ['localhost', hostname(), '*.local', '.tailscale'], // Auto-detect hostname + common patterns
1619
proxy: {
1720
'/graphql': {
18-
target: 'http://localhost:4000',
21+
target: 'http://localhost:4127',
1922
changeOrigin: true
2023
}
2124
}

start

Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
#!/bin/bash
2+
3+
# GraphDone Quick Launcher
4+
# The easiest way to get GraphDone running
5+
6+
set -e
7+
8+
# Colors for better output
9+
RED='\033[0;31m'
10+
GREEN='\033[0;32m'
11+
BLUE='\033[0;34m'
12+
YELLOW='\033[1;33m'
13+
PURPLE='\033[0;35m'
14+
CYAN='\033[0;36m'
15+
NC='\033[0m' # No Color
16+
17+
# Clear screen for a clean start
18+
clear
19+
20+
echo -e "${PURPLE}"
21+
echo "╔══════════════════════════════════════════════════════════════╗"
22+
echo "║ ║"
23+
echo "║ 🌐 GraphDone 🌐 ║"
24+
echo "║ ║"
25+
echo "║ Graph-native project management system ║"
26+
echo "║ ║"
27+
echo "╚══════════════════════════════════════════════════════════════╝"
28+
echo -e "${NC}"
29+
30+
# Function to ensure Node.js is available (same as in run.sh)
31+
ensure_nodejs() {
32+
# If node/npm not found, try to source nvm
33+
if ! command -v node &> /dev/null || ! command -v npm &> /dev/null; then
34+
echo -e "${YELLOW}⚠️ Node.js/npm not found in PATH, attempting to load from nvm...${NC}"
35+
36+
# Try to load nvm
37+
export NVM_DIR="$HOME/.nvm"
38+
if [ -s "$NVM_DIR/nvm.sh" ]; then
39+
source "$NVM_DIR/nvm.sh"
40+
if [ -s "$NVM_DIR/bash_completion" ]; then
41+
source "$NVM_DIR/bash_completion"
42+
fi
43+
44+
# Use the latest installed version or 18
45+
if nvm list | grep -q "v18"; then
46+
nvm use 18
47+
else
48+
nvm use node
49+
fi
50+
51+
echo -e "${GREEN}✅ Loaded Node.js from nvm: $(node --version)${NC}"
52+
else
53+
echo -e "${RED}❌ Node.js not found and nvm not available.${NC}"
54+
echo "Please restart your terminal or run:"
55+
echo " source ~/.bashrc # or ~/.zshrc"
56+
echo " ./start"
57+
exit 1
58+
fi
59+
fi
60+
}
61+
62+
echo -e "${CYAN}Welcome to GraphDone! This script will get you up and running quickly.${NC}"
63+
echo ""
64+
65+
# Ensure Node.js is available
66+
ensure_nodejs
67+
68+
# Check if setup or workspace repair is needed
69+
setup_needed=false
70+
workspace_repair_needed=false
71+
72+
if [ ! -f "packages/server/.env" ] || [ ! -f "packages/web/.env" ]; then
73+
setup_needed=true
74+
fi
75+
76+
# Check if workspace dependencies are broken
77+
if [ ! -f "packages/core/dist/index.js" ] || [ ! -L "node_modules/@graphdone/core" ] || [ ! -f "node_modules/.prisma/client/index.js" ]; then
78+
workspace_repair_needed=true
79+
fi
80+
81+
# Run setup if needed
82+
if [ "$setup_needed" = true ]; then
83+
echo -e "${YELLOW}🔧 First time setup detected...${NC}"
84+
echo ""
85+
echo -e "${BLUE}Running initial setup (this may take a few minutes):${NC}"
86+
echo " • Installing dependencies"
87+
echo " • Setting up environment variables"
88+
echo " • Starting database"
89+
echo " • Running migrations"
90+
echo " • Building packages"
91+
echo ""
92+
93+
./tools/setup.sh
94+
95+
echo ""
96+
echo -e "${GREEN}✅ Setup complete!${NC}"
97+
echo ""
98+
elif [ "$workspace_repair_needed" = true ]; then
99+
echo -e "${YELLOW}🔧 Workspace dependencies need repair...${NC}"
100+
echo ""
101+
echo -e "${BLUE}Fixing workspace dependencies:${NC}"
102+
echo " • Rebuilding core package"
103+
echo " • Generating Prisma client"
104+
echo " • Ensuring workspace links"
105+
echo ""
106+
107+
# Quick workspace repair (less aggressive than full setup)
108+
echo -e "${CYAN}📦 Installing dependencies...${NC}"
109+
npm install
110+
111+
echo -e "${CYAN}🏗️ Building core package...${NC}"
112+
(cd packages/core && npm run build)
113+
114+
echo -e "${CYAN}🔧 Generating Prisma client...${NC}"
115+
(cd packages/server && npx prisma generate)
116+
117+
# Verify the fix worked
118+
if [ -f "packages/core/dist/index.js" ] && [ -L "node_modules/@graphdone/core" ]; then
119+
echo ""
120+
echo -e "${GREEN}✅ Workspace repair complete!${NC}"
121+
echo ""
122+
else
123+
echo ""
124+
echo -e "${RED}❌ Workspace repair failed. Running full setup...${NC}"
125+
echo ""
126+
./tools/setup.sh
127+
fi
128+
fi
129+
130+
echo -e "${BLUE}🚀 Starting GraphDone development environment...${NC}"
131+
echo ""
132+
133+
# Start the development environment
134+
if ! ./tools/run.sh; then
135+
echo ""
136+
echo -e "${YELLOW}⚠️ If you see 'command not found' errors:${NC}"
137+
echo " 1. Restart your terminal"
138+
echo " 2. Or run: source ~/.bashrc (or ~/.zshrc)"
139+
echo " 3. Then try: ./start again"
140+
echo ""
141+
fi

tools/cleanup.sh

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!/bin/bash
2+
3+
# GraphDone Cleanup Script
4+
# Kills any processes running on GraphDone's ports
5+
6+
echo "🧹 Cleaning up GraphDone processes..."
7+
8+
# Function to kill processes on a specific port
9+
kill_port() {
10+
local port=$1
11+
local pids=$(lsof -ti:$port 2>/dev/null)
12+
13+
if [ -n "$pids" ]; then
14+
echo "🔄 Killing processes on port $port: $pids"
15+
echo "$pids" | xargs kill -9 2>/dev/null || true
16+
sleep 1
17+
18+
# Check if any processes are still running
19+
local remaining=$(lsof -ti:$port 2>/dev/null)
20+
if [ -n "$remaining" ]; then
21+
echo "⚠️ Some processes on port $port are still running: $remaining"
22+
else
23+
echo "✅ Port $port is now free"
24+
fi
25+
else
26+
echo "✅ Port $port is already free"
27+
fi
28+
}
29+
30+
# Clean up GraphDone ports
31+
kill_port 3127 # Web server
32+
kill_port 4127 # GraphQL API
33+
34+
# Also kill any npm/node processes that might be hanging
35+
echo "🔄 Cleaning up any hanging npm/node processes..."
36+
pkill -f "npm run dev" 2>/dev/null || true
37+
pkill -f "vite" 2>/dev/null || true
38+
pkill -f "tsx watch" 2>/dev/null || true
39+
40+
echo ""
41+
echo "✅ Cleanup complete! You can now run ./start again."

0 commit comments

Comments
 (0)