diff --git a/.gitignore b/.gitignore index 35addd13a3..640eb65128 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,7 @@ env/* build dist htmlcov +rpm-build *.egg-info *.py[c,o] *.swp diff --git a/MANIFEST.in b/MANIFEST.in index eee47c42c8..8b3ed8aaf7 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -4,6 +4,7 @@ recursive-include ansibleworks/templates *.html recursive-include ansibleworks/ui *.html *.js recursive-include ansibleworks/ui/static *.css *.ico *.png *.gif *.jpg recursive-include ansibleworks/ui/static *.eot *.svg *.ttf *.woff *.otf +recursive-include config * recursive-exclude ansibleworks/settings local_settings.py include *.py *.txt *.md include MANIFEST.in diff --git a/Makefile b/Makefile index 1a689ddeac..d264fe9aab 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,9 @@ -RELEASE = ansibleworks-1.2b2 +PYTHON=python +SITELIB=$(shell $(PYTHON) -c "from distutils.sysconfig import get_python_lib; print get_python_lib()") +RELEASE=ansibleworks-1.2b2 clean: - rm -rf build *.egg-info + rm -rf build rpm-build *.egg-info find . -type f -regex ".*\.py[co]$$" -delete rebase: @@ -93,3 +95,19 @@ release_ball: clean release_clean: -(rm *.tar) -(rm -rf ($RELEASE)) + +sdist: clean + $(PYTHON) setup.py release_build + +rpm: sdist + @mkdir -p rpm-build + @cp dist/*.gz rpm-build/ + @rpmbuild --define "_topdir %(pwd)/rpm-build" \ + --define "_builddir %{_topdir}" \ + --define "_rpmdir %{_topdir}" \ + --define "_srcrpmdir %{_topdir}" \ + --define "_specdir %{_topdir}" \ + --define '_rpmfilename %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm' \ + --define "_sourcedir %{_topdir}" \ + -ba packaging/rpm/ansibleworks.spec + diff --git a/config/ansibleworks.conf b/config/ansibleworks.conf new file mode 100644 index 0000000000..ecdcd5f740 --- /dev/null +++ b/config/ansibleworks.conf @@ -0,0 +1,32 @@ +NameVirtualHost *:80 +WSGISocketPrefix run/wsgi + + + ServerName localhost + ServerAlias localhost + ServerAlias 127.0.0.1 + DocumentRoot /var/lib/ansibleworks/public + + WSGIScriptAlias / /var/lib/ansibleworks/wsgi.py + WSGIPassAuthorization On + + # FIXME: May want to tune these parameters after performance testing. + WSGIDaemonProcess ansibleworks user=ansibleworks group=ansibleworks processes=2 threads=20 maximum-requests=1000 display-name="%{GROUP}" + WSGIProcessGroup ansibleworks + + Alias /favicon.ico /var/lib/ansibleworks/public/static/favicon.ico + Alias /static/ /var/lib/ansibleworks/public/static/ + + + + Order deny,allow + Allow from all + + + + + Order deny,allow + Allow from all + + + diff --git a/config/settings.py b/config/settings.py new file mode 100644 index 0000000000..dde18c3e8c --- /dev/null +++ b/config/settings.py @@ -0,0 +1,41 @@ +ADMINS = ( + #('Joe Admin', 'joeadmin@example.com'), +) + +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.postgresql_psycopg2', + 'NAME': 'ansibleworks', + 'USER': 'ansibleworks', + 'PASSWORD': 'AWsecret', + 'HOST': '', + 'PORT': '', + } +} + +STATIC_ROOT = '/var/lib/ansibleworks/public/static' + +PROJECTS_ROOT = '/var/lib/ansibleworks/projects' + +SECRET_KEY = file('/etc/ansibleworks/SECRET_KEY', 'rb').read().strip() + +ALLOWED_HOSTS = ['*'] + +LOGGING['handlers']['syslog'] = { + 'level': 'ERROR', + 'filters': ['require_debug_false'], + 'class': 'logging.handlers.SysLogHandler', + 'address': '/dev/log', + 'facility': 'local0', + 'formatter': 'simple', +} + +SERVER_EMAIL = 'root@localhost' +DEFAULT_FROM_EMAIL = 'webmaster@localhost' +EMAIL_SUBJECT_PREFIX = '[AnsibleWorks] ' + +EMAIL_HOST = 'localhost' +EMAIL_PORT = 25 +EMAIL_HOST_USER = '' +EMAIL_HOST_PASSWORD = '' +EMAIL_USE_TLS = False diff --git a/setup.py b/setup.py index ae5efa941c..097647c2ac 100755 --- a/setup.py +++ b/setup.py @@ -3,16 +3,57 @@ # Copyright (c) 2013 AnsibleWorks, Inc. # All Rights Reserved. -import datetime +import os, datetime, glob from setuptools import setup, find_packages from ansibleworks import __version__ build_timestamp = datetime.datetime.now().strftime('%Y%m%d%H%M') +# Paths we'll use later +etcpath = "/etc/ansibleworks" +homedir = "/var/lib/ansibleworks" +if os.path.exists("/etc/debian_version"): + webconfig = "/etc/apache2/conf.d" +else: + webconfig = "/etc/httpd/conf.d" + +##################################################################### +# Helper Functions + +def explode_glob_path(path): + """Take a glob and hand back the full recursive expansion, + ignoring links. + """ + + result = [] + includes = glob.glob(path) + for item in includes: + if os.path.isdir(item) and not os.path.islink(item): + result.extend(explode_glob_path(os.path.join(item, "*"))) + else: + result.append(item) + return result + + +def proc_data_files(data_files): + """Because data_files doesn't natively support globs... + let's add them. + """ + + result = [] + for dir,files in data_files: + includes = [] + for item in files: + includes.extend(explode_glob_path(item)) + result.append((dir, includes)) + return result + +##################################################################### + setup( name='ansibleworks', - version=__version__, + version=__version__.split("-")[0], author='AnsibleWorks, Inc.', author_email='support@ansibleworks.com', description='AnsibleWorks API, UI and Task Engine', @@ -57,6 +98,14 @@ setup( 'ansibleworks-manage = ansibleworks:manage', ], }, + data_files = proc_data_files([ + ("%s" % homedir, ["ansibleworks/wsgi.py", + "ansibleworks/static/favicon.ico", + ]), + ("%s" % etcpath, ["config/settings.py"]), + ("%s" % webconfig, ["config/ansibleworks.conf"]), + ] + ), options={ 'egg_info': { 'tag_build': '-dev%s' % build_timestamp, @@ -67,3 +116,4 @@ setup( }, }, ) +