Make tracker/worker/producer installable
This commit is contained in:
parent
732bfe97d5
commit
8eb0347f80
|
@ -1,3 +1,9 @@
|
||||||
.tox
|
.tox
|
||||||
.vagrant
|
.vagrant
|
||||||
*.pyc
|
*.pyc
|
||||||
|
.venv
|
||||||
|
*.egg-info
|
||||||
|
*.egg
|
||||||
|
.eggs
|
||||||
|
.*.swp
|
||||||
|
build
|
||||||
|
|
|
@ -39,15 +39,15 @@ The installation of Vagrant is described at https://docs.vagrantup.com/v2/instal
|
||||||
|
|
||||||
$ vagrant up
|
$ 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
|
open a new screen or tmux session. Aftwards run the worker, producer, and
|
||||||
tracker services in the foreground, each service in a separate window.
|
tracker services in the foreground, each service in a separate window.
|
||||||
|
|
||||||
.. code::
|
.. code::
|
||||||
|
|
||||||
$ python worker.py
|
$ python openstack_application_tutorial/worker.py
|
||||||
$ python tracker.py
|
$ python openstack_application_tutorial/tracker.py
|
||||||
$ python producer.py
|
$ python openstack_application_tutorial/producer.py
|
||||||
|
|
||||||
RabbitMQ server
|
RabbitMQ server
|
||||||
~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~
|
||||||
|
|
|
@ -17,8 +17,6 @@ BOX = "ubuntu/trusty64"
|
||||||
|
|
||||||
Vagrant.configure(2) do |config|
|
Vagrant.configure(2) do |config|
|
||||||
config.vm.box = BOX
|
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.network "forwarded_port", guest: 15672, host: 15672
|
||||||
config.vm.provider "virtualbox" do |vb|
|
config.vm.provider "virtualbox" do |vb|
|
||||||
vb.customize ["modifyvm", :id, "--memory", "2048"]
|
vb.customize ["modifyvm", :id, "--memory", "2048"]
|
||||||
|
|
|
@ -3,8 +3,20 @@
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
- apt: update-cache=yes upgrade=yes
|
- apt: update-cache=yes upgrade=yes
|
||||||
- apt: name=rabbitmq-server state=latest
|
- apt: name={{ item }} state=latest
|
||||||
- apt: name=python-pillow 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
|
- service: name=rabbitmq-server state=started enabled=yes
|
||||||
- rabbitmq_user: user=guest
|
- rabbitmq_user: user=guest
|
||||||
password=secretsecret
|
password=secretsecret
|
||||||
|
@ -16,12 +28,6 @@
|
||||||
write_priv=.*
|
write_priv=.*
|
||||||
state=present
|
state=present
|
||||||
- rabbitmq_plugin: names=rabbitmq_management state=enabled
|
- 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
|
- copy: src=files/my.cnf dest=/etc/my.cnf
|
||||||
- service: name=mysql state=restarted enabled=yes
|
- service: name=mysql state=restarted enabled=yes
|
||||||
- copy: src=files/mysql_secure_installation.sh
|
- copy: src=files/mysql_secure_installation.sh
|
||||||
|
|
|
@ -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()
|
|
@ -24,8 +24,8 @@ from kombu.pools import producers
|
||||||
from sqlalchemy import create_engine
|
from sqlalchemy import create_engine
|
||||||
from sqlalchemy.orm import sessionmaker
|
from sqlalchemy.orm import sessionmaker
|
||||||
|
|
||||||
import models
|
from openstack_application_tutorial import models
|
||||||
import queues
|
from openstack_application_tutorial import queues
|
||||||
|
|
||||||
|
|
||||||
def initialize_logging():
|
def initialize_logging():
|
|
@ -23,8 +23,8 @@ from kombu.mixins import ConsumerMixin
|
||||||
from sqlalchemy import create_engine
|
from sqlalchemy import create_engine
|
||||||
from sqlalchemy.orm import sessionmaker
|
from sqlalchemy.orm import sessionmaker
|
||||||
|
|
||||||
import models
|
from openstack_application_tutorial import models
|
||||||
import queues
|
from openstack_application_tutorial import queues
|
||||||
|
|
||||||
|
|
||||||
class Tracker(ConsumerMixin):
|
class Tracker(ConsumerMixin):
|
|
@ -27,7 +27,7 @@ import kombu
|
||||||
from kombu.mixins import ConsumerMixin
|
from kombu.mixins import ConsumerMixin
|
||||||
from kombu.pools import producers
|
from kombu.pools import producers
|
||||||
|
|
||||||
import queues
|
from openstack_application_tutorial import queues
|
||||||
|
|
||||||
|
|
||||||
class JuliaSet(object):
|
class JuliaSet(object):
|
|
@ -0,0 +1,8 @@
|
||||||
|
pbr>=0.6,!=0.7,<1.0
|
||||||
|
anyjson
|
||||||
|
amqp
|
||||||
|
argparse
|
||||||
|
kombu
|
||||||
|
mysql
|
||||||
|
pillow
|
||||||
|
sqlalchemy
|
|
@ -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
|
|
@ -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)
|
|
@ -1,2 +1 @@
|
||||||
hacking
|
hacking
|
||||||
pbr>=0.6,!=0.7,<1.0
|
|
||||||
|
|
5
tox.ini
5
tox.ini
|
@ -1,11 +1,12 @@
|
||||||
[tox]
|
[tox]
|
||||||
minversion = 1.6
|
minversion = 1.6
|
||||||
#envlist = lint
|
envlist = lint
|
||||||
skipsdist = True
|
skipsdist = True
|
||||||
|
|
||||||
[testenv]
|
[testenv]
|
||||||
usedevelop = False
|
usedevelop = True
|
||||||
deps = -r{toxinidir}/test-requirements.txt
|
deps = -r{toxinidir}/test-requirements.txt
|
||||||
|
-r{toxinidir}/requirements.txt
|
||||||
install_command = pip install {opts} {packages}
|
install_command = pip install {opts} {packages}
|
||||||
|
|
||||||
[testenv:venv]
|
[testenv:venv]
|
||||||
|
|
Loading…
Reference in New Issue