|
1 | 1 | # docker_dev_env_experiment
|
2 | 2 |
|
3 |
| -## Current State |
4 |
| -This Docker compose file currently spins up two services in Docker containers: |
5 |
| -* Clearly Defined Website |
6 |
| -* Clearly Defined Service |
7 |
| - |
8 |
| -### Pre-req |
9 |
| -* Local copy of Clearly Defined Website repo with `nell/dev-docker-file` branch checked out |
10 |
| -* Local copy of Clearly Defined Service repo with `nell/dev-docker-file` branch checked out |
11 |
| - |
12 |
| -## Future State |
13 |
| -* Clearly Defined Crawler Container |
14 |
| -* Harvested Data Container that contains sample harvested data |
15 |
| -* Curated Data Container that contains sample curated data |
| 3 | +Hello everyone! The purpose of this repo is to give you an easy way to run a full |
| 4 | +development environment for Clearly Defined including: |
| 5 | +* [website](https://github.com/clearlydefined/website) |
| 6 | +* [service](https://github.com/clearlydefined/service) |
| 7 | +* [crawler](https://github.com/clearlydefined/crawler) |
| 8 | +* definitions and curations mongo DB databases |
| 9 | +* queues |
| 10 | + |
| 11 | +We do this through running the various services in Docker. |
| 12 | + |
| 13 | +We do this through [Docker](https://www.docker.com/) and [Docker Compose](https://docs.docker.com/compose/) |
| 14 | + |
| 15 | +## Pre-reqs |
| 16 | +To run this environment, you need to install |
| 17 | +* [Docker](https://www.docker.com/) |
| 18 | +* [Docker Compose](https://docs.docker.com/compose/) |
| 19 | + |
| 20 | +## Getting Started |
| 21 | + |
| 22 | +Start off by cloning this repository. |
| 23 | + |
| 24 | +```bash |
| 25 | +$ git clone https://github.com/clearlydefined/docker_dev_env_experiment |
| 26 | +``` |
| 27 | + |
| 28 | +Change into that directory: |
| 29 | + |
| 30 | +```bash |
| 31 | +$ cd docker_dev_env_experiment |
| 32 | +``` |
| 33 | + |
| 34 | +I prefer to clone my copies of the ClearlyDefined repos into this directory as well |
| 35 | + |
| 36 | +```bash |
| 37 | +$ git clone https://github.com/clearlydefined/website |
| 38 | +$ git clone https://github.com/clearlydefined/service |
| 39 | +$ git clone https://github.com/clearlydefined/crawler |
| 40 | +``` |
| 41 | + |
| 42 | +Alternately, you can edit the **docker-compose.yml** file to point to where you have those repos cloned on your local system: |
| 43 | + |
| 44 | +**docker-compose.yml** |
| 45 | +```bash |
| 46 | +version: "3.8" |
| 47 | +services: |
| 48 | + web: |
| 49 | + build: |
| 50 | + context: <path-to-website-repo-on-your-system> |
| 51 | + dockerfile: DevDockerfile |
| 52 | + ports: |
| 53 | + - "3000:3000" |
| 54 | + stdin_open: true |
| 55 | + service: |
| 56 | + build: |
| 57 | + context: <path-to-service-repo-on-your-system> |
| 58 | + dockerfile: DevDockerfile |
| 59 | + ports: |
| 60 | + - "4000:4000" |
| 61 | + env_file: .env |
| 62 | + links: |
| 63 | + - clearlydefined_mongo_db |
| 64 | + crawler: |
| 65 | + context: <path-to-crawler-repo-on-your-system> |
| 66 | + env_file: .env |
| 67 | + ports: |
| 68 | + - "5000:5000" |
| 69 | +``` |
| 70 | + |
| 71 | +**NOTE**: |
| 72 | +While this is still in development, you need to check out the `nell/dev-docker-file` branch for each of the |
| 73 | +three repos. |
| 74 | + |
| 75 | +### Setting up environmental variables |
| 76 | + |
| 77 | +This environment handles environmental variables a little differently from the [historical Clearly Defined dev environment instructions](https://docs.clearlydefined.io/contributing-code). |
| 78 | + |
| 79 | +The docker-compose.yml file loads environmental variables from a **.env** file. |
| 80 | + |
| 81 | +To set this up, copy the **sample_env** file in this repo to **.env** |
| 82 | + |
| 83 | +```bash |
| 84 | +$ cp sample_env .env |
| 85 | +``` |
| 86 | + |
| 87 | +And add in appropriate values to the .env file: |
| 88 | + |
| 89 | +(You will need a [GitHub token](https://docs.github.com/en/free-pro-team@latest/github/authenticating-to-github/creating-a-personal-access-token) with minimal permissions) |
| 90 | + |
| 91 | +(You can use the same GitHub token for both CURATION_GITHUB_TOKEN and CRAWLER_GITHUB_TOKEN) |
| 92 | + |
| 93 | + |
| 94 | +**.env** |
| 95 | +``` |
| 96 | +# Curation GitHub Info |
| 97 | +CURATION_GITHUB_REPO="sample-curated-data" |
| 98 | +CURATION_GITHUB_BRANCH="master" |
| 99 | +CURATION_GITHUB_OWNER="clearlydefined" |
| 100 | +CURATION_GITHUB_REPO="curated-data-dev" |
| 101 | +CURATION_GITHUB_TOKEN="<Your GitHub Personal Access Token> |
| 102 | +
|
| 103 | +DEFINITION_STORE_PROVIDER="mongo" |
| 104 | +DEFINITION_MONGO_CONNECTION_STRING="mongodb://clearlydefined_mongo_db" |
| 105 | +DEFINITION_MONGO_DB_NAME="clearlydefined" |
| 106 | +DEFINITION_MONGO_COLLECTION_NAME="definitions-paged" |
| 107 | +
|
| 108 | +CRAWLER_GITHUB_TOKEN="<Your GitHub Personal Access Token>" |
| 109 | +``` |
| 110 | + |
| 111 | +Now, from withing your **docker_dev_env_experiment** directory, run: |
| 112 | + |
| 113 | +```bash |
| 114 | +$ docker-compose build |
| 115 | +$ docker-compose up |
| 116 | +``` |
| 117 | + |
| 118 | +And head to http://localhost:3000 to see your running website UI along with some seeded data! |
| 119 | + |
| 120 | +You can also query the service API with: |
| 121 | + |
| 122 | +```bash |
| 123 | +curl http://localhost:4000 |
| 124 | +``` |
| 125 | + |
| 126 | +## What You're Running |
| 127 | + |
| 128 | +Now, let's go through what your are running, container by container. |
0 commit comments