diff --git a/Makefile b/Makefile index 1114fd8bbf..e4971d7477 100644 --- a/Makefile +++ b/Makefile @@ -42,25 +42,22 @@ endif GIT_DATE := $(shell git log -n 1 --format="%ai") DATE := $(shell date -u +%Y%m%d%H%M) -NAME ?= ansible_awx +NAME ?= awx GIT_REMOTE_URL = $(shell git config --get remote.origin.url) + ifeq ($(OFFICIAL),yes) - RELEASE ?= 1 - AW_REPO_URL ?= http://releases.ansible.com/ansible-tower + VERSION_TARGET ?= $(RELEASE_VERSION) else - RELEASE ?= 0.git$(shell git describe --long | cut -d - -f 2-2) - AW_REPO_URL ?= http://jenkins.testing.ansible.com/ansible-tower_nightlies_f8b8c5588b2505970227a7b0900ef69040ad5a00/$(GIT_BRANCH) + VERSION_TARGET ?= $(VERSION3DOT) endif # TAR build parameters ifeq ($(OFFICIAL),yes) - SETUP_TAR_NAME=$(NAME)-setup-$(RELEASE_VERSION) SDIST_TAR_NAME=$(NAME)-$(RELEASE_VERSION) WHEEL_NAME=$(NAME)-$(RELEASE_VERSION) else - SETUP_TAR_NAME=$(NAME)-setup-$(RELEASE_VERSION)-$(RELEASE) - SDIST_TAR_NAME=$(NAME)-$(RELEASE_VERSION)-$(RELEASE) - WHEEL_NAME=$(NAME)-$(RELEASE_VERSION)_$(RELEASE) + SDIST_TAR_NAME=$(NAME)-$(VERSION3DOT) + WHEEL_NAME=$(NAME)-$(VERSION3DOT) endif SDIST_COMMAND ?= sdist @@ -68,10 +65,6 @@ WHEEL_COMMAND ?= bdist_wheel SDIST_TAR_FILE ?= $(SDIST_TAR_NAME).tar.gz WHEEL_FILE ?= $(WHEEL_NAME)-py2-none-any.whl -SETUP_TAR_FILE=$(SETUP_TAR_NAME).tar.gz -SETUP_TAR_LINK=$(NAME)-setup-latest.tar.gz -SETUP_TAR_CHECKSUM=$(NAME)-setup-CHECKSUM - # UI flag files UI_DEPS_FLAG_FILE = awx/ui/.deps_built UI_RELEASE_FLAG_FILE = awx/ui/.release_built @@ -609,4 +602,11 @@ psql-container: docker run -it --net tools_default --rm postgres:9.4.1 sh -c 'exec psql -h "postgres" -p "5432" -U postgres' VERSION: - echo $(RELEASE_VERSION) > $@ + echo $(VERSION_TARGET) > $@ + +production-openshift-image: sdist + cat installer/openshift/Dockerfile | sed "s/{{ version }}/$(VERSION_TARGET)/g" | sed "s/{{ tar }}/$(SDIST_TAR_FILE)/g" > ./Dockerfile.production + cat installer/openshift/Dockerfile.celery | sed "s/{{ version }}/$(VERSION_TARGET)/g" | sed "s/{{ tar }}/$(SDIST_TAR_FILE)/g" > ./Dockerfile.celery.production + docker build -t awx_web -f ./Dockerfile.production . + docker build -t awx_task -f ./Dockerfile.celery.production . + diff --git a/installer/openshift/Dockerfile b/installer/openshift/Dockerfile index 731c9724b5..8c0109210e 100644 --- a/installer/openshift/Dockerfile +++ b/installer/openshift/Dockerfile @@ -12,8 +12,6 @@ USER root ADD https://github.com/krallin/tini/releases/download/v0.14.0/tini /tini RUN chmod +x /tini -# Tower Dependencies Install -# TODO: Probably only need Tower dependencies here ADD Makefile /tmp/Makefile RUN mkdir /tmp/requirements ADD requirements/requirements_ansible.txt \ @@ -29,18 +27,20 @@ RUN yum -y install epel-release && yum -y localinstall http://download.postgresq RUN pip install virtualenv supervisor WORKDIR /tmp RUN mkdir -p /var/lib/awx/public/static -# TODO: Handlers could be stripped of this + RUN mkdir -p /var/log/tower RUN mkdir -p /etc/tower -RUN echo "ansibletower" > /etc/tower/SECRET_KEY -RUN VENV_BASE=/var/lib/awx/venv make requirements_ansible && VENV_BASE=/var/lib/awx/venv make requirements_tower -COPY dist/ansible-tower-3.2.0.tar.gz /tmp/ansible-tower-3.2.0.tar.gz -RUN pip install /tmp/ansible-tower-3.2.0.tar.gz -# TODO: Replace this with the actual version -RUN echo "3.2.0" > /var/lib/awx/.tower_version +RUN echo "awxsecret" > /etc/tower/SECRET_KEY +RUN VENV_BASE=/var/lib/awx/venv make requirements_ansible && VENV_BASE=/var/lib/awx/venv make requirements_awx +COPY dist/awx-3.2.0.3953.tar.gz /tmp/awx-3.2.0.3953.tar.gz +RUN OFFICIAL=yes pip install /tmp/awx-3.2.0.3953.tar.gz + +RUN echo "3.2.0.3953" > /var/lib/awx/.tower_version ADD installer/openshift/nginx.conf /etc/nginx/nginx.conf ADD installer/openshift/supervisor.conf /supervisor.conf -ADD installer/openshift/launch_tower.sh /usr/bin/launch_tower.sh +ADD installer/openshift/supervisor_task.conf /supervisor_task.conf +ADD installer/openshift/launch_awx.sh /usr/bin/launch_awx.sh +ADD installer/openshift/launch_awx_task.sh /usr/bin/launch_awx_task.sh ADD installer/openshift/settings.py /etc/tower/settings.py RUN yum -y remove gcc postgresql-devel libxml2-devel libxslt-devel cyrus-sasl-devel openldap-devel xmlsec1-devel krb5-devel xmlsec1-openssl-devel libtool-ltdl-devel gcc-c++ python-devel && yum -y clean all RUN rm -rf /root/.cache @@ -51,4 +51,4 @@ USER 1000 EXPOSE 8052 WORKDIR /var/lib/awx ENTRYPOINT ["/tini", "--"] -CMD /usr/bin/launch_tower.sh +CMD /usr/bin/launch_awx.sh diff --git a/installer/openshift/Dockerfile.celery b/installer/openshift/Dockerfile.celery index 902b0d600f..d878e0ccf7 100644 --- a/installer/openshift/Dockerfile.celery +++ b/installer/openshift/Dockerfile.celery @@ -1,53 +1,6 @@ -FROM centos:7 - -# Do we need this? -#RUN locale-gen en_US.UTF-8 -#ENV LANG en_US.UTF-8 -#ENV LANGUAGE en_US:en -#ENV LC_ALL en_US.UTF-8 - -USER root - -# Init System -ADD https://github.com/krallin/tini/releases/download/v0.14.0/tini /tini -RUN chmod +x /tini - -# Tower Dependencies Install -ADD Makefile /tmp/Makefile -RUN mkdir /tmp/requirements -ADD requirements/requirements_ansible.txt \ - requirements/requirements_ansible_uninstall.txt \ - requirements/requirements_ansible_git.txt \ - requirements/requirements.txt \ - requirements/requirements_tower_uninstall.txt \ - requirements/requirements_git.txt \ - /tmp/requirements/ - -# OS Dependencies -RUN yum -y install epel-release && yum -y localinstall http://download.postgresql.org/pub/repos/yum/9.6/redhat/rhel-7-x86_64/pgdg-centos96-9.6-3.noarch.rpm && yum -y update && yum -y install ansible git curl python-psycopg2 python-pip python-setuptools libselinux-python setools-libs yum-utils sudo acl make postgresql-devel python-psutil libxml2-devel libxslt-devel libstdc++.so.6 gcc cyrus-sasl-devel cyrus-sasl openldap-devel libffi-devel python-pip xmlsec1-devel swig krb5-devel xmlsec1-openssl xmlsec1 xmlsec1-openssl-devel libtool-ltdl-devel bubblewrap gcc-c++ python-devel -RUN pip install virtualenv supervisor -WORKDIR /tmp -RUN mkdir -p /var/lib/awx -# TODO: Handlers could be stripped of this -RUN mkdir -p /var/log/tower -RUN mkdir -p /etc/tower -RUN mkdir -p /var/lib/awx/public/static -RUN echo "ansibletower" > /etc/tower/SECRET_KEY -RUN VENV_BASE=/var/lib/awx/venv make requirements_ansible && VENV_BASE=/var/lib/awx/venv make requirements_tower -COPY dist/ansible-tower-3.2.0.tar.gz /tmp/ansible-tower-3.2.0.tar.gz -RUN pip install /tmp/ansible-tower-3.2.0.tar.gz -# TODO: Replace this with the actual version -RUN echo "3.2.0" > /var/lib/awx/.tower_version -ADD installer/openshift/nginx.conf /etc/nginx/nginx.conf -ADD installer/openshift/supervisor_task.conf /supervisor_task.conf -ADD installer/openshift/launch_tower_task.sh /usr/bin/launch_tower_task.sh -ADD installer/openshift/settings.py /etc/tower/settings.py -RUN yum -y remove gcc postgresql-devel libxml2-devel libxslt-devel cyrus-sasl-devel openldap-devel xmlsec1-devel krb5-devel xmlsec1-openssl-devel libtool-ltdl-devel gcc-c++ python-devel && yum -y clean all -RUN rm -rf /root/.cache -RUN chmod g+w /etc/passwd -RUN chgrp -Rf root /var/lib/awx && chmod -Rf g+w /var/lib/awx +FROM awx_web +USER 0 +RUN sudo yum -y remove nginx USER 1000 -EXPOSE 80 443 -WORKDIR /var/lib/awx -ENTRYPOINT ["/tini", "--"] -CMD /usr/bin/launch_tower_task.sh +EXPOSE 8052 +CMD /usr/bin/launch_awx_task.sh diff --git a/installer/openshift/config/configmap.yml b/installer/openshift/config/configmap.yml index 77ba30bc8d..064e7076d6 100644 --- a/installer/openshift/config/configmap.yml +++ b/installer/openshift/config/configmap.yml @@ -9,8 +9,10 @@ data: import os import socket ADMINS = () - DEBUG = True + # Container environments don't like chroots + AWX_PROOT_ENABLED = False + #Autoprovisioning should replace this CLUSTER_HOST_ID = socket.gethostname() SYSTEM_UUID = '00000000-0000-0000-0000-000000000000' @@ -44,12 +46,14 @@ data: LOGGING['loggers']['social']['handlers'] = ['console'] LOGGING['loggers']['system_tracking_migrations']['handlers'] = ['console'] LOGGING['loggers']['rbac_migrations']['handlers'] = ['console'] + LOGGING['loggers']['awx.isolated.manager.playbooks']['handlers'] = ['console'] LOGGING['handlers']['callback_receiver'] = {'class': 'logging.NullHandler'} LOGGING['handlers']['fact_receiver'] = {'class': 'logging.NullHandler'} LOGGING['handlers']['task_system'] = {'class': 'logging.NullHandler'} LOGGING['handlers']['tower_warnings'] = {'class': 'logging.NullHandler'} LOGGING['handlers']['rbac_migrations'] = {'class': 'logging.NullHandler'} LOGGING['handlers']['system_tracking_migrations'] = {'class': 'logging.NullHandler'} + LOGGING['handlers']['management_playbooks'] = {'class': 'logging.NullHandler'} DATABASES = { 'default': { diff --git a/installer/openshift/launch_tower.sh b/installer/openshift/launch_awx.sh similarity index 82% rename from installer/openshift/launch_tower.sh rename to installer/openshift/launch_awx.sh index cd6cc67352..a3a73f2bca 100755 --- a/installer/openshift/launch_tower.sh +++ b/installer/openshift/launch_awx.sh @@ -4,5 +4,5 @@ if [ `id -u` -ge 10000 ]; then cat /tmp/passwd > /etc/passwd rm /tmp/passwd fi -tower-manage collectstatic --noinput --clear +awx-manage collectstatic --noinput --clear supervisord -c /supervisor.conf diff --git a/installer/openshift/launch_tower_task.sh b/installer/openshift/launch_awx_task.sh similarity index 65% rename from installer/openshift/launch_tower_task.sh rename to installer/openshift/launch_awx_task.sh index acec1f66d3..c0a5871e77 100755 --- a/installer/openshift/launch_tower_task.sh +++ b/installer/openshift/launch_awx_task.sh @@ -5,9 +5,9 @@ if [ `id -u` -ge 10000 ]; then rm /tmp/passwd fi ANSIBLE_REMOTE_TEMP=/tmp ANSIBLE_LOCAL_TEMP=/tmp ansible -i "127.0.0.1," -c local -v -m postgresql_db -U $DATABASE_USER -a "name=$DATABASE_NAME owner=$DATABASE_USER login_user=$DATABASE_USER login_host=$DATABASE_HOST login_password=$DATABASE_PASSWORD" all -tower-manage migrate --noinput --fake-initial -echo "from django.contrib.auth.models import User; User.objects.create_superuser('admin', 'root@localhost', 'password')" | tower-manage shell -tower-manage create_preload_data -tower-manage register_instance --hostname=$(hostname) -tower-manage register_queue --queuename=tower --hostnames=$(hostname) +awx-manage migrate --noinput --fake-initial +echo "from django.contrib.auth.models import User; User.objects.create_superuser('admin', 'root@localhost', 'password')" | awx-manage shell +awx-manage create_preload_data +awx-manage register_instance --hostname=$(hostname) +awx-manage register_queue --queuename=tower --hostnames=$(hostname) supervisord -c /supervisor_task.conf diff --git a/installer/openshift/supervisor.conf b/installer/openshift/supervisor.conf index d9574d954a..384feeea2b 100644 --- a/installer/openshift/supervisor.conf +++ b/installer/openshift/supervisor.conf @@ -13,7 +13,7 @@ stderr_logfile=/dev/stderr stderr_logfile_maxbytes=0 [program:uwsgi] -command = /var/lib/awx/venv/tower/bin/uwsgi --socket 127.0.0.1:8050 --module=awx.wsgi:application --vacuum --processes=5 --harakiri=120 --no-orphans --master --max-requests=1000 --master-fifo=/var/lib/awx/awxfifo --lazy-apps -b 32768 +command = /var/lib/awx/venv/awx/bin/uwsgi --socket 127.0.0.1:8050 --module=awx.wsgi:application --vacuum --processes=5 --harakiri=120 --no-orphans --master --max-requests=1000 --master-fifo=/var/lib/awx/awxfifo --lazy-apps -b 32768 directory = /var/lib/awx autostart = true 2autorestart = true @@ -25,7 +25,7 @@ stderr_logfile=/dev/stderr stderr_logfile_maxbytes=0 [program:daphne] -command = /var/lib/awx/venv/tower/bin/daphne -b 127.0.0.1 -p 8051 awx.asgi:channel_layer +command = /var/lib/awx/venv/awx/bin/daphne -b 127.0.0.1 -p 8051 awx.asgi:channel_layer directory = /var/lib/awx autostart = true autorestart = true diff --git a/installer/openshift/supervisor_task.conf b/installer/openshift/supervisor_task.conf index 4103bb61b2..3154c7ffb1 100644 --- a/installer/openshift/supervisor_task.conf +++ b/installer/openshift/supervisor_task.conf @@ -4,7 +4,7 @@ umask = 022 [program:celery] # TODO: Needs to be reworked to dynamically use instance group queues -command = tower-manage celery worker -l debug --autoscale=4 -Ofair -Q tower_scheduler,tower_broadcast_all,tower,%(host_node_name)s -n celery@localhost +command = awx-manage celery worker -l debug --autoscale=4 -Ofair -Q tower_scheduler,tower_broadcast_all,tower,%(host_node_name)s -n celery@localhost directory = /var/lib/awx environment = LANGUAGE="en_US.UTF-8",LANG="en_US.UTF-8",LC_ALL="en_US.UTF-8",LC_CTYPE="en_US.UTF-8" #user = {{ aw_user }} @@ -17,7 +17,7 @@ stderr_logfile=/dev/stderr stderr_logfile_maxbytes=0 [program:awx-celeryd-beat] -command = /usr/bin/tower-manage celery beat -l debug --pidfile= -s /var/lib/awx/beat.db +command = /usr/bin/awx-manage celery beat -l debug --pidfile= -s /var/lib/awx/beat.db directory = /var/lib/awx autostart = true autorestart = true @@ -29,18 +29,7 @@ stderr_logfile = /dev/stderr stderr_logfile_maxbytes = 0 [program:callback-receiver] -command = tower-manage run_callback_receiver -directory = /var/lib/awx -autostart = true -autorestart = true -stopwaitsecs = 5 -stdout_logfile=/dev/stdout -stdout_logfile_maxbytes=0 -stderr_logfile=/dev/stderr -stderr_logfile_maxbytes=0 - -[program:fact-cache-receiver] -command = tower-manage run_fact_cache_receiver +command = awx-manage run_callback_receiver directory = /var/lib/awx autostart = true autorestart = true @@ -51,7 +40,7 @@ stderr_logfile=/dev/stderr stderr_logfile_maxbytes=0 [program:channels-worker] -command = tower-manage runworker --only-channels websocket.* +command = awx-manage runworker --only-channels websocket.* directory = /var/lib/awx autostart = true autorestart = true @@ -62,7 +51,7 @@ stderr_logfile=/dev/stderr stderr_logfile_maxbytes=0 [group:tower-processes] -programs=celery,callback-receiver,channels-worker,fact-cache-receiver +programs=celery,callback-receiver,channels-worker priority=5 # TODO: Exit Handler diff --git a/setup.py b/setup.py index 39a145b13c..154caffca5 100755 --- a/setup.py +++ b/setup.py @@ -16,12 +16,7 @@ etcpath = "/etc/tower" homedir = "/var/lib/awx" bindir = "/usr/bin" sharedir = "/usr/share/awx" -docdir = "/usr/share/doc/ansible-tower" - -if os.getenv('OFFICIAL', 'no') == 'yes': - build_tag = '' -else: - build_tag = '-' + '0.git' + subprocess.Popen("git describe --long | cut -d - -f 2-2", shell=True, stdout=subprocess.PIPE).stdout.read().strip() +docdir = "/usr/share/doc/awx" def get_version(): @@ -65,10 +60,6 @@ class sdist_isolated(sdist): 'recursive-include awx/lib *.py', ] - def __init__(self, dist): - sdist.__init__(self, dist) - dist.metadata.version += build_tag - def get_file_list(self): self.filelist.process_template_line('include setup.py') for line in self.includes: @@ -173,9 +164,6 @@ setup( ("%s" % sosconfig, ["tools/sosreport/tower.py"])]), cmdclass = {'sdist_isolated': sdist_isolated}, options = { - 'egg_info': { - 'tag_build': build_tag, - }, 'aliases': { 'dev_build': 'clean --all egg_info sdist', 'release_build': 'clean --all egg_info -b "" sdist', diff --git a/tools/scripts/compilemessages.py b/tools/scripts/compilemessages.py index 3714767bfa..36c68a8269 100644 --- a/tools/scripts/compilemessages.py +++ b/tools/scripts/compilemessages.py @@ -137,7 +137,7 @@ if __name__ == "__main__": program = 'msgfmt' program_options = ['--check-format'] for i, (dirpath, f) in enumerate(locations): - print 'processing file %s in %s\n' % (f, dirpath) + print('processing file %s in %s\n' % (f, dirpath)) po_path = os.path.join(dirpath, f) if has_bom(po_path): raise Exception("The %s file has a BOM (Byte Order Mark). "