Skip to content

Commit eefcdc5

Browse files
authored
Merge pull request #41 from clowder-framework/quickstart_example
Added quickstart example with new, isolated, Dockerfile
2 parents 98c1fea + 4a37418 commit eefcdc5

File tree

4 files changed

+39
-9
lines changed

4 files changed

+39
-9
lines changed

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,16 @@ git clone https://github.com/clowder-framework/pyclowder.git
2525
cd pyclowder
2626
pip install -r requirements.txt
2727
python setup.py install
28-
2928
```
3029
or directly from GitHub:
3130
```
3231
pip install -r https://raw.githubusercontent.com/clowder-framework/pyclowder/master/requirements.txt git+https://github.com/clowder-framework/pyclowder.git
3332
```
3433

34+
## Quickstart example
35+
36+
See the [README](https://github.com/clowder-framework/pyclowder/tree/master/sample-extractors/wordcount#readme) in `sample-extractors/wordcount`. Using Docker, no install is required.
37+
3538
## Example Extractor
3639

3740
Following is an example of the WordCount extractor. This example will allow the user to specify from the command line
Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
ARG PYCLOWDER_PYTHON=""
2-
FROM clowder/pyclowder${PYCLOWDER_PYTHON}:onbuild
1+
FROM python:3.8
32

4-
ENV MAIN_SCRIPT="wordcount.py"
3+
WORKDIR /extractor
4+
COPY requirements.txt ./
5+
RUN pip install -r requirements.txt
6+
7+
COPY wordcount.py extractor_info.json ./
8+
CMD python wordcount.py

sample-extractors/wordcount/README.md

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,42 @@ A simple extractor that counts the number of characters, words and lines in a te
22

33
# Docker
44

5-
This extractor is ready to be run as a docker container. To build the docker container run:
5+
This extractor is ready to be run as a docker container, the only dependency is a running Clowder instance. Simply build and run.
6+
7+
1. Start Clowder. For help starting Clowder, see our [getting started guide](https://github.com/clowder-framework/clowder/blob/develop/doc/src/sphinx/userguide/installing_clowder.rst).
8+
9+
2. First build the extractor Docker container:
610

711
```
12+
# from this directory, run:
13+
814
docker build -t clowder_wordcount .
915
```
1016

11-
To run the docker containers use:
17+
3. Finally run the extractor:
1218

1319
```
14-
docker run -t -i --rm -e "RABBITMQ_URI=amqp://rabbitmqserver/clowder" clowder_wordcount
15-
docker run -t -i --rm --link clowder_rabbitmq_1:rabbitmq clowder_wordcount
20+
docker run -t -i --rm --net clowder_clowder -e "RABBITMQ_URI=amqp://guest:guest@rabbitmq:5672/%2f" --name "wordcount" clowder_wordcount
1621
```
1722

18-
The RABBITMQ_URI and RABBITMQ_EXCHANGE environment variables can be used to control what RabbitMQ server and exchange it will bind itself to, you can also use the --link option to link the extractor to a RabbitMQ container.
23+
Then open the Clowder web app and run the wordcount extractor on a .txt file (or similar)! Done.
24+
25+
### Python and Docker details
26+
27+
You may use any version of Python 3. Simply edit the first line of the `Dockerfile`, by default it uses `FROM python:3.8`.
28+
29+
Docker flags:
30+
31+
- `--net` links the extractor to the Clowder Docker network (run `docker network ls` to identify your own.)
32+
- `-e RABBITMQ_URI=` sets the environment variables can be used to control what RabbitMQ server and exchange it will bind itself to. Setting the `RABBITMQ_EXCHANGE` may also help.
33+
- You can also use `--link` to link the extractor to a RabbitMQ container.
34+
- `--name` assigns the container a name visible in Docker Desktop.
35+
36+
## Troubleshooting
37+
38+
**If you run into _any_ trouble**, please reach out on our Clowder Slack in the [#pyclowder channel](https://clowder-software.slack.com/archives/CNC2UVBCP).
39+
40+
Alternate methods of running extractors are below.
1941

2042
# Commandline Execution
2143

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pyclowder==2.4.0

0 commit comments

Comments
 (0)