GithubHelp home page GithubHelp logo

giftofgrub / askdarcel-api Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sheltertechsf/askdarcel-api

0.0 1.0 0.0 2.62 MB

Backend of the "Ask Darcel" app.

License: GNU General Public License v3.0

Ruby 96.98% HTML 2.17% Shell 0.35% Dockerfile 0.50%

askdarcel-api's Introduction

askdarcel-api Build Status

This project exposes the API endpoints for supporting the askdarcel-web project, which is built using a Ruby on Rails API Server

Onboarding information

Dev Role Description

Technical Onboarding & Team Guidelines

Docker-based Development Environment (Recommended)

Requirements

Docker Community Edition (CE) >= 17.06

Docker Compose >= 1.18

Download and install the version of Docker for your OS.

Creating the .env file

The .env file is a de facto file format that allows you to specify environment variables that can be read by an application. It makes it easier to pass environment variables to an application without manually having to set them in the environment. It is supported by:

In the root of the repo cloned to your local machine, create a file named .env with the credentials listed in this document.

Set up the project

This is not a full guide to Docker and Docker Compose, so please consult other guides to learn more about those tools.

# Build (or rebuild) Docker images
$ docker-compose build

# Start the database container (in the background with -d)
$ docker-compose up -d db

# Generate random database fixtures
$ docker-compose run --rm api rake db:setup db:populate

# Start the Rails development server in the api container (in the foreground)
$ docker-compose up api

# Stop all containers, including background ones
$ docker-compose stop

Running Postman tests from the command line

# Reset DB with initial database fixtures
$ docker-compose run --rm api rake db:setup db:populate

# Run Docker container that executes Postman CLI tool named newman
$ docker-compose run --rm postman

Alternative database setup

# Populate the database with an old dump of the database (circa mid-2017)
$ docker-compose run --rm api rake db:create db:schema:load linksf:import

# Populate the database with a direct copy of the live staging database.
# - Ask technical team for the staging database password.
$ docker-compose run -e STAGING_DB_PASSWORD=<...> --rm api rake db:setup db:import_staging

macOS-based Development Environment Not Using Docker

Install Dependencies

  1. Install Homebrew.
  2. Install rbenv and ruby-build.
  • brew install rbenv
    • Follow further setup instructions (including updating your bash profile) from the link above.
    • Add the following lines to your ~/.bash_profile
    export PATH="$HOME/.rbenv/bin:$PATH"
    eval "$(rbenv init -)"
    
  • brew install ruby-build
  1. Install postgres.
  • brew install postgresql
    • Follow further setup instructions displayed after installation.
  • brew services start postgres

Set up the project

After cloning the repository and cding into the workspace:

  1. Install the required ruby version.
  • rbenv install
  1. Install the bundle gem if it isn't yet installed.
    • which bundle || gem install bundle
  2. Install the required gems.
  • bundle install If encounter "command not found" error, run -source ~/.bash_profile
  1. Set up the Algolia credentials

    • Create a .env file in the root of your askdarcel-api directory
    • Populate that file with the backend environment variables found here
  2. Set up the development database and load dummy data.

  • rake db:create:all
  • rake db:migrate
  • rake linksf:import

Alternatively, you can generate random fixtures:

  • rake db:setup db:populate
  1. (Optional) Run the background job worker.
  • To run a worker to continuously process background jobs:
    • rake jobs:work
  • To run a worker to process all existing background jobs and exit:
    • rake jobs:workoff
  1. Run the development server.
  • rails s -b 0.0.0.0
  1. Do NOT do sudo install -rails

askdarcel-api's People

Contributors

alexanderturinske avatar bryanh210 avatar cliffcrosland avatar davidlundgren avatar dependabot[bot] avatar drcaramelsyrup avatar jfhamlin avatar jjfreund avatar kumquatexpress avatar lexholden avatar lgarofalo avatar maxastuart avatar quanhuynh avatar raawr avatar richardxia avatar shannonrdunn avatar trucnguyen avatar tsyaeger avatar twolfe2 avatar zjipsen avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.