Skip to content

Commit

Permalink
Update docker-compose.yml template location and adapt package and scr…
Browse files Browse the repository at this point in the history
…apemeagain-compose.py accordingly
  • Loading branch information
DusanMadar committed Feb 17, 2019
1 parent 2bb6a5e commit 666de08
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
3 changes: 3 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
include requirements.txt
include scrapemeagain/dockerized/entrypoints/*.sh
include scrapemeagain/dockerized/docker-compose.yml
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ python3 examples/examplescraper/main.py
To simplify running integration tests with latest changes:

* replace `image: dusanmadar/scrapemeagain:x.y.z` with `image: scp:latest`
in the `docker-compose.yml` template
in the `scrapemeagain/dockerized/docker-compose.yml` template

* and make sure to rebuild the image locally before running tests, e.g.
```
Expand Down
File renamed without changes.
12 changes: 9 additions & 3 deletions scripts/scrapemeagain-compose.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@
Example:
$ cd ../
$ python3 scrapemeagain-compose.py -s $(pwd)/examples/examplescraper | docker-compose -f - up
$ python3 scrapemeagain-compose.py -s $(pwd)/examples/examplescraper -c tests.integration.fake_config | docker-compose -f - up
$ python3 scripts/scrapemeagain-compose.py -s $(pwd)/examples/examplescraper | docker-compose -f - up
$ python3 scripts/scrapemeagain-compose.py -s $(pwd)/examples/examplescraper -c tests.integration.fake_config | docker-compose -f - up
""" # noqa


import argparse
import inspect
import os
import sys

Expand Down Expand Up @@ -72,7 +73,12 @@ def construct_compose_file(path, config=None):
for id in range(1, Config.SCRAPERS_COUNT + 1)
]

template_dir = os.path.dirname(os.path.dirname(__file__))
# A dynamic way to get the path of `scrapemeagain.dockerized` package.
# Required because this file must be runnable both during development and
# anfter installing the package.
# Credists: https://stackoverflow.com/q/2419416/4183498.
dockerized_utils_module_path = inspect.getsourcefile(apply_scraper_config)
template_dir = os.path.dirname(dockerized_utils_module_path)
with open(os.path.join(template_dir, "docker-compose.yml")) as f:
template = Template(f.read())

Expand Down

0 comments on commit 666de08

Please sign in to comment.