A location-based chat application where Texas A&M University students can send and view messages within a 500-meter radius of their current location.
- Backend: Ruby on Rails 8.0.3
- Database: SQLite3 (development), PostgreSQL (production)
- Authentication: OmniAuth + Google OAuth 2.0
- Testing: RSpec (96% coverage), Cucumber
- Location: ECEF Cartesian coordinates for distance calculations
- Deployment: Heroku
- Ruby 3.4.5
- Rails 8.0.3
- PostgreSQL (for production)
- SQLite3 (for development/testing)
- Git
- Heroku CLI
- Google Cloud Console account
- Clone Repository
git clone https://github.com/tamu-edu-students/CSCE-606-Project-3-Group-7.git
cd CSCE-606-Project-3-Group-7- Install Dependencies
# Install Ruby gems
bundle install
# Install JavaScript packages (if needed)
npm install- Configure Environment Variables
Create .env file in project root:
touch .env- Add your Google OAuth credentials:
GOOGLE_CLIENT_ID=your_client_id_from_google_console
GOOGLE_CLIENT_SECRET=your_client_secret_from_google_console
- No quotes around values
- Add
.envto.gitignore(already done) - Never commit credentials to Git
- Google OAuth Setup
- Go to Google Cloud Console
- Create a new project: "Proximity Chat App"
- Navigate to APIs & Services → Credentials
- Click Create Credentials → OAuth 2.0 Client ID
- Configure OAuth consent screen:
- User Type: External
- App name: "Proximity Chat"
- User support email: your email
- Authorized domains:
localhost(for dev)
- Create OAuth Client ID:
- Application type: Web application
- Authorized redirect URIs:
http://localhost:3000/auth/google_oauth2/callback(development)https://your-app-name.herokuapp.com/auth/google_oauth2/callback(production)
- Copy Client ID and Client Secret to
.envfile
- Setup Database
# Create database
rails db:create
# Run migrations
rails db:migrate
# Optional: Seed data
rails db:seed- Run Tests
# Run RSpec unit tests
bundle exec rspec
# Run Cucumber acceptance tests
bundle exec cucumber
# View coverage report
open coverage/index.htmlAll tests should pass with >90% coverage.
- Start Development Server
rails serverVisit http://localhost:3000 and test Google OAuth login.
- Install Heroku CLI
# macOS
brew tap heroku/brew && brew install heroku
# Or download from: https://devcenter.heroku.com/articles/heroku-cliVerify installation:
heroku --version- Login to Heroku
heroku loginThis opens browser for authentication.
- Create Heroku App
# Create app (replace with your desired name)
heroku create tamu-proximity-chat
# Or let Heroku generate name:
heroku createNote: App will be available at https://tamu-proximity-chat.herokuapp.com
- Add PostgreSQL Database
heroku addons:create heroku-postgresql:miniThis provisions a PostgreSQL database (free tier: mini).
- Configure Environment Variables on Heroku
heroku config:set GOOGLE_CLIENT_ID=your_client_id_here
heroku config:set GOOGLE_CLIENT_SECRET=your_client_secret_here
heroku config:set RAILS_MASTER_KEY=$(cat config/master.key)Update Google OAuth redirect URI:
-
Go back to Google Cloud Console
-
Add production callback URL:
https://your-app-name.herokuapp.com/auth/google_oauth2/callback -
Save
-
Deploy to Heroku
# Make sure you're on main branch
git checkout main
# Push to Heroku
git push heroku mainHeroku will:
- Detect Rails app
- Install dependencies
- Compile assets
- Deploy application
- Run Database Migrations
heroku run rails db:migrate- Verify Deployment
# Open app in browser
heroku open
# Check logs
heroku logs --tailCreate .github/workflows/deploy.yml:
name: Deploy to Heroku
on:
push:
branches: [ main ]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.4.5
- name: Install dependencies
run: bundle install
- name: Run tests
run: |
bundle exec rspec
bundle exec cucumber
deploy:
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: akhileshns/[email protected]
with:
heroku_api_key: ${{secrets.HEROKU_API_KEY}}
heroku_app_name: "your-app-name"
heroku_email: "[email protected]"Add Heroku API key to GitHub secrets:
- Get API key:
heroku auth:token - GitHub repo → Settings → Secrets → New repository secret
- Name:
HEROKU_API_KEY, Value: your token
Error: redirect_uri_mismatch
- Solution: Check Google Console redirect URIs match exactly
- Development:
http://localhost:3000/auth/google_oauth2/callback - Production:
https://your-app.herokuapp.com/auth/google_oauth2/callback
Error: Only TAMU emails allowed
- Solution: Use @tamu.edu Google account, not personal Gmail
Error: PG::ConnectionBad
- Solution: Check Heroku PostgreSQL addon is provisioned:
heroku addons - Restart dynos:
heroku restart
Error: Migrations pending
- Solution: Run:
heroku run rails db:migrate
Error: Build failed
- Solution: Check
Gemfile.lockis committed:git add Gemfile.lock - Check Ruby version matches Heroku:
cat .ruby-version
Error: Assets not compiling
- Solution: Precompile locally:
RAILS_ENV=production rails assets:precompile - Commit:
git add public/assets
# View logs
heroku logs --tail
# Open Rails console
heroku run rails console
# Restart app
heroku restart
# Check config vars
heroku config
# Open app
heroku open
# Check dyno status
heroku ps
# Run migrations
heroku run rails db:migrate
# Reset database (⚠️ destroys data)
heroku pg:reset DATABASE_URL
heroku run rails db:migrate- Enable Caching
heroku run rails cache:enable- Scale Dynos (if needed)
# Check current dynos
heroku ps
# Scale web dynos
heroku ps:scale web=2- Add Redis for Caching (Optional)
heroku addons:create heroku-redis:mini- ✅ Environment variables set via
heroku config - ✅
.envin.gitignore - ✅
config/master.keynot committed - ✅ HTTPS enforced (automatic on Heroku)
- ✅ CSRF protection enabled
- ✅ OAuth 2.0 for authentication
- ✅ Email domain restriction (@tamu.edu)
For issues:
- Check Heroku Status
- Review logs:
heroku logs --tail - Check GitHub Issues
- Contact team via course Slack
Course: CSCE 606 - Software Engineering
Semester: Fall 2025
Institution: Texas A&M University
This project is part of an academic course assignment.