Prerequisites
Before setting up your development environment, ensure you have:- Docker Desktop - Download from docker.com
- No subscription required, choose the free tier
- Required for running the containerized application
- VS Code (Recommended) - For the best development experience with integrated tasks
- Git - For cloning and managing the repository
- .env file - Contains application secrets (contact developers for access)
Initial Setup
First-Time Setup
- Clone the repository:
- Build the Docker containers:
-
Obtain the .env file:
- Contact the developers for the
.envfile containing application secrets - Place it in the root directory of the project
- This file is not checked into version control for security reasons
- Contact the developers for the
- Start the containers:
- Initialize the database:
- On first run, the database is automatically initialized with a single admin account:
vp@sjaa.net - To generate sample data for development:
- On first run, the database is automatically initialized with a single admin account:
- Access the application:
- Navigate to https://127.0.0.1:3001
- You’ll see a browser warning about the self-signed certificate
- This is normal in development - click through the warning to proceed
VS Code Tasks (Recommended)
The easiest way to run common development tasks is through VS Code’s built-in task runner. All tasks are pre-configured in .vscode/tasks.json and run commands inside the Docker container automatically.Running Tasks
Access tasks through the Command Palette:- Press Cmd+Shift+P (macOS) or Ctrl+Shift+P (Windows/Linux)
- Type “Tasks: Run Task”
- Select from the list of available tasks
Available VS Code Tasks
Rails Console
Task Name:Rails Console
Opens an interactive Rails console for debugging and exploring the application.
What it does:
- Explore the database and ActiveRecord models
- Test code snippets interactively
- Debug data or relationships
- Run one-off commands
Run All Tests
Task Name:Run All Tests
Runs the complete test suite (models, controllers, system tests).
What it does:
- Before committing changes
- After major refactoring
- To ensure everything works together
- CI/CD validation locally
- Green dots (.) for passing tests
- F for failures
- E for errors
- Final summary with test count and timing
Run Rails Tests
Task Name:Run Rails Tests
Runs only unit and integration tests (excludes system tests for faster execution).
What it does:
- Quick validation during development
- Testing models and controllers only
- Faster feedback loop than full test suite
- Model tests (
test/models/) - Controller tests (
test/controllers/) - Helper tests (
test/helpers/) - Mailer tests (
test/mailers/)
Run Single Test File
Task Name:Run Single Test File
Runs tests from a specific file. VS Code prompts you to enter the test file path.
What it does:
- Focused testing on specific functionality
- Debugging a single failing test
- Iterating on new test cases
- Faster than running entire suite
test/models/person_test.rbtest/controllers/people_controller_test.rbtest/system/memberships_test.rb
Run System Tests
Task Name:Run System Tests
Runs browser-based integration tests using Capybara and Selenium.
What it does:
- Testing full user workflows
- Validating JavaScript interactions
- End-to-end feature verification
- Before deploying major UI changes
Start Rails Debug Server
Task Name:Start Rails Debug Server
Starts the Rails server with remote debugging enabled on port 1234.
What it does:
- When you need to set breakpoints in your code
- Step-through debugging of complex logic
- Inspecting variable state during execution
- Set breakpoints in your code (click in the gutter)
- Open Run and Debug view (Cmd+Shift+D / Ctrl+Shift+D)
- Select “Attach to Rails (Docker)”
- Press F5 to attach the debugger
Update Gemfile.lock
Task Name:Update Gemfile.lock
Rebuilds the Docker image and extracts the updated Gemfile.lock after changing gems.
What it does:
- After adding gems to Gemfile
- After updating gem versions
- After removing gems
./:/rails) overlays your local directory onto the container at runtime. The Gemfile.lock updated during build gets replaced by your local version. This task extracts it to keep them in sync.
Command-Line Tasks
If you prefer working directly with the command line, here are the essential commands:Starting and Stopping
Database Operations
Running Tests
Background Jobs
Custom Rake Tasks
Updating Dependencies
When you update the Gemfile (add/remove/update gems):Debugging
The application supports remote debugging using thedebug gem with VS Code.
Starting a Debug Session
Option 1: VS Code Task (Recommended)- Run the “Start Rails Debug Server” task
- Set breakpoints in your code (click in the gutter)
- Open Run and Debug view (Cmd+Shift+D / Ctrl+Shift+D)
- Select “Attach to Rails (Docker)”
- Press F5 to attach
VS Code Debug Configurations
Three debug configurations are available in .vscode/launch.json:- Attach to Rails (Docker) - Primary option
- Debug Rails (Docker) - Alternative - Fallback option
- Connect to rdbg (Docker) - Direct rdbg connection
Troubleshooting Debugging
Problem: Can’t connect to debugger- Ensure port 1234 is not in use:
lsof -i :1234 - Check Docker logs:
docker compose logs app - Verify debug gem is installed:
docker compose run --rm app gem list debug - Restart containers:
docker compose restart
- Ensure debug server is running
- Verify breakpoint is in executed code path
- Check that source maps are correctly configured
- Try adding
debuggerstatement directly in code
Common Workflows
Adding a New Feature
- Create a new branch:
- Make your changes in your editor
- Write tests for the new functionality
- Run tests using VS Code task “Run All Tests” or:
- Test manually in the browser at https://127.0.0.1:3001
- Commit and push:
Fixing a Bug
- Reproduce the bug in development environment
- Write a failing test that exposes the bug
-
Use the debugger to understand what’s happening:
- Add
debuggerstatement where bug occurs - Run “Start Rails Debug Server” task
- Attach debugger and step through code
- Add
- Fix the bug based on findings
- Verify test passes using “Run All Tests” task
- Commit the fix with descriptive message
Database Schema Changes
- Generate migration:
-
Edit the migration file in
db/migrate/ - Run the migration:
- Update models and tests to reflect schema changes
- Test thoroughly before committing
Adding or Updating Gems
- Edit Gemfile to add/update/remove gems
- Update Gemfile.lock using VS Code task “Update Gemfile.lock” or:
- Verify application still works
- Run tests to catch any issues
- Commit both Gemfile and Gemfile.lock
Best Practices
Container Management
Start containers in background:Testing
Run tests frequently:- Use “Run Rails Tests” task during development (faster)
- Use “Run All Tests” task before committing
- Use “Run Single Test File” task when focusing on specific feature
- Test-driven development helps catch issues early
- Tests serve as documentation
- Easier to refactor with good test coverage
- Use fixtures or factories efficiently
- Minimize database calls in tests
- Run system tests only when needed
Database
Regular backups in development:- After major schema changes
- When test data becomes inconsistent
- Use VS Code task “Generate Test Data” after reset
- Contains secrets and credentials
- Already in .gitignore
- Get from developers for legitimate use
Troubleshooting
Port Already in Use
Problem: Error about port 3001 or 5432 already in use Solution:Database Connection Errors
Problem: Can’t connect to PostgreSQL database Solution:Container Won’t Start
Problem: Docker container fails to start Solution:Tests Failing
Problem: Tests that should pass are failing Solution:Permission Errors
Problem: Permission denied errors when running commands Solution:- Ensure Docker Desktop has necessary permissions
- On macOS: System Preferences → Security & Privacy
- On Linux: Add user to docker group:
- Log out and back in for changes to take effect
Browser Certificate Warning
Problem: Browser shows security warning at https://127.0.0.1:3001 Solution:- This is expected with self-signed certificates
- Safe to click “Advanced” → “Proceed to localhost”
- Warning doesn’t appear in production with valid certificate
Changes Not Reflecting
Problem: Code changes don’t appear in running application Solution:- Check for syntax errors in logs
- Restart may be needed for initializers or routes
- Clear browser cache for asset changes
Environment Variables
Key environment variables in.env file:
- Database:
DATABASE_URL,POSTGRES_USER,POSTGRES_PASSWORD - Rails:
RAILS_ENV,SECRET_KEY_BASE - PayPal:
PAYPAL_CLIENT_ID,PAYPAL_CLIENT_SECRET - Google: OAuth credentials for Calendar, Groups, Admin Directory
- Email: SMTP settings for Gmail
Additional Resources
- CLAUDE.md - AI assistant instructions and command reference
- .vscode/tasks.json - VS Code task definitions
- .vscode/launch.json - Debugger configurations
- docker-compose.yml - Container orchestration
- Dockerfile - Application container definition
- README.md - Project overview and quick start
Summary
The development environment is containerized with Docker for consistency and ease of setup. VS Code tasks provide the recommended workflow for common operations like running tests, accessing the console, and debugging. For developers who prefer the command line, all tasks can also be run withdocker compose and docker container exec commands.
Key points:
- Use Docker Desktop for environment management
- Use VS Code tasks for the best developer experience
- Run tests frequently during development
- Use the debugger to understand complex issues
- Keep containers and database in sync with migrations
- Follow the documented workflows for common tasks
