Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FROM python:3.7
LABEL maintainer "Jack Laxson <jack@getpizza.cat>"

RUN mkdir -p /usr/src/clearly /usr/share/cache/ && \
chmod 777 /usr/share/cache/

@fmartins fmartins Nov 2, 2019

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 777

  • We should run the clearly as a non-privileged user.


COPY Pipfile Pipfile.lock /usr/src/clearly/

ENV XDG_CACHE_HOME /usr/share/cache/

WORKDIR /usr/src/clearly/

RUN pip install pipenv==2018.10.13

COPY . /usr/src/clearly/

RUN pipenv sync -d

EXPOSE 12223

CMD ["pipenv", "run", "clearly"]
31 changes: 31 additions & 0 deletions Pipfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"

[packages]
about-time = "*"
celery = "*"
click = ">=7.0"
grpcio = "*"
protobuf = "*"
pytz = "*"
six = "==1.11.0"
Pygments = "*"
"clearly" = {editable = true, path = "."}
futures = {version = "*", markers = "python_version < '3.0'"}

[dev-packages]
mock = "*"
pytest = "*"
pathlib2 = {version = "*", markers = "python_version < '3.0'"}
funcsigs = {version ="*", markers = "python_version < '3.0'"}
scandir = {version ="*", markers = "python_version < '3.0'"}
pytest-cache = "*"
pytest-cov = "*"
pytest-sugar = "*"
pytest-watch = "*"
pytest-xdist = "*"

[requires]
python_version = "3.7"
423 changes: 423 additions & 0 deletions Pipfile.lock

Large diffs are not rendered by default.

26 changes: 25 additions & 1 deletion clearly/command_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,38 @@

logger = logging.getLogger('clearly.command_line')

CONTEXT_SETTINGS = dict(help_option_names=['-h', '--help'])

@click.group()

@click.group(context_settings=CONTEXT_SETTINGS)
@click.version_option()
def clearly():
"""Clearly command line tools."""
pass


@clearly.group(invoke_without_command=True)
@click.pass_context
@click.option("--port", '-p', default=12223)
@click.option("--host", default="localhost")
def client(ctx, host, port):
from clearly.client import ClearlyClient
cli = ClearlyClient(host=host, port=port)
ctx.obj = dict()
ctx.obj["client-cli"] = cli
if ctx.invoked_subcommand is None:
cli.capture()

@client.command()
@click.pass_context
def workers(ctx):
ctx.obj["client-cli"].workers()

@client.command()
@click.pass_context
def capture(ctx):
ctx.obj["client-cli"].capture()

@clearly.command()
@click.argument('broker')
@click.option('--backend', '-b',
Expand Down
4 changes: 4 additions & 0 deletions docker-compose.rabbit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
version: "3.0"
services:
rabbit:
image: rabbitmq
21 changes: 21 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
version: "3.0"

services:
clearly_client:
build:
context: .
image: jrabbit/clearly

command: pipenv run clearly client --host clearly_server
depends_on:
- clearly_server
volumes:
- ".:/srv/src/clearly"

clearly_server:
image: jrabbit/clearly
command: pipenv run clearly server amqp://rabbit/
ports:
- "12223:12223"
depends_on:
- rabbit
11 changes: 11 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[tox]
envlist = py27,py36,py37
skipsdist = true


[testenv]
deps = pipenv
passenv = HOME
commands =
pipenv sync -d
pipenv run pytest --cov=clearly --cov-branch --cov-report=term-missing -p no:sugar