Skip to content

ShelterTechSF/askdarcel-api

Repository files navigation

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 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