Skip to content

fruitizz/metrics-api

Repository files navigation

README

This README documents the steps necessary to get the metrics-api Ruby on Rails application up and running locally.

Installation

This describes all that you need to make the app run successfully.

Bundle dependencies

This includes all infrastructure dependencies (besides nvm). To install these required items, first, make sure you have homebrew installed and set up. Afterward, run the following command in the root of the repository:

brew bundle

Install Ruby

Install rbenv and Ruby 2.7.6.

rbenv init
rbenv install 2.7.6

Install Node

Install nvm and Node 16.13.1

Install yarn

via npm install --global yarn (in your node's version)

or

via homebrew brew install yarn

Setting up dependencies

Put PostgreSQL on the path (zsh example):

echo 'export PATH="/opt/homebrew/opt/postgresql@12/bin:$PATH"' >> ~/.zshrc

To run on startup:

# to have launchd start postgresql now and restart at login
brew services start postgresql@12
brew services stop postgresql@12
brew services restart postgresql@12

Clone repository

git clone [email protected]:azizmashkour/metrics-api.git && cd metrics-api

Set up the database

Run rake tasks to create the schema and run any pending migrations.

bundle exec rake db:setup
bundle exec rake db:migrate

To add test data in development, run:

bundle exec rake db:seed

This will create a list of fake metrics to be populated and used in the Chart.js graph. Once this command is executed, the next time you may try to run it again, it automatically update the existing data instead of deleting them.

Install gems and yarn packages

Since we are using some yarn packages and ruby gems, we need to install all of them by running the commands:

gem install bundler
bundle install
yarn install

Run the app

To start the web server, run this command:

bundle exec rails server

Then open your browser to http://localhost:3000. You should see the home page of the metrics Api.

If your CSS is not loaded, ensure the run these commands and restart your server:

./bin/bundle add tailwindcss-rails
./bin/rails tailwindcss:install

Other commands to run

There are some other common commands you'll want to run:

bundle exec rails console # interactive console
tail -f log/development.log

Run the tests

To run the tests, run this command:

bundle exec rake spec

or

bundle exec rails spec

To set up the test databases needed to run:

RAILS_ENV=test bundle exec rake db:setup

Other resources

React Query ChartJS TailwindCSS

About

We want a Frontend + Backend application that allows you to post and visualize metrics.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages