Skip to content

Latest commit

 

History

History
80 lines (50 loc) · 2.88 KB

INSTALLING.md

File metadata and controls

80 lines (50 loc) · 2.88 KB

How do I install the Code Corps API?

Requirements

You will need to install Docker.

Here are some direct links if you're on Mac OS X or Windows.

Follow those download instructions. Once you can run the docker command, you can safely move on.

Clone this repository

You'll want to clone this repository with git clone https://github.com/code-corps/code-corps-api.git.

The directory structure will look like the following:

code-corps-api/          # → Root folder for this project
├── app/
├── bin/
├── ...                  # → More standard Rails files
├── docker-compose.yml   # → Compose file for configuring Docker containers
└── Dockerfile           # → Creates base Ruby Docker container

Setup your Docker containers and run the server

Note: We bind to ports 80 for web, 8081 for apiary, 6380 for redis and 5001 for foreman. Make sure you're not running anything on those ports. We do not expose port 5432 for postgres or 9200 for elasticsearch.

Go to the code-corps-api directory and type:

docker-compose build
docker-compose up

You should now see a lot of output from the Docker processes and will not be able to interact with that terminal window.

Docker will set up your base Ruby container, as well as containers for:

  • postgres
  • elasticsearch
  • redis
  • web runs foreman s with the Procfile.dev
  • test runs guard start
  • apiary runs an Apiary client server on port 8081

You can view more detailed information about these services in the docker-compose.yml file, but you shouldn't need to edit it unless you're intentionally contributing changes to our Docker workflow.

Setup your database

You can now create and seed your database in the web container with our helpful bash script.

Open up a new terminal window and type:

bin/setup

At its heart, this script is running:

docker-compose run web rake db:create db:migrate db:test:prepare db:seed_fu

Point your browser (or make a direct request) to http://api.lvh.me/ping. There should be a {"ping":"pong"} response from it. If you hit the index route instead, you'll probably get INDEX NOT FOUND since it's not serving up our Ember app yet.

lvh.me resolves to localhost so you can use subdomains, like our api subdomain.

Next steps

Now that you're set up, you should read more about how to develop with the API.

Issues installing?

Having trouble?

Create an issue in this repo and we'll look into it.

Docker's a bit new for us, so there may be some hiccups at first. But hopefully this makes for a less painful developer environment for you in the long run.