-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
220 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
[run] | ||
omit = | ||
*/test/* | ||
|
||
[report] | ||
exclude_lines = | ||
pragma: no cover | ||
def __repr__ | ||
raise NotImplementedError |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
language: python | ||
python: | ||
- '3.6' | ||
env: | ||
#- TOXENV=py36 | ||
- TOXENV=flake8 | ||
- TOXENV=build | ||
install: | ||
- pip install tox | ||
script: tox | ||
services: | ||
- postgresql | ||
|
||
stages: | ||
- test | ||
- name: pypi | ||
if: tag IS present | ||
- name: docker | ||
if: tag IS present | ||
|
||
jobs: | ||
include: | ||
- stage: pypi | ||
script: 'echo "Deploying to PyPi"' | ||
deploy: | ||
provider: pypi | ||
user: rmb938 | ||
password: | ||
secure: fhdvEq81B9Fl9+gzqVRSNVOBn9Pw5eWGiOJhHp+3N4M7AOUGta35mu5K7BSgIZuwQ+pgWWdQOcrszNyEs9GFIibLiE3aTKhPOIxnR89bINAZLrvm5RfXik1kjOKhx0jCsrEtFfQAfw9hg8cr2I099BBrAoRYQJZrHIVLaO77uvj/rd583OTsLE6smRkjj89yqktuTmhtdh5XK8aFr+wXNFIKcAxq4uDh6L/X521uRSkwvRjlA05OI9/Pyv4B52yXPJK5+QhwrwY0EwdbmfIpI81IQhzfErYwh7cUPyFgExTZitbpEd2+JS8k9VSV709sfHzeglbEe2Z5wkEGCGEPV85IQMpicBV9Am8omOc87qp9pXTerrYS8HSYcXWZqma75sdHy22VTVyPz5hTXu8ssA3tA/QqsES78BJIWOLPdkd1/CyJCTX7fm2rGdwVITn7floGGmhh4DjdciuAHr3/hd+w3uB5D1c57voXGSGfy5tCc+LanItrfberz61oyr0FlOjSo6OCbE41UEYVrRYlRhV5dMXHC2qEk3M9uyJGkf3ZMQlir+/OsTDJD/GDdGz8r8Y2aQ7cLz6fgRvzw9yAuiGhDmWNiADNjJa+JYpjRDYt7xQLZtaeHH8GXQLqIV7BaN9nF0Rhe9beUYiMnDnx9PDRK2Qf0Y5stJy50cwFdGE= | ||
on: | ||
tags: true | ||
- stage: docker | ||
env: | ||
- secure: "1maT8WTEjmCMWLQQV/ZN9KI98TK5ISfCDI265jUuDdhXEHViDRB22AEjCqRRvds1VIWca3o0sivf8d2fAAI15+O2j6UtVg4fnKScycUWx8wbPB0nzCoFLhcRypoDv7Xb19njadAerKDLxMDFRZH2jbpjvANlwaDrb8bgt90lvBFg1lPRzqW5EU1QKe5MtMLBWx1cSiBKguvAsVDNGWyKXwL4cX52EFRQPryyaINDcgbvGUq5SFLRMUd4olE0HhmSsS21I+aZUmIOgJLhi1mwGc9cUYwlz9oSNAYxCK4p/gPem/SDJjNIy+6JmYr7eR3l8ZzOCN7Xso47QydEC+XFBFVwY3IRqQtzKf8DRlI14aV/CHLYc8H15Xlx8hp6Q8ycTGXq4g0FXUDyfTIS2XSYJWmN5tfjloIU0h8C/e3qX76i2lOuHH197T5pHNMhoTdOncDjj+5MqaAeTv5cPFrq5lrWjrZAvW9+PbMPPE+NzP3jyflHAiRYLFTullYW3099VoSkURUeDsMRDF8RxnccKlrmylP4KBqszURCf3Fkl0c4WsdOsQervrPoLkk6Zna3s3uDph36GOYJqs3m1i+eG0EwqrBtrlNO7wp31IS4/EbAuoRBn+TaXN0zaMlgUylorP4Ap5qdGRDyFg7/uMieOn5m3hbi303KAo9ScIlTgVs=" | ||
script: ./trigger_docker_build.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
FROM python:3-alpine | ||
WORKDIR /usr/src/app | ||
|
||
COPY . . | ||
RUN apk -U add git && python setup.py sdist bdist_wheel | ||
|
||
FROM python:3-alpine | ||
WORKDIR /usr/src/app | ||
|
||
# Install build time dependencies for uwsgi | ||
# Install dumb-init | ||
# Remove build time dependencies | ||
# Install runtime dependencies | ||
RUN apk --no-cache add --virtual build-deps \ | ||
build-base linux-headers pcre-dev postgresql-dev && \ | ||
pip install dumb-init psycopg2 && \ | ||
apk del build-deps && \ | ||
apk --no-cache add bash openssl pcre libpq ca-certificates | ||
|
||
# COPY tar.gz from build container | ||
# Install it | ||
# TODO: this should be replaced by a build arg to install the correct version from pypi | ||
COPY --from=0 /usr/src/app/dist/. . | ||
RUN bash -c "pip install *" | ||
|
||
# add entrypoint | ||
COPY docker-entrypoint.sh /bin/docker-entrypoint.sh | ||
|
||
ENTRYPOINT ["/bin/docker-entrypoint.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
deli-worker | ||
----------- | ||
|
||
.. image:: https://travis-ci.org/sandwichcloud/deli-worker.svg?branch=master | ||
:target: https://travis-ci.org/sandwichcloud/deli-worker | ||
|
||
.. image:: https://badge.fury.io/py/deli-worker.svg | ||
:target: https://badge.fury.io/py/deli-worker | ||
|
||
Worker for Sandwich Cloud |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import sys | ||
|
||
from ingredients_tasks.celary import Messaging, database | ||
|
||
|
||
def main(): | ||
messaging = Messaging('127.0.0.1', 5672, 'sandwich', 'hunter2', '/') | ||
messaging.connect() | ||
database.connect() | ||
# with database.session(): | ||
# pass | ||
messaging.app.main = 'deli_worker' | ||
sys.argv.extend(['worker', '-l', 'info', '-Ofair']) | ||
messaging.start(argv=None) | ||
|
||
|
||
if __name__ == '__main__': | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import os | ||
|
||
from dotenv import load_dotenv | ||
|
||
load_dotenv(os.path.join(os.getcwd(), '.env')) | ||
|
||
#################### | ||
# DATABASE # | ||
#################### | ||
|
||
DATABASE_DB = 'sandwich' | ||
DATABASE_PORT = '5432' | ||
DATABASE_POOL_SIZE = 20 | ||
|
||
if os.environ.get('CLI'): | ||
DATABASE_POOL_SIZE = -1 | ||
|
||
DATABASE_HOST = os.environ['DATABASE_HOST'] | ||
DATABASE_USERNAME = os.environ['DATABASE_USERNAME'] | ||
DATABASE_PASSWORD = os.environ['DATABASE_PASSWORD'] | ||
|
||
#################### | ||
# RABBITMQ # | ||
#################### | ||
|
||
RABBITMQ_VHOST = '/' | ||
RABBITMQ_PORT = 5672 | ||
RABBITMQ_HOST = os.environ['RABBITMQ_HOST'] | ||
RABBITMQ_USERNAME = os.environ['RABBITMQ_USERNAME'] | ||
RABBITMQ_PASSWORD = os.environ['RABBITMQ_PASSWORD'] | ||
|
||
#################### | ||
# VMWare # | ||
#################### | ||
|
||
VCENTER_HOST = os.environ['VCENTER_HOST'] | ||
VCENTER_PORT = os.environ['VCENTER_PORT'] | ||
VCENTER_USERNAME = os.environ['VCENTER_USERNAME'] | ||
VCENTER_PASSWORD = os.environ['VCENTER_PASSWORD'] | ||
|
||
VCENTER_IMAGES_FOLDER = 'images' | ||
VCENTER_INSTANCES_FOLDER = 'instances' | ||
|
||
VCENTER_CLUSTER = 'Management' | ||
VCENTER_DATASTORE = 'datastore2' | ||
|
||
#################### | ||
# DHCP # | ||
#################### | ||
|
||
DHCP_SERVER_IP = os.environ['DHCP_SERVER_IP'] | ||
DHCP_OMAPI_PORT = os.environ.get('DHCP_OMAPI_PORT', 7911) | ||
DHCP_KEY_NAME = os.environ.get('DHCP_KEY_NAME', None) | ||
DHCP_B64_KEY = os.environ.get('DHCP_B64_KEY', None) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/usr/bin/dumb-init /bin/bash | ||
|
||
export SETTINGS_MODULE=deli_worker.settings | ||
deli_worker $@ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ingredients.tasks==0.0.1 # MIT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
[metadata] | ||
name = deli-worker | ||
author = Ryan Belgrave | ||
author-email = [email protected] | ||
summary = Worker for Sandwich Cloud | ||
description-file = README.rst | ||
home-page = https://github.com/sandwichcloud/deli-worker | ||
license = MIT | ||
classifier = | ||
Development Status :: 3 - Alpha | ||
Intended Audience :: Developers | ||
License :: OSI Approved :: MIT License | ||
Operating System :: OS Independent | ||
Programming Language :: Python | ||
|
||
[files] | ||
packages = | ||
deli_worker | ||
|
||
[entry_points] | ||
console_scripts = | ||
deli_worker = deli_worker.main:main | ||
|
||
[pbr] | ||
skip_authors = 1 | ||
skip_changelog = 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from setuptools import setup | ||
|
||
setup( | ||
setup_requires=['pbr>=3.0.1', 'setuptools>=17.1'], | ||
pbr=True, | ||
) |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
[tox] | ||
envlist = flake8, build | ||
|
||
[testenv:flake8] | ||
commands = | ||
flake8 | ||
deps = | ||
flake8 | ||
|
||
;[testenv:py36] | ||
;commands = | ||
; py.test | ||
;deps = | ||
; -r{toxinidir}/test-requirements.txt | ||
|
||
[testenv:build] | ||
commands = | ||
python setup.py sdist bdist_wheel | ||
|
||
[flake8] | ||
exclude = .tox, .git, __pycache__, build, dist, *.egg-info, ./.cache, ./.eggs | ||
max-line-length = 120 | ||
|
||
[pytest] | ||
addopts = --tb=short -rwxs -v --cov=deli_worker --cov-report term-missing:skip-covered |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/usr/bin/env bash | ||
|
||
curl -H "Content-Type: application/json" -d "{\"source_type\": \"Tag\", \"source_name\": \"$TRAVIS_TAG\"}" -X POST "$DOCKER_HUB_TRIGGER" |