Make tracker/worker/producer installable

This commit is contained in:
Christian Berendt 2015-02-15 17:48:58 +01:00
parent 732bfe97d5
commit 8eb0347f80
15 changed files with 128 additions and 22 deletions

6
.gitignore vendored
View File

@ -1,3 +1,9 @@
.tox
.vagrant
*.pyc
.venv
*.egg-info
*.egg
.eggs
.*.swp
build

View File

@ -39,15 +39,15 @@ The installation of Vagrant is described at https://docs.vagrantup.com/v2/instal
$ vagrant up
Login with :code:`vagrant ssh`, change into the directory :code:`/home/vagrant/src` and
Login with :code:`vagrant ssh`, change into the directory :code:`/vagrant` and
open a new screen or tmux session. Aftwards run the worker, producer, and
tracker services in the foreground, each service in a separate window.
.. code::
$ python worker.py
$ python tracker.py
$ python producer.py
$ python openstack_application_tutorial/worker.py
$ python openstack_application_tutorial/tracker.py
$ python openstack_application_tutorial/producer.py
RabbitMQ server
~~~~~~~~~~~~~~~

2
Vagrantfile vendored
View File

@ -17,8 +17,6 @@ BOX = "ubuntu/trusty64"
Vagrant.configure(2) do |config|
config.vm.box = BOX
config.vm.synced_folder '.', '/vagrant', disabled: true
config.vm.synced_folder 'src', '/home/vagrant/src'
config.vm.network "forwarded_port", guest: 15672, host: 15672
config.vm.provider "virtualbox" do |vb|
vb.customize ["modifyvm", :id, "--memory", "2048"]

View File

@ -3,8 +3,20 @@
tasks:
- apt: update-cache=yes upgrade=yes
- apt: name=rabbitmq-server state=latest
- apt: name=python-pillow state=latest
- apt: name={{ item }} state=latest
with_items:
- expect
- git
- ibmysqlclient-dev
- mysql-client
- mysql-server
- python-dev
- python-kombu
- python-mysqldb
- python-pillow
- python-sqlalchemy
- python-virtualenv
- rabbitmq-server
- service: name=rabbitmq-server state=started enabled=yes
- rabbitmq_user: user=guest
password=secretsecret
@ -16,12 +28,6 @@
write_priv=.*
state=present
- rabbitmq_plugin: names=rabbitmq_management state=enabled
- apt: name=python-kombu state=latest
- apt: name=mysql-server state=present
- apt: name=mysql-client state=present
- apt: name=python-mysqldb state=present
- apt: name=python-sqlalchemy state=present
- apt: name=expect state=present
- copy: src=files/my.cnf dest=/etc/my.cnf
- service: name=mysql state=restarted enabled=yes
- copy: src=files/mysql_secure_installation.sh

View File

@ -0,0 +1,17 @@
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import pbr.version
name = 'openstack-application-tutorial'
__version__ = pbr.version.VersionInfo(name).version_string()

View File

@ -24,8 +24,8 @@ from kombu.pools import producers
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
import models
import queues
from openstack_application_tutorial import models
from openstack_application_tutorial import queues
def initialize_logging():

View File

@ -23,8 +23,8 @@ from kombu.mixins import ConsumerMixin
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
import models
import queues
from openstack_application_tutorial import models
from openstack_application_tutorial import queues
class Tracker(ConsumerMixin):

View File

@ -27,7 +27,7 @@ import kombu
from kombu.mixins import ConsumerMixin
from kombu.pools import producers
import queues
from openstack_application_tutorial import queues
class JuliaSet(object):

8
requirements.txt Normal file
View File

@ -0,0 +1,8 @@
pbr>=0.6,!=0.7,<1.0
anyjson
amqp
argparse
kombu
mysql
pillow
sqlalchemy

42
setup.cfg Normal file
View File

@ -0,0 +1,42 @@
[metadata]
name = openstack-application-tutorial
summary = OpenStack Application Tutorial
description-file =
README.rst
author = Christian Berendt
author-email = christian@berendt.io
home-page = https://www.berendt.io
classifier =
Environment :: OpenStack
Intended Audience :: Information Technology
Intended Audience :: System Administrators
License :: OSI Approved :: Apache Software License
Operating System :: POSIX :: Linux
Programming Language :: Python
Programming Language :: Python :: 2
Programming Language :: Python :: 2.7
Programming Language :: Python :: 2.6
[files]
packages = openstack_application_tutorial
[global]
setup-hooks =
pbr.hooks.setup_hook
[entry_points]
console_scripts =
oat-producer = openstack_application_tutorial.producer:main
oat-tracker = openstack_application_tutorial.tracker:main
oat-worker = openstack_application_tutorial.worker:main
#[build_sphinx]
#source-dir = doc/source
#build-dir = doc/build
#all_files = 1
#[upload_sphinx]
#upload-dir = doc/build/html
[wheel]
universal = 1

29
setup.py Normal file
View File

@ -0,0 +1,29 @@
#!/usr/bin/env python
# Copyright (c) 2013 Hewlett-Packard Development Company, L.P.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import setuptools
# In python < 2.7.4, a lazy loading of package `pbr` will break
# setuptools if some other modules registered functions in `atexit`.
# solution from: http://bugs.python.org/issue15881#msg170215
try:
import multiprocessing # noqa
except ImportError:
pass
setuptools.setup(
setup_requires=['pbr'],
pbr=True)

View File

@ -1,2 +1 @@
hacking
pbr>=0.6,!=0.7,<1.0

View File

@ -1,11 +1,12 @@
[tox]
minversion = 1.6
#envlist = lint
envlist = lint
skipsdist = True
[testenv]
usedevelop = False
usedevelop = True
deps = -r{toxinidir}/test-requirements.txt
-r{toxinidir}/requirements.txt
install_command = pip install {opts} {packages}
[testenv:venv]