Skip to content

Commit

Permalink
Initial Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergiodfdez committed Feb 16, 2018
0 parents commit e9bb0c3
Show file tree
Hide file tree
Showing 83 changed files with 3,806 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[run]
branch = True

[report]
# Regexes for lines to exclude from consideration
exclude_lines =
# Have to re-enable the standard pragma
pragma: no cover

# Don't complain about missing debug-only code:
def __repr__
if self\.debug

# Don't complain if tests don't hit defensive assertion code:
raise AssertionError
raise NotImplementedError

# Don't complain if non-runnable code isn't run:
if 0:
if __name__ == .__main__.:

ignore_errors = True
20 changes: 20 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# http://editorconfig.org

root = true

[*]
indent_style = space
indent_size = 4
trim_trailing_whitespace = true
insert_final_newline = true
charset = utf-8
end_of_line = lf

# Docstrings and comments use max_line_length = 79
[*.py]
max_line_length = 119

# Makefiles always use tabs for indentation
[Makefile]
indent_style = tab
indent_size = 8
54 changes: 54 additions & 0 deletions .env.gen
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#!/usr/bin/env bash

show_help () {
cat <<-HELP
usage: ${0##*/} [options] filename required_vars
options:
-h, --help Show this document
params:
filename The file name to be written
required_vars The file that list the variables checked and/or created
HELP
exit 1
}


create_file () {
[ ! -f $filename ] && touch $filename
# INFO: It needs to read in first place the file so we need to redirect the stdin to /dev/fd/3 for user input
{ cat $required_vars | while IFS= read line; do
# INFO: ${VAR%%PATTERN} removes from the end, so you can list required variables with help texts
varname=${line%% *}
if [[ ! -e "${varname}" ]] && ! grep "^${varname}" $filename; then
cat <<-hint >&2
please set $line:
hint
read -u 3 question
echo "${varname}=${question}" >> $filename
echo >&2
fi
done } 3<&0
exit 0
}

# Parse args
while [[ $# -gt 0 ]]; do
case "$1" in
-h|--help)
show_help
;;

*)
[ "${1##-*}" != "" ] && filename="$1" && \
[ "${2##-*}" != "" ] && [ -f $2 ] && required_vars="$2" \
&& shift && shift
;;
esac
shift
done

[[ -n ${required_vars} && -n ${filename} ]] && create_file

show_help
7 changes: 7 additions & 0 deletions .env.required
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
BROKER_URI (example: redis://localhost:6379)
DATABASE_URI (example: postgresql://postgres:postgres@localhost:5433/deeptracy)
SHARED_VOLUME_PATH (example: /tmp/deeptracy)
PLUGINS_LOCATION (example: /opt/deeptracy/plugins)
LOCAL_PRIVATE_KEY_FILE (example: /root/.ssh/id_rsa)
LOG_LEVEL (example: DEBUG)
PATTON_URI (example: http://localhost:8000)
150 changes: 150 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@

# Created by https://www.gitignore.io/api/python,pycharm

### IntelliJ ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
.idea/

# CMake
cmake-build-debug/

## File-based project format:
*.iws

## Plugin-specific files:

# IntelliJ
/out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

### PyCharm Patch ###
# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721

# *.iml
# modules.xml
# *.ipr

### Python ###
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
coverage-reports/
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*,cover
.hypothesis/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# pyenv
.python-version

# celery beat schedule file
celerybeat-schedule

# SageMath parsed files
*.sage.py

# dotenv
.env*
!.env.gen
!.env.required

# virtualenv
.venv
venv/
ENV/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# End of https://www.gitignore.io/api/python,pycharm

# terraform
.terraform
*.tfstate*

# ignore private key used in local testing and keys to deploy
id_rsa
*.pem
42 changes: 42 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
language: python

services: docker

python:
- "3.6"

install:
- pip install tox
- pip install -r requirements_test.txt

env:
global:
- BROKER_URI=redis://127.0.0.1:6379
- DATABASE_URI=postgresql://postgres:postgres@127.0.0.1:5433/deeptracy
- SHARED_VOLUME_PATH=/tmp/deeptracy
- PATTON_URI=http://127.0.0.1:8000
- POSTGRES_URI=postgresql://postgres:postgres@postgres:5433

script:
- pip install -r requirements_test.txt
- tox
- docker-compose --version
- docker-compose -f tests/acceptance/docker-compose.yml up -d --build
- sleep 10
- behave --tags=-local tests/acceptance/features
- docker-compose -f tests/acceptance/docker-compose.yml kill
- docker-compose -f tests/acceptance/docker-compose.yml rm -f

deploy:

# release plugins images to DockerHub
- provider: script
script: release/plugins_images_dockerhub.sh
on:
branch: master

# release image to DockerHub
- provider: script
script: release/image_dockerhub.sh
on:
branch: master
29 changes: 29 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Contributing

Want to hack on deeptracy Director? Awesome! Here are instructions to get you
started. They are probably not perfect, please let us know if anything
feels wrong or incomplete.

In general, we follow the "fork-and-pull" Git workflow.

1. **Fork** this repo
2. **Clone** the project to your own machine
3. **Commit** changes to your own branch
4. **Push** your work back up to your fork
5. Submit a **Pull request** so that we can review your changes

NOTE: Be sure to merge the latest from "upstream" before making a pull request!

If your pull request is not accepted on the first try, don't be
discouraged! If there's a problem with the implementation, hopefully you
received feedback on what to improve.

Submit unit tests for your changes. Python has a great test framework built
in; use it! Take a look at existing tests for inspiration. Run the full
test suite on your branch before submitting a pull request.

Make sure you include relevant updates or additions to documentation
when creating or modifying features.

## Before Pull Request
Please, run tox :)
32 changes: 32 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
FROM python:3.6

# install docker
RUN curl -sSL https://get.docker.com/ | /bin/bash

RUN mkdir /tmp/install
WORKDIR /tmp/install

# add dependencies
ADD requirements* /tmp/install/
RUN pip install -r /tmp/install/requirements.txt

# add sources
ADD deeptracy /tmp/install/deeptracy
ADD README.rst /tmp/install
ADD MANIFEST.in /tmp/install
ADD setup.py /tmp/install

# install sources and romove them
RUN pip install -U .
RUN rm -rf /tmp/install

# add run script
RUN mkdir /opt/deeptracy
WORKDIR /opt/deeptracy
ADD wait-for-it.sh /opt/deeptracy
ADD create_patton_db.py /opt/deeptracy
ADD init_patton_db.sh /opt/deeptracy
ADD run.sh /opt/deeptracy
RUN chmod +x /opt/deeptracy/run.sh

CMD ["/opt/deeptracy/run.sh"]

0 comments on commit e9bb0c3

Please sign in to comment.