Initial commit. Working login, example UI with prototype and demo, connections to DB and DAV, local and prod setups.
This commit is contained in:
Executable
+65
@@ -0,0 +1,65 @@
|
||||
#!/usr/bin/env zsh
|
||||
|
||||
SESSION_NAME="crussell-dev"
|
||||
|
||||
# --- Load root .env into environment ---
|
||||
set -a
|
||||
source .env
|
||||
set +a
|
||||
echo "✅ Loaded environment from .env"
|
||||
|
||||
# --- Check if Docker is running, auto-start if necessary ---
|
||||
if ! docker info > /dev/null 2>&1; then
|
||||
echo "🐳 Docker daemon is not running. Attempting to start it..."
|
||||
sudo systemctl start docker
|
||||
sleep 2
|
||||
if ! docker info > /dev/null 2>&1; then
|
||||
echo "❌ Failed to start Docker. Exiting."
|
||||
exit 1
|
||||
fi
|
||||
echo "✅ Docker started successfully."
|
||||
fi
|
||||
|
||||
# --- Reset PostgreSQL ---
|
||||
echo "🗑️ Resetting PostgreSQL container..."
|
||||
docker compose down -v postgres
|
||||
docker compose up postgres -d
|
||||
|
||||
echo "⏳ Waiting 5 seconds for DB init..."
|
||||
sleep 5
|
||||
|
||||
# --- Kill existing tmux session (optional clean start) ---
|
||||
tmux has-session -t $SESSION_NAME 2>/dev/null
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "⚠️ Existing tmux session detected — killing it..."
|
||||
tmux kill-session -t $SESSION_NAME
|
||||
fi
|
||||
|
||||
# --- Start new tmux session ---
|
||||
echo "🎛️ Starting tmux session: $SESSION_NAME"
|
||||
tmux new-session -d -s $SESSION_NAME -n DB
|
||||
|
||||
# Pane 1: DB (already named `DB` via -n)
|
||||
tmux send-keys -t $SESSION_NAME "docker exec -it postgres psql -U myuser -d mydb -c \"\\dt\"" C-m
|
||||
|
||||
# Split for Frontend
|
||||
tmux split-window -h -t $SESSION_NAME
|
||||
tmux select-pane -t $SESSION_NAME:0.1 -T "Frontend"
|
||||
tmux send-keys -t $SESSION_NAME:0.1 "cd frontend && npm run dev -- --host" C-m
|
||||
|
||||
# Split for Backend
|
||||
tmux split-window -h -t $SESSION_NAME
|
||||
tmux select-pane -t $SESSION_NAME:0.2 -T "Backend"
|
||||
tmux send-keys -t $SESSION_NAME:0.2 "cd backend && go run -tags dev ./main.go" C-m
|
||||
|
||||
# Balance layout
|
||||
tmux select-layout -t $SESSION_NAME even-horizontal
|
||||
|
||||
# Ensure pane 0 is labeled correctly
|
||||
tmux select-pane -t $SESSION_NAME:0.0 -T "DB"
|
||||
|
||||
# Focus the DB pane before attaching
|
||||
tmux select-pane -t $SESSION_NAME:0.0
|
||||
|
||||
# Attach
|
||||
tmux attach-session -t $SESSION_NAME
|
||||
Reference in New Issue
Block a user