Skip to content

Commit

Permalink
Merge pull request #641 from code-corps/remove-docker-and-update-docs
Browse files Browse the repository at this point in the history
Remove Docker and update docs
  • Loading branch information
joshsmith committed Jan 17, 2017
2 parents 5ff690f + edcf10e commit 329d0b2
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 203 deletions.
2 changes: 1 addition & 1 deletion .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Thanks for thinking about helping! How would you like to help?

2. Read and work through [the installation guide](/docs/INSTALLING.md).

3. Run the tests. We only take pull requests with passing tests, and it's great to know that you have a clean slate: `docker-compose run test mix test`
3. Run the tests. We only take pull requests with passing tests, and it's great to know that you have a clean slate: `MIX_ENV=test mix test`

Okay, you're ready to go!

Expand Down
28 changes: 0 additions & 28 deletions Dockerfile

This file was deleted.

22 changes: 13 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,31 +26,35 @@ You can also always come :wave: hello [in our Slack](http://slack.codecorps.org)

We highlight everyone who's contributed to [the Code Corps team page](https://www.codecorps.org/team). If we've missed you for some reason, please [open an issue in the Ember app](https://github.com/code-corps/code-corps-ember/issues/new)!

**At the moment, our focus is integration with Stripe**, so if you want to help, that would be the most useful spot. Check our [Donations milestone](https://github.com/code-corps/code-corps-api/blob/develop/milestone/1) to see which parts we need help on. Of course, help with other areas is always welcome, so if that sort of thing isn't your cup of tea, feel free to pick anything else.
## Where should I help?

## Installing with Docker
We recommend checking the latest [milestones on GitHub](https://github.com/code-corps/code-corps-api/milestones) to get a sense for our current priorities.

To make your life easier, you can just clone this repository and use our Docker container. [Follow this guide to get started.](https://github.com/code-corps/code-corps-api/blob/develop/docs/INSTALLING.md)
Of course, help with other areas is always welcome, so if the current milestones aren't your cup of tea, feel free to [browse the issues](https://github.com/code-corps/code-corps-api/issues).

And you can _always_ ask us for advice on where to start [in our Slack](http://slack.codecorps.org).

## Installing

[Follow this guide to get started.](https://github.com/code-corps/code-corps-api/blob/develop/docs/INSTALLING.md)

## Usage

Have everything installed and ready to work? Read [our usage guides](USAGE.md) to learn how to:

- [Run normal `mix` commands through Docker](USAGE.md#interacting-with-the-app)
- [Run `mix` commands](USAGE.md#interacting-with-the-app)
- [Stop and start the server](USAGE.md#stopping-and-starting-the-server)
- [Run tests](USAGE.md#running-tests)
- [Linting and Style Guidelines](USAGE.md#linting-code-with-credo)
- [Rebuild Docker containers](USAGE.md#rebuilding-docker-containers)
- [Linting and style guidelines](USAGE.md#linting-code-with-credo)
- [Work with the Ember front-end](USAGE.md#serving-ember)
- [Set up environment variables](USAGE.md#environment)
- [Push changes to GitHub](USAGE.md#pushing-changes)

## Documentation

We have several types of docs:

- Project documentation (README, CONTRIBUTING, etc.)
- [API documentation](http://docs.codecorpsapi.apiary.io/) written in [API Blueprint](https://apiblueprint.org/) format in [`blueprint/api.apib`](https://github.com/code-corps/code-corps-api/blob/develop/blueprint/api.apib) and published to the web when merging into `develop`
- API documentation ([`master`](http://docs.codecorpsapi.apiary.io/) | [`develop`](http://docs.codecorpsapidevelop.apiary.io/) | [local](docs/API.md)) written in [API Blueprint](https://apiblueprint.org/) format in [`blueprint/api.apib`](https://github.com/code-corps/code-corps-api/blob/develop/blueprint/api.apib) and published to the web when merging into `develop` or `master`
- [Inline documentation](https://code-corps.github.io/code-corps-api-github-pages) for the Elixir app generated by [`ex_doc`](https://github.com/elixir-lang/ex_doc) and published to GitHub pages when merging into `develop`

Want to improve the documentation? [Get started here.](https://github.com/code-corps/code-corps-api/blob/develop/.github/CONTRIBUTING.md#what-kind-of-documentation-are-you-writing)
Expand All @@ -68,4 +72,4 @@ We care about:
- Welcoming and teaching new contributors :wave:
- Writing small, clear, and achievable issues :dart:

We also track quantifiable metrics like inline documentation coverage, testing coverage, and so on. You can see some of these metrics in the icons at the top of this page.
We also track quantifiable metrics like inline documentation coverage, testing coverage, and so on. You can see some of these metrics in the badges at the top of this page.
35 changes: 13 additions & 22 deletions USAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,37 +3,32 @@
- [How do I interact with the app?](#interacting-with-the-app)
- [How do I stop and start the server?](#stopping-and-starting-the-server)
- [How do I run tests?](#running-tests)
- [How do I rebuild Docker containers?](#rebuilding-docker-containers)
- [How do I view the API docs?](#api-docs)
- [How do I lint the code?](#linting-code-with-credo)
- [How do I serve the front-end?](#serving-ember)
- [Do I need special environment variables?](#environment)
- [How do I push changes to GitHub?](#pushing-changes)

### Interacting with the app

You'll generally interact with the app using `docker-compose`. You can choose not to if you're contributing often enough to not need to worry about dependency management. But if you're short on time, Docker is probably the happier path to get up and running quickly.
You'll generally interact with the app using `mix` tasks. You can [read the Phoenix documentation here](http://www.phoenixframework.org/docs/mix-tasks).

Here are conversions of your typical Elixir project commands:
### Stopping and starting the server

- `iex -S mix phoenix.server``docker-compose run web iex -S mix phoenix.server`
- `mix run priv/repo/seeds.exs``docker-compose run web mix run priv/repo/seeds/.exs`
- `mix test``docker-compose run test mix test`
- and so on...
To start the server, run `mix phoenix.server`.

These follow the basic format of `my-command with arguments``docker-compose run TARGET_CONTAINER my-command with arguments`.
To stop the server, hit `Ctrl+C` twice.

### Stopping and starting the server
### Running tests

Need to stop the containers? Either `Ctrl+C` or in a separate prompt run `docker-compose stop`.
To run the tests you run `MIX_ENV=test mix test`.

To start the services again you can run `docker-compose up`, or `docker-compose start` to start the containers in a detached state.
### API docs

### Rebuilding Docker containers
You can [view the API documentation locally](docs/API.md) with the Apiary CLI.

If you ever need to rebuild you can run `docker-compose up --build`. Unless you've destroyed your Docker container images, this should be faster than the first run.
The production API's documentation (matching the latest `master` branch) can be found online at `http://docs.codecorpsapi.apiary.io/`.

### Running tests

To run the tests you can run `docker-compose run test mix test`.
The staging API's documentation (matching the latest `develop` branch) can be found online at `http://docs.codecorpsapidevelop.apiary.io/`.

### Linting Code with Credo

Expand All @@ -45,7 +40,7 @@ Credo's style guide is influenced by this more popular and exhaustive community

The Code Corps API is intended to work alongside a client written in Ember. For that purpose, the Elixir application exposes all of its API endpoints behind an `api.` subdomain.

For Ember to work with your now running API listening on `localhost:49235`, you simply need to run under `ember serve` at `localhost:4200` and everything should work under normal conditions.
For Ember to work with your now running API listening on `localhost:4000`, you simply need to run under `ember serve` at `localhost:4200` and everything should work under normal conditions.

### Environment

Expand Down Expand Up @@ -78,7 +73,3 @@ In your `.env` you should have a `STRIPE_SECRET_KEY` and `STRIPE_PLATFORM_CLIENT

- `STRIPE_SECRET_KEY` should be set to your "Test Secret Key" from the [API Keys section of your Stripe dashboard](https://dashboard.stripe.com/account/apikeys).
- `STRIPE_PLATFORM_CLIENT_ID` should be set to "Development `client_id`" key from the [Connect section of your Stripe dashboard](https://dashboard.stripe.com/account/applications/settings).

### Pushing changes

You can use `git` as you normally would, either on your own host machine or in Docker's `web` container.
58 changes: 0 additions & 58 deletions docker-compose.yml

This file was deleted.

31 changes: 9 additions & 22 deletions docs/API.md
Original file line number Diff line number Diff line change
@@ -1,40 +1,27 @@
# How to generate API documentation locally

You can generate documentation a few ways:
You can generate documentation a couple ways:

- [Apiary CLI](#apiary-cli) (recommended)
- [`aglio`](#aglio)
- [Apiary Client](#apiary-client) (recommended)
- [Atom](#atom)

### Apiary CLI
### Apiary Client

[Apiary CLI](https://help.apiary.io/tools/apiary-cli/) comes preloaded when you run `docker-compose up` like normal.
[Apiary Client](https://help.apiary.io/tools/apiary-cli/) needs Ruby to run.

Once Docker is running your containers, `apiary` runs an Apiary CLI server on port `8081`. You can visit the documentation by visiting `localhost:8081` in your browser. Just refresh the page any time you make changes to the documentation file at `/blueprint/api.apib`.

### aglio

Navigate into the `/blueprint` directory.

If installing for the first time, run:
You can install the Apiary Client by running:

```shell
docker-compose build
gem install apiaryio
```

Then start the `aglio` service with:
You can now run the server:

```shell
docker-compose up
```

Now you can generate the docs with our shell script:

```bash
./generate
apiary preview --path=blueprint/api.apib --server
```

You should be able to view the docs by opening the newly generated `index.html` in your browser.
This runs an Apiary CLI server on port `8080`. You can visit the documentation by visiting `localhost:8080` in your browser. Just refresh the page whenever you make changes to the documentation file at `/blueprint/api.apib`.

### Atom

Expand Down
Loading

0 comments on commit 329d0b2

Please sign in to comment.