Jimmy - The Gym Buddy Finder App is designed to address the challenges college students face in finding motivated and compatible workout partners. Many students struggle to maintain a consistent fitness routine due to a lack of accountability and companionship. Jimmy connects students who share similar workout interests and fitness goals, making it easier to find gym partners, join sports teams, and participate in group activities. By providing a user-friendly platform where students can create profiles, indicate their workout preferences, and browse potential partners within the campus community, Jimmy fosters a supportive fitness environment.
The app ensures a trustworthy and exclusive environment by requiring users to sign up with a university email. Key functionalities include profile creation, fitness preference matching, messaging capabilities, and notification systems to coordinate workouts and interactions. Jimmy not only facilitates individual connections but also supports sports teams and fitness clubs in recruiting members, thereby enhancing student engagement and promoting overall well-being on campus. Throughout the development process, we focused on creating a secure, intuitive, and engaging platform that meets the needs of college students seeking workout partners. By considering user feedback and continuously refining features, Jimmy aims to foster a supportive fitness community within college campuses.
To get started with the project, follow these steps:
-
Clone the Repository
git clone https://github.com/tamu-edu-students/jimmy-gym-buddy-finder.git cd jimmy-gym-buddy-finder
-
Install Dependencies. Ensure you have rbenv, ruby and bundler installed.
sudo apt install rbenv rbenv install 3.3.4 gem install bundler bundle config set --local without 'production' bundle install
-
Setup Database. Set up the database by running:
rails db:migrate
-
Omniauth Authentication Setup
The app uses Omniauth for Google authentication. To configure Google OAuth:
- Follow the Google OAuth setup documentation for Rails app - OAuth on Rails.
- Make sure to create a Google Developer Console project, set up OAuth credentials, and configure the redirect URI to match your Heroku app's domain.
- The required gems and corresponding configuration has been done already and can be found in
config/initializers/omniauth.rb
. - The following environment variables are to setup in Rails credentials in order for omniauth to work:
google: client_id: <google-client-id> client_secret: <google-client-secret>
-
Setup Secrets
-
To add any environment variables (Google Omniauth client_id and client_secret) securely in Rails credentials, use the following command:
EDITOR="vim" rails credentials:edit
-
This command does the following:
- Opens the encrypted
config/credentials.yml.enc
file for editing. - Allows you to add environment variables (e.g., API keys, secrets).
- Opens the encrypted
-
Once saved, Rails encrypts the file using the
config/master.key
. Thismaster.key
is essential to decrypt the credentials file at runtime. Theconfig/master.key
is automatically generated when you runrails credentials:edit
for the first time.
-
-
Verify Setup. Start the Rails server:
rails server
Visit http://localhost:3000
in your browser to confirm the app is running.
The project includes two types of test suites: RSpec and Cucumber. Follow the steps below to run the tests.
RSpec is used for unit and integration testing. To run the RSpec tests:
bundle exec rspec
Cucumber is used for behavior-driven development (BDD) and testing user scenarios. To run the Cucumber tests:
bundle exec cucumber
This guide will walk you through the process of deploying the Jimmy - Gym Buddy Finder Ruby on Rails app on the Heroku platform. It includes steps for setting up database, real-time chat, and image storage.
Before starting the deployment process, ensure you have the following:
-
A Heroku account and Heroku CLI installed
-
AWS account for S3 setup
-
Local Rails development environment set up
To store profile images, you'll need to create an Amazon S3 bucket.
- Follow the instructions to Create an S3 Bucket. 2. Once the bucket is created, obtain the following credentials from AWS:
- Access Key ID
- Secret Access Key
- The following environment variables are to setup in rails credentials in order for aws s3 bucket connection to happen:
aws: access_key_id: <aws-access-id> secret_access_key: <aws-secret-key>
- Follow the steps in Setup Secrets section to setup rails credentials for AWS secrets.
-
Create an account on Heroku and install Heroku CLI.
-
Log in to your Heroku account using the CLI:
heroku login
-
Create a new Heroku app:
heroku create <app-name>
- This will create a new Heroku app on your Heroku account.
- It also generates a new Heroku Git remote linked to the app.
-
Add Heroku as a Git remote: After creating the Heroku app, you will receive a Git remote URL. You will need to add this URL as a remote in your Git configuration.
To add it, run the following command:git remote add <remote-name> <remote-uri>
- Replace
<remote-url>
with the Git remote URL provided by Heroku (e.g.,https://git.heroku.com/<app-name>.git
). - The remote is named
heroku
by default, but you can change the name if needed.
- Replace
-
Check the added Git remotes: To check that the Heroku remote was added successfully, run the following command:
git remote -v
- This will list all remotes in your local repository.
- Ensure the
heroku
remote is pointing to the correct Heroku app repository.
-
Set the Rails
master.key
on Heroku: Themaster.key
is required to decrypt thecredentials.yml.enc
file during runtime. Typically, this key is stored in theconfig/master.key
file in your local project. To set this key in Heroku’s environment, run:heroku config:set RAILS_MASTER_KEY=$(cat config/master.key) --remote <remote-name>
-
Push your local project to Heroku:
git push <remote-name> main
This will push your local
main
branch to the Heroku remote repository, deploying your app.
After deploying your app to Heroku, you need to configure the OAuth redirect URL in the Google Developer Console to enable Google OmniAuth authentication.
-
Obtain your Heroku app's deployment URL:
- After deploying your app, Heroku generates a URL in the format:
https://<your-heroku-app-name>.herokuapp.com
- After deploying your app, Heroku generates a URL in the format:
-
Add the URL to the Google Developer Console:
- Go to the Google Cloud Console.
- Navigate to APIs & Services > Credentials.
- Select your OAuth 2.0 Client ID.
- Under the Authorized redirect URIs section, add the following:
https://<your-heroku-app-name>.herokuapp.com/auth/google_oauth2/callback
The deployed app will now use the configured redirect URL for Google OmniAuth authentication.
We will use Heroku Postgres to set up the database for the app.
-
You need to have a database provisioned for your application. Procure the following add-on and attach it to your heroku app - Heroku Postgres. (Choose the Essential-0 plan for minimal cost)
-
This will automatically provision the PostgreSQL database and configure the connection. To verify the database connection, check the DATABASE_URL config variable:
heroku config:get DATABASE_URL --remote <remote-name>
-
Migrate the database:
heroku run rake db:migrate --remote <remote-name>
Redis will be used for enabling real-time chats with the help of WebSockets. We will use the Heroku Key-Value Store add-on to set up Redis.
- You need to have a Heroku Key-Value Store provisioned for your application. Procure the following add-on and attach it to your heroku app - Heroku Key-Value Store. (Choose the mini plan for minimal cost)
- Check the configuration for Redis:
heroku config:get REDIS_URL --remote <remote-name>
- The corresponding configuration for Redis has been already added and can be found in
config/cable.yml
file. - After deploying your app to Heroku, you need to set the correct Action Cable URL and allowed request origins in the
config/environments/production.erb
file for WebSocket connections.- Open the
config/environments/production.erb
file in your Rails app. - Update
config.action_cable.url
andconfig.action_cable.allowed_request_origins
using the Heroku app URL. - Commit the changes the push the code to heroku remote.
- Open the
To check your app's logs, use the following command:
heroku logs --tail --remote <remote-name>
The Jimmy - Gym Buddy Finder app is now successfully deployed on Heroku with the necessary configurations for authentication, database, real-time chats, and image storage. Make sure to monitor and scale your app as needed using Heroku’s various add-ons and resources.
Name | |
---|---|
Kushal Lahoti | kushal.1170234@tamu.edu |
Yash Phatak | ysphatak@tamu.edu |
Mrunmay Deshmukh | mrunmayd@tamu.edu |
Barry Liu | barry89130663@tamu.edu |
Wei-Chien Cheng | wccheng@tamu.edu |
Chuan-Hsin Wang | chuanhsin0110@tamu.edu |
Kuan-Ru Huang | randy103104@tamu.edu |