Sure, here's a basic guide to help someone set up the Rails project on their local development environment:
-
Clone the Repository:
- If the Rails project is already hosted on a version control system like GitHub, provide the URL of the repository and instruct the user to clone it to their local machine using Git.
-
Install Ruby:
- Instruct the user to install Ruby on their system if they haven't already. They can use a version manager like RVM or rbenv for managing Ruby versions.
-
Install Rails:
- Once Ruby is installed, guide the user to install Rails using the following command:
gem install rails
- Once Ruby is installed, guide the user to install Rails using the following command:
-
Navigate to the Project Directory:
- Instruct the user to navigate to the directory of the cloned Rails project using the terminal or command prompt.
-
Install Dependencies:
- Inside the project directory, guide the user to install the project dependencies (gems) using Bundler. They can run the following command:
bundle install
- Inside the project directory, guide the user to install the project dependencies (gems) using Bundler. They can run the following command:
-
Install Postgres and create user
- Install Postgres
sudo apt-get update sudo apt install postgresql postgresql-contrib libpq-dev
postgresql
is a general database package.postgresql-contrib
contains additional utilities and functionality.libpq-dev
use for compiling C programs communicate with Postgres.- Let’s switch to postgres account to access to psql — terminal-based Postgres front-end program.
sudo -i -u postgres psql
- Now there is postgres=# environment. To create a new role enter the following command.
CREATE ROLE <your_username> LOGIN SUPERUSER PASSWORD '<your_password>';
- Install Postgres
-
Create Database:
bin/rails db:create
-
Configure the Database:
- Instruct the user to configure the database by updating the
config/database.yml
file with their database credentials. They may need to create the corresponding database in their development environment.
- Instruct the user to configure the database by updating the
-
Run Migrations:
- After configuring the database, guide the user to run the database migrations using the following command:
rails db:migrate
- After configuring the database, guide the user to run the database migrations using the following command:
-
Start the Rails Server:
- Once the migrations are complete, instruct the user to start the Rails server using the following command:
./bin/dev
- Once the migrations are complete, instruct the user to start the Rails server using the following command:
-
Verify Installation:
- Finally, provide instructions for verifying the installation by opening a web browser and navigating to
http://localhost:3000
. They should see the default Rails welcome page if the setup was successful.
- Finally, provide instructions for verifying the installation by opening a web browser and navigating to
Prerequisites
- Basic Ruby on Rails knowledge and a configured development environment.
- Access to the legacy Microsoft SQL Server database.
- Temporary secure tunneling solution (e.g., Ngrok) for development.
Project Structure
app/
- Rails applicationcontrollers/
- Handles API endpoints for order processing, etc.models/
- Customer, Order, Medication models.config/routes.rb
- Defines API routes.
legacy_integration/
TODOsync_script.rb
- Script to query Rails database and update legacy database (or instructions for Delphi modifications).
Getting Started
- Rails Setup:
- Create a Rails project and generate models for Customer, Order, Medication, etc.
- Establish the database connection.
- Implement logic to bridge inventory checks with the legacy system.
- API Endpoints:
- Design API endpoints in your controllers for:
- User authentication
- Order submission
- Order status updates
- Statement retrieval
- (Optional) API endpoint to receive updates from the legacy system if your integration method permits.
- Design API endpoints in your controllers for:
Deployment (TODO)
- Deploy the app to Render.
EDITOR="code --wait" rails credentials:edit --environment=development
rubocop