Skip to content

Commit 0a4ff4f

Browse files
committed
updates documentation
Signed-off-by: Nell Shamrell <[email protected]>
1 parent ed3e843 commit 0a4ff4f

File tree

1 file changed

+108
-9
lines changed

1 file changed

+108
-9
lines changed

README.md

Lines changed: 108 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ development environment for Clearly Defined including:
77
* [crawler](https://github.com/clearlydefined/crawler)
88
* harvest store (mounted as a volume in the service container)
99
* definitions and curations mongo DB databases
10-
* queues
1110

1211
We do this through [Docker](https://www.docker.com/) and [Docker Compose](https://docs.docker.com/compose/)
1312

@@ -58,11 +57,18 @@ services:
5857
ports:
5958
- "4000:4000"
6059
env_file: .env
60+
volumes:
61+
- ./harvested_data:/tmp/harvested_data/
6162
links:
6263
- clearlydefined_mongo_db
64+
- crawler
6365
crawler:
64-
context: <path-to-crawler-repo-on-your-system>
66+
build:
67+
context: <path-to-crawler-repo-on-your-system>
68+
dockerfile: DevDockerfile
6569
env_file: .env
70+
volumes:
71+
- ./harvested_data:/tmp/harvested_data/
6672
ports:
6773
- "5000:5000"
6874
```
@@ -89,16 +95,13 @@ And add in appropriate values to the .env file:
8995

9096
(You can use the same GitHub token for both CURATION_GITHUB_TOKEN and CRAWLER_GITHUB_TOKEN)
9197

92-
9398
**.env**
9499
```
95100
# Curation GitHub Info
96-
CURATION_GITHUB_REPO="sample-curated-data"
97101
CURATION_GITHUB_BRANCH="master"
98102
CURATION_GITHUB_OWNER="clearlydefined"
99103
CURATION_GITHUB_REPO="curated-data-dev"
100-
CURATION_GITHUB_TOKEN="<Your GitHub Personal Access Token>
101-
104+
CURATION_GITHUB_TOKEN="<your GitHub token>"
102105
103106
# Curation Store Info
104107
CURATION_MONGO_CONNECTION_STRING="mongodb://clearlydefined_mongo_db"
@@ -123,7 +126,12 @@ HARVEST_STORE_PROVIDER="file"
123126
FILE_STORE_LOCATION="/tmp/harvested_data"
124127
125128
# Crawler Info
126-
CRAWLER_GITHUB_TOKEN="<Your GitHub Personal Access Token>"
129+
CRAWLER_API_URL="http://crawler:5000"
130+
CRAWLER_GITHUB_TOKEN="<your GitHub token>"
131+
CRAWLER_DEADLETTER_PROVIDER=cd(file)
132+
CRAWLER_NAME=cdcrawlerlocal
133+
CRAWLER_QUEUE_PROVIDER=memory
134+
CRAWLER_STORE_PROVIDER=cd(file)
127135
```
128136

129137
Now, from withing your **docker_dev_env_experiment** directory, run:
@@ -214,8 +222,99 @@ The database contains two collections:
214222

215223
The reason the definitions database is called definitions-paged is because, previously, the definitions collection was not paged. The pagination was added in [this January 2019 pull request](https://github.com/clearlydefined/service/pull/364). Our production Azure setup includes both definitions and definitions-paged collections - the definitions-paged collection is the one that is actively used. This development environment includes the definitions-paged collection in order to more closely mirror production.
216224

217-
These collections are seeded using the following container.
225+
These collections are seeded using the Clearly Defined Mongo Seed container.
226+
227+
If you have [mongodb](https://docs.mongodb.com/manual/installation/) installed on your local system, you can attach to the Mongo database with:
228+
229+
```bash
230+
$ mongo mongodb://localhost:27017
231+
```
232+
233+
You can also do this through the [Docker desktop client](https://www.docker.com/products/docker-desktop).
234+
218235

219236
### Clearly Defined Mongo Seed
220237

221-
This container exists only to seed initial data into the Clearly Defined Mongo DB. It populates both the collections and definitions-paged collections with sample data.
238+
This container exists only to seed initial data into the Clearly Defined Mongo DB. It populates both the collections and definitions-paged collections with sample data.
239+
240+
## Using
241+
242+
As noted above, you can start all of the containers with:
243+
244+
```bash
245+
$ docker-compose up
246+
```
247+
248+
This will show all of the logs from all of the container in your current shell.
249+
250+
### Rebuilding after changes
251+
252+
When you make changes to one of the code bases, you do need to rebuild the Docker images.
253+
254+
If you were to make a change to the website, and want to rebuild only that container, you can do so by running:
255+
256+
```bash
257+
$ docker-compose up --detach --build web
258+
```
259+
260+
The same will work for the service and the crawler:
261+
262+
```bash
263+
$ docker-compose up --detach --build service
264+
```
265+
266+
```bash
267+
$ docker-compose up --detach --build crawler
268+
```
269+
270+
### Stopping containers
271+
272+
You can stop and destroy the containers in the shell where you ran `docker-compose up` with CTRL c.
273+
274+
You can also do this through the [Docker desktop client](https://www.docker.com/products/docker-desktop) or through the [Docker CLI](https://docs.docker.com/engine/reference/commandline/cli/).
275+
276+
Note that in order to re-seed the database you must completely destroy the containers (this can also be done through both the Desktop client and the CLI).
277+
278+
### Attaching to a container
279+
280+
You can attach to a container either through using the [Docker desktop client](https://www.docker.com/products/docker-desktop) or the [Docker CLI](https://docs.docker.com/engine/reference/commandline/attach/).
281+
282+
### Running only certain containers
283+
284+
You can choose to run or not run any of the containers listed in [docker-compose.yml]. If you don't wish to run one of the containers, comment it out like this:
285+
286+
**docker-compose.yml**
287+
```bash
288+
version: "3.8"
289+
services:
290+
# web:
291+
# build:
292+
# context: <path-to-website-repo-on-your-system>
293+
# dockerfile: DevDockerfile
294+
# ports:
295+
# - "3000:3000"
296+
# stdin_open: true
297+
service:
298+
build:
299+
context: <path-to-service-repo-on-your-system>
300+
dockerfile: DevDockerfile
301+
ports:
302+
- "4000:4000"
303+
env_file: .env
304+
volumes:
305+
- ./harvested_data:/tmp/harvested_data/
306+
links:
307+
- clearlydefined_mongo_db
308+
- crawler
309+
crawler:
310+
build:
311+
context: <path-to-crawler-repo-on-your-system>
312+
dockerfile: DevDockerfile
313+
env_file: .env
314+
volumes:
315+
- ./harvested_data:/tmp/harvested_data/
316+
ports:
317+
- "5000:5000"
318+
```
319+
320+
If you run `docker-compose up` after making these changes to the file, it will start all containers except the web container.

0 commit comments

Comments
 (0)