mirror of
https://github.com/simstudioai/sim.git
synced 2026-01-09 15:07:55 -05:00
feat(turbo): restructured repo to be a standard turborepo monorepo (#341)
* added turborepo * finished turbo migration * updated gitignore * use dotenv & run format * fixed error in docs * remove standalone deployment in prod * fix ts error, remove ignore ts errors during build * added formatter to the end of the docs generator
This commit is contained in:
@@ -18,14 +18,20 @@ alias pgc="PGPASSWORD=postgres psql -h db -U postgres -d simstudio"
|
||||
alias check-db="PGPASSWORD=postgres psql -h db -U postgres -c '\l'"
|
||||
|
||||
# Sim Studio specific aliases
|
||||
alias logs="cd /workspace/sim && tail -f logs/*.log 2>/dev/null || echo 'No log files found'"
|
||||
alias sim-start="cd /workspace/sim && npm run dev"
|
||||
alias sim-migrate="cd /workspace/sim && npx drizzle-kit push"
|
||||
alias sim-generate="cd /workspace/sim && npx drizzle-kit generate"
|
||||
alias sim-rebuild="cd /workspace/sim && npm run build && npm start"
|
||||
alias logs="cd /workspace/apps/sim && tail -f logs/*.log 2>/dev/null || echo 'No log files found'"
|
||||
alias sim-start="cd /workspace && npm run dev"
|
||||
alias sim-migrate="cd /workspace/apps/sim && npx drizzle-kit push"
|
||||
alias sim-generate="cd /workspace/apps/sim && npx drizzle-kit generate"
|
||||
alias sim-rebuild="cd /workspace && npm run build && npm run dev"
|
||||
alias docs-dev="cd /workspace/apps/docs && npm run dev"
|
||||
|
||||
# Default to sim directory
|
||||
cd /workspace/sim 2>/dev/null || true
|
||||
# Turbo related commands
|
||||
alias turbo-build="cd /workspace && npx turbo run build"
|
||||
alias turbo-dev="cd /workspace && npx turbo run dev"
|
||||
alias turbo-test="cd /workspace && npx turbo run test"
|
||||
|
||||
# Default to workspace directory
|
||||
cd /workspace 2>/dev/null || true
|
||||
|
||||
# Welcome message - only show once per session
|
||||
if [ -z "$SIM_WELCOME_SHOWN" ]; then
|
||||
@@ -36,10 +42,16 @@ if [ -z "$SIM_WELCOME_SHOWN" ]; then
|
||||
echo "🚀 Welcome to Sim Studio development environment!"
|
||||
echo ""
|
||||
echo "Available commands:"
|
||||
echo " sim-start - Start the development server"
|
||||
echo " sim-migrate - Push schema changes to the database"
|
||||
echo " sim-generate - Generate new migrations"
|
||||
echo " sim-rebuild - Build and start the production server"
|
||||
echo " sim-start - Start all apps in development mode"
|
||||
echo " sim-migrate - Push schema changes to the database for sim app"
|
||||
echo " sim-generate - Generate new migrations for sim app"
|
||||
echo " sim-rebuild - Build and start all apps"
|
||||
echo " docs-dev - Start only the docs app in development mode"
|
||||
echo ""
|
||||
echo "Turbo commands:"
|
||||
echo " turbo-build - Build all apps using Turborepo"
|
||||
echo " turbo-dev - Start development mode for all apps"
|
||||
echo " turbo-test - Run tests for all packages"
|
||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||||
echo ""
|
||||
fi
|
||||
@@ -23,7 +23,7 @@ RUN echo "$USERNAME ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/$USERNAME \
|
||||
RUN npm install -g npm@latest
|
||||
|
||||
# Install global packages
|
||||
RUN npm install -g drizzle-kit
|
||||
RUN npm install -g drizzle-kit turbo
|
||||
|
||||
# Switch back to dialog for any ad-hoc use of apt-get
|
||||
ENV DEBIAN_FRONTEND=dialog
|
||||
@@ -31,4 +31,5 @@ ENV DEBIAN_FRONTEND=dialog
|
||||
WORKDIR /workspace
|
||||
|
||||
# Expose the ports we're interested in
|
||||
EXPOSE 3000
|
||||
EXPOSE 3000
|
||||
EXPOSE 3001
|
||||
@@ -18,8 +18,9 @@ services:
|
||||
db:
|
||||
condition: service_healthy
|
||||
ports:
|
||||
- "3000:3000"
|
||||
working_dir: /workspace/sim
|
||||
- '3000:3000'
|
||||
- '3001:3001'
|
||||
working_dir: /workspace
|
||||
|
||||
db:
|
||||
image: postgres:16
|
||||
@@ -31,12 +32,12 @@ services:
|
||||
- POSTGRES_PASSWORD=postgres
|
||||
- POSTGRES_DB=simstudio
|
||||
ports:
|
||||
- "5432:5432"
|
||||
- '5432:5432'
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U postgres"]
|
||||
test: ['CMD-SHELL', 'pg_isready -U postgres']
|
||||
interval: 5s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
|
||||
volumes:
|
||||
postgres-data:
|
||||
postgres-data:
|
||||
|
||||
@@ -5,8 +5,8 @@ set -e
|
||||
|
||||
echo "🔧 Setting up Sim Studio development environment..."
|
||||
|
||||
# Change to the sim directory
|
||||
cd /workspace/sim
|
||||
# Change to the workspace root directory
|
||||
cd /workspace
|
||||
|
||||
# Setup .bashrc
|
||||
echo "📄 Setting up .bashrc with aliases..."
|
||||
@@ -19,6 +19,8 @@ echo "📦 Cleaning and reinstalling npm dependencies..."
|
||||
if [ -d "node_modules" ]; then
|
||||
echo "Removing existing node_modules to ensure platform compatibility..."
|
||||
rm -rf node_modules
|
||||
rm -rf apps/sim/node_modules
|
||||
rm -rf apps/docs/node_modules
|
||||
fi
|
||||
|
||||
# Install dependencies with platform-specific binaries
|
||||
@@ -26,16 +28,22 @@ npm install || {
|
||||
echo "⚠️ npm install had issues but continuing setup..."
|
||||
}
|
||||
|
||||
# Set up environment variables if .env doesn't exist
|
||||
if [ ! -f ".env" ]; then
|
||||
# Set up environment variables if .env doesn't exist for the sim app
|
||||
if [ ! -f "apps/sim/.env" ]; then
|
||||
echo "📄 Creating .env file from template..."
|
||||
cp .env.example .env 2>/dev/null || echo "DATABASE_URL=postgresql://postgres:postgres@db:5432/simstudio" > .env
|
||||
if [ -f "apps/sim/.env.example" ]; then
|
||||
cp apps/sim/.env.example apps/sim/.env
|
||||
else
|
||||
echo "DATABASE_URL=postgresql://postgres:postgres@db:5432/simstudio" > apps/sim/.env
|
||||
fi
|
||||
fi
|
||||
|
||||
# Generate schema and run database migrations
|
||||
echo "🗃️ Running database schema generation and migrations..."
|
||||
echo "Generating schema..."
|
||||
cd apps/sim
|
||||
npx drizzle-kit generate
|
||||
cd ../..
|
||||
|
||||
echo "Waiting for database to be ready..."
|
||||
# Try to connect to the database, but don't fail the script if it doesn't work
|
||||
@@ -44,7 +52,9 @@ echo "Waiting for database to be ready..."
|
||||
while [ $timeout -gt 0 ]; do
|
||||
if PGPASSWORD=postgres psql -h db -U postgres -c '\q' 2>/dev/null; then
|
||||
echo "Database is ready!"
|
||||
cd apps/sim
|
||||
DATABASE_URL=postgresql://postgres:postgres@db:5432/simstudio npx drizzle-kit push
|
||||
cd ../..
|
||||
break
|
||||
fi
|
||||
echo "Database is unavailable - sleeping (${timeout}s remaining)"
|
||||
@@ -61,13 +71,13 @@ echo "Waiting for database to be ready..."
|
||||
cat << EOF >> ~/.bashrc
|
||||
|
||||
# Additional Sim Studio Development Aliases
|
||||
alias migrate="cd /workspace/sim && DATABASE_URL=postgresql://postgres:postgres@db:5432/simstudio npx drizzle-kit push"
|
||||
alias generate="cd /workspace/sim && npx drizzle-kit generate"
|
||||
alias dev="cd /workspace/sim && npm run dev"
|
||||
alias build="cd /workspace/sim && npm run build"
|
||||
alias start="cd /workspace/sim && npm run start"
|
||||
alias lint="cd /workspace/sim && npm run lint"
|
||||
alias test="cd /workspace/sim && npm run test"
|
||||
alias migrate="cd /workspace/apps/sim && DATABASE_URL=postgresql://postgres:postgres@db:5432/simstudio npx drizzle-kit push"
|
||||
alias generate="cd /workspace/apps/sim && npx drizzle-kit generate"
|
||||
alias dev="cd /workspace && npm run dev"
|
||||
alias build="cd /workspace && npm run build"
|
||||
alias start="cd /workspace && npm run dev"
|
||||
alias lint="cd /workspace/apps/sim && npm run lint"
|
||||
alias test="cd /workspace && npm run test"
|
||||
EOF
|
||||
|
||||
# Source the .bashrc to make aliases available immediately
|
||||
|
||||
Reference in New Issue
Block a user