From afdc1deeb8579a3f00023c91f9fe0b1291c8f667 Mon Sep 17 00:00:00 2001 From: wahibkapdi Date: Thu, 24 Oct 2024 21:18:26 -0500 Subject: [PATCH 1/4] Update README.md Updated the Readme to include the setup and deployment steps. --- README.md | 112 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 112 insertions(+) diff --git a/README.md b/README.md index 73997c0..1d9aff3 100644 --- a/README.md +++ b/README.md @@ -19,3 +19,115 @@ The key stakeholder for this application is the Associate Department Head, who i - Sprint 2: - Goal: Have a raw views for all the data upload. - (Sprint Plan)[https://github.com/tamu-edu-students/Faculty-Teaching-Assignment/blob/main/documentation/Fall2024/Sprint_2_Plan.pdf] + +# Getting Started with Setup and Deployment + +## Prerequisites +1. **Heroku Account**: [Sign up for a Heroku account](https://signup.heroku.com/). +2. **Heroku CLI**: Download and install the [Heroku CLI](https://devcenter.heroku.com/articles/heroku-cli). +3. **GitHub Repository**: Ensure your Rails application is committed and pushed to a GitHub repository. +4. **Rails and Ruby**: Check that you have Ruby and Rails installed locally to set up the app. +5. **OAuth Configuration**: Ensure you have Google OAuth API keys + +--- + +## 1. Clone the GitHub Repository (If Needed) +If you're setting up the project locally, clone the repository: + +```bash +git clone https://github.com/tamu-edu-students/Faculty-Teaching-Assignment.git +cd Faculty-Teaching-Assignment +``` + +--- + +## 2. Install Dependencies and setup Rails Master Key +Run `bundle install` to install all required dependencies. + +```bash +bundle install +``` +Generate your ```GOOGLE_CLIENT_ID``` and ```GOOGLE_CLIENT_SECRET```. Encrypt both of these using a ```RAILS_MASTER_KEY``` and store it in your ```config/credentials.ymc.enc``` +Make sure you ```config/master.key``` popuplated with your ```RAILS_MASTER_KEY```. + +or just store your Google OAuth credentials in your ```config/credentials.ymc.enc``` unencrypted but do not commit them. + +--- + +## 3. Set Up Database (Locally) +Run database migrations and set up the database: + +```bash +rails db:create +rails db:migrate +rails db:seed # If there are any seed files +rails server # To run locally +``` + +## 4. Prepare Application for Heroku + +1. **Add a `Procfile`**: Create a file named `Procfile` in the root directory with the following line: + + ```plaintext + web: bundle exec puma -C config/puma.rb + ``` + +2. **Add the Heroku Postgres Add-on**: Heroku uses PostgreSQL as the default database for Rails apps. Check your `Gemfile` for the `pg` gem. + +3. **Environment Variables**: Use `dotenv` for local testing and set variables on Heroku using the CLI. + +--- + +## 5. Deploy to Heroku + +1. **Login to Heroku**: + + ```bash + heroku login + ``` + +2. **Create a New Heroku App**: + + ```bash + heroku create # Optionally specify an app name + ``` + +3. **Add Heroku as a Git Remote**: + + ```bash + git remote add heroku https://git.heroku.com/.git + ``` + +4. **Push to Heroku**: + + ```bash + git push heroku main + ``` + +5. **Run Database Migrations on Heroku**: + + ```bash + heroku run rails db:migrate + ``` + +--- + +## 6. Configure Environment Variables on Heroku and add redirect URI + +Add the Heroku domain as an authorized redirect URI to your Google OAuth. Example: +```bash +https://.herokuapp.com/auth//callback +``` + +Set environment variables on Heroku for any API keys, secrets, or configuration variables, you will have to setup your Google Authentication key : + +If you have used ```RAILS_MASTER_KEY``` to encrypt +```bash +heroku config:set RAILS_MASTER_KEY= +``` + +or +```bash +heroku config:set GOOGLE_CLIENT_ID= +heroku config:set GOOGLE_CLIENT_SECRET= +``` From f0ad29126c9d071d9e4d8c5ec1e24bd4399f863e Mon Sep 17 00:00:00 2001 From: wahibkapdi Date: Fri, 25 Oct 2024 12:12:45 -0500 Subject: [PATCH 2/4] Update README.md --- README.md | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 1d9aff3..ba14a64 100644 --- a/README.md +++ b/README.md @@ -11,12 +11,12 @@ The key stakeholder for this application is the Associate Department Head, who i - **App** : https://faculty-teaching-assignment-31f5f9c405bc.herokuapp.com - **Code Climate Report**: https://codeclimate.com/github/tamu-edu-students/Faculty-Teaching-Assignment - **Team Working agreement** : https://github.com/tamu-edu-students/Faculty-Teaching-Assignment/blob/documentation/documentation/Fall2024/Team%20Working%20Agreement.md -- **Sprint Plans**: - - Sprint 1: +- **Sprint Documentation**: + - Sprint 1: - Goal: Setup and understand the project, get client data and enable user login and authentication - (Sprint Plan)[https://github.com/tamu-edu-students/Faculty-Teaching-Assignment/blob/documentation/documentation/Fall2024/Sprint_1_Plan.pdf] - (Retrospective)[https://github.com/tamu-edu-students/Faculty-Teaching-Assignment/blob/main/documentation/Fall2024/Sprint%201%20Retrospective.pdf] - - Sprint 2: + - Sprint 2: - Goal: Have a raw views for all the data upload. - (Sprint Plan)[https://github.com/tamu-edu-students/Faculty-Teaching-Assignment/blob/main/documentation/Fall2024/Sprint_2_Plan.pdf] @@ -47,10 +47,13 @@ Run `bundle install` to install all required dependencies. ```bash bundle install ``` -Generate your ```GOOGLE_CLIENT_ID``` and ```GOOGLE_CLIENT_SECRET```. Encrypt both of these using a ```RAILS_MASTER_KEY``` and store it in your ```config/credentials.ymc.enc``` -Make sure you ```config/master.key``` popuplated with your ```RAILS_MASTER_KEY```. +Setup your Google OAuth Rails Credentials using Google Developer Console. +For a more detailed explantion, see +[Setup Google OAuth on Google's End](https://github.com/tamu-edu-students/Google-Auth-Ruby-By-JD?tab=readme-ov-file#setup-google-oauth-on-googles-end) +and +[Add OAuth ID and Secret to Rails Credentials](https://github.com/tamu-edu-students/Google-Auth-Ruby-By-JD?tab=readme-ov-file#create-an-initializer-for-omniauth). -or just store your Google OAuth credentials in your ```config/credentials.ymc.enc``` unencrypted but do not commit them. +If steps are followed correctly you would have your ```RAILS_MASTER_KEY``` in ```config/master.key```. NEVER EVER COMMIT THIS TO GIT. --- @@ -126,8 +129,4 @@ If you have used ```RAILS_MASTER_KEY``` to encrypt heroku config:set RAILS_MASTER_KEY= ``` -or -```bash -heroku config:set GOOGLE_CLIENT_ID= -heroku config:set GOOGLE_CLIENT_SECRET= -``` +If the above steps do not work, see [Deploy to Heroku](https://github.com/tamu-edu-students/Google-Auth-Ruby-By-JD?tab=readme-ov-file#deploy-to-heroku) for OmniAuth documentation. From 544288e70b41fa6f5b6a3e0cd775575030e2e752 Mon Sep 17 00:00:00 2001 From: wahibkapdi Date: Fri, 25 Oct 2024 12:24:26 -0500 Subject: [PATCH 3/4] Update README.md --- README.md | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index ba14a64..c86f9de 100644 --- a/README.md +++ b/README.md @@ -12,13 +12,13 @@ The key stakeholder for this application is the Associate Department Head, who i - **Code Climate Report**: https://codeclimate.com/github/tamu-edu-students/Faculty-Teaching-Assignment - **Team Working agreement** : https://github.com/tamu-edu-students/Faculty-Teaching-Assignment/blob/documentation/documentation/Fall2024/Team%20Working%20Agreement.md - **Sprint Documentation**: - - Sprint 1: - - Goal: Setup and understand the project, get client data and enable user login and authentication - - (Sprint Plan)[https://github.com/tamu-edu-students/Faculty-Teaching-Assignment/blob/documentation/documentation/Fall2024/Sprint_1_Plan.pdf] - - (Retrospective)[https://github.com/tamu-edu-students/Faculty-Teaching-Assignment/blob/main/documentation/Fall2024/Sprint%201%20Retrospective.pdf] - - Sprint 2: - - Goal: Have a raw views for all the data upload. - - (Sprint Plan)[https://github.com/tamu-edu-students/Faculty-Teaching-Assignment/blob/main/documentation/Fall2024/Sprint_2_Plan.pdf] + * Sprint 1: + * Goal: Setup and understand the project, get client data and enable user login and authentication + * [Sprint Plan](https://github.com/tamu-edu-students/Faculty-Teaching-Assignment/blob/documentation/documentation/Fall2024/Sprint_1_Plan.pdf) + * [Retrospective](https://github.com/tamu-edu-students/Faculty-Teaching-Assignment/blob/main/documentation/Fall2024/Sprint%201%20Retrospective.pdf) + * Sprint 2: + * Goal: Have a raw views for all the data upload. + * [Sprint Plan](https://github.com/tamu-edu-students/Faculty-Teaching-Assignment/blob/main/documentation/Fall2024/Sprint_2_Plan.pdf) # Getting Started with Setup and Deployment @@ -120,6 +120,7 @@ rails server # To run locally Add the Heroku domain as an authorized redirect URI to your Google OAuth. Example: ```bash https://.herokuapp.com/auth//callback +# Or whatever it may be ``` Set environment variables on Heroku for any API keys, secrets, or configuration variables, you will have to setup your Google Authentication key : From b33a9c3a54c0198232b8fab78d023d33a0e1f5dd Mon Sep 17 00:00:00 2001 From: Wahib Kapdi Date: Fri, 25 Oct 2024 12:27:48 -0500 Subject: [PATCH 4/4] Changed File Location --- .../{ => Fall2024}/Sprint_2_Retrospective.pdf | Bin documentation/{ => Fall2024}/Sprint_3_Plan.pdf | Bin 2 files changed, 0 insertions(+), 0 deletions(-) rename documentation/{ => Fall2024}/Sprint_2_Retrospective.pdf (100%) rename documentation/{ => Fall2024}/Sprint_3_Plan.pdf (100%) diff --git a/documentation/Sprint_2_Retrospective.pdf b/documentation/Fall2024/Sprint_2_Retrospective.pdf similarity index 100% rename from documentation/Sprint_2_Retrospective.pdf rename to documentation/Fall2024/Sprint_2_Retrospective.pdf diff --git a/documentation/Sprint_3_Plan.pdf b/documentation/Fall2024/Sprint_3_Plan.pdf similarity index 100% rename from documentation/Sprint_3_Plan.pdf rename to documentation/Fall2024/Sprint_3_Plan.pdf