From 6abeaf2c55b042e7cdc4a9ecb40b23fe748d84d3 Mon Sep 17 00:00:00 2001 From: Matthew Jones Date: Wed, 8 Apr 2020 10:02:05 -0400 Subject: [PATCH] Update some contributing docs * Update the tools called in the dev environment * More RMQ purges from architecture docs * Remove the old clusterdev target --- CONTRIBUTING.md | 15 +- Makefile | 3 - docs/task_manager_system.md | 2 +- docs/tasks.md | 4 +- tools/clusterdevel/bootstrap_minishift.sh | 30 --- .../roles/minishift/tasks/main.yml | 117 ------------ .../minishift/templates/configmap.yml.j2 | 118 ------------ .../roles/minishift/templates/hostdev.yml.j2 | 178 ------------------ .../minishift/templates/hostfolderpvc.yml.j2 | 15 -- .../minishift/templates/serviceacct.yml.j2 | 31 --- .../minishift/templates/volumeclaim.yml.j2 | 15 -- tools/clusterdevel/start_minishift_dev.yml | 11 -- 12 files changed, 12 insertions(+), 527 deletions(-) delete mode 100755 tools/clusterdevel/bootstrap_minishift.sh delete mode 100644 tools/clusterdevel/roles/minishift/tasks/main.yml delete mode 100644 tools/clusterdevel/roles/minishift/templates/configmap.yml.j2 delete mode 100644 tools/clusterdevel/roles/minishift/templates/hostdev.yml.j2 delete mode 100644 tools/clusterdevel/roles/minishift/templates/hostfolderpvc.yml.j2 delete mode 100644 tools/clusterdevel/roles/minishift/templates/serviceacct.yml.j2 delete mode 100644 tools/clusterdevel/roles/minishift/templates/volumeclaim.yml.j2 delete mode 100644 tools/clusterdevel/start_minishift_dev.yml diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b7e06ebead..a1aeffb1ba 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -215,18 +215,23 @@ Using `docker exec`, this will create a session in the running *awx* container, If you want to start and use the development environment, you'll first need to bootstrap it by running the following command: ```bash -(container)# /bootstrap_development.sh +(container)# /usr/bin/bootstrap_development.sh ``` -The above will do all the setup tasks, including running database migrations, so it may take a couple minutes. +The above will do all the setup tasks, including running database migrations, so it may take a couple minutes. Once it's done it +will drop you back to the shell. -Now you can start each service individually, or start all services in a pre-configured tmux session like so: +In order to launch all developer services: ```bash -(container)# cd /awx_devel -(container)# make server +(container)# /usr/bin/launch_awx.sh ``` +`launch_awx.sh` also calls `bootstrap_development.sh` so if all you are doing is launching the supervisor to start all services, you don't +need to call `bootstrap_development.sh` first. + + + ### Post Build Steps Before you can log in and use the system, you will need to create an admin user. Optionally, you may also want to load some demo data. diff --git a/Makefile b/Makefile index c804ff43bf..8875126a9b 100644 --- a/Makefile +++ b/Makefile @@ -686,9 +686,6 @@ docker-compose-cluster-elk: docker-auth awx/projects prometheus: docker run -u0 --net=tools_default --link=`docker ps | egrep -o "tools_awx(_run)?_([^ ]+)?"`:awxweb --volume `pwd`/tools/prometheus:/prometheus --name prometheus -d -p 0.0.0.0:9090:9090 prom/prometheus --web.enable-lifecycle --config.file=/prometheus/prometheus.yml -minishift-dev: - ansible-playbook -i localhost, -e devtree_directory=$(CURDIR) tools/clusterdevel/start_minishift_dev.yml - clean-elk: docker stop tools_kibana_1 docker stop tools_logstash_1 diff --git a/docs/task_manager_system.md b/docs/task_manager_system.md index a28f947d5f..89b84035ce 100644 --- a/docs/task_manager_system.md +++ b/docs/task_manager_system.md @@ -26,7 +26,7 @@ Empirically, the periodic task manager has been effective in the past and will c * Detect finished workflow jobs * Spawn next workflow jobs if needed * For each pending job, start with the oldest created job - * If the job is not blocked, and there is capacity in the instance group queue, then mark it as `waiting` and submit the job to RabbitMQ. + * If the job is not blocked, and there is capacity in the instance group queue, then mark it as `waiting` and submit the job. ### Job Lifecycle diff --git a/docs/tasks.md b/docs/tasks.md index 53b30c8ce8..4fea6d4ef4 100644 --- a/docs/tasks.md +++ b/docs/tasks.md @@ -26,9 +26,7 @@ Tasks, Queues and Workers To accomplish this, AWX makes use of a "Task Queue" abstraction. Task Queues are used as a mechanism to distribute work across machines in an AWX installation. A Task Queue's input is a unit of work called a Task. Dedicated worker processes running on every AWX node constantly monitor these queues for new work to perform. -AWX communicates with these worker processes to mediate between clients and workers. This is done via distributed RabbitMQ queues and the already-acknowledged local queue that the Dispatcher is working through. Simply put: to initiate a task, the client (generally, Python code in the AWX API) publishes a message to a queue, and RabbitMQ then delivers that message to one or more workers. - -By default, when AWX creates queues in RabbitMQ, it creates them as *durable* queues in RabbitMQ (which allows for message persistence at the cost of lower performance). For increased message throughput (at the risk of message loss on server restarts), set BROKER_DURABILITY=False, and AWX will create _transient_ queues instead. +AWX communicates with these worker processes to mediate between clients and workers. This is done via distributed queues and the already-acknowledged local queue that the Dispatcher is working through. Simply put: to initiate a task, the client (generally, Python code in the AWX API) publishes a message to a queue, which is then delivered to one or more workers. Clustered AWX installations consist of multiple workers spread across every node, giving way to high availability and horizontal scaling. diff --git a/tools/clusterdevel/bootstrap_minishift.sh b/tools/clusterdevel/bootstrap_minishift.sh deleted file mode 100755 index 4cb69e881f..0000000000 --- a/tools/clusterdevel/bootstrap_minishift.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/bash -set +x - -# Wait for the databases to come up -ansible -i "127.0.0.1," -c local -v -m wait_for -a "host=postgresql port=5432" all -ansible -i "127.0.0.1," -c local -v -m wait_for -a "host=localhost port=11211" all -ansible -i "127.0.0.1," -c local -v -m wait_for -a "host=localhost port=5672" all -ansible -i "127.0.0.1," -c local -v -m postgresql_db -U postgres -a "name=awx owner=awx login_user=awx login_password=awx login_host=postgresql" all - -# Move to the source directory so we can bootstrap -if [ -f "/awx_devel/manage.py" ]; then - cd /awx_devel -else - echo "Failed to find awx source tree, map your development tree volume" -fi - -#make awx-link -python setup.py develop -yes | cp -rf /awx_devel/tools/docker-compose/supervisor.conf /supervisor.conf - -# AWX bootstrapping -make version_file -make migrate -make init - -mkdir -p /awx_devel/awx/public/static -mkdir -p /awx_devel/awx/ui/static - -cd /awx_devel -make supervisor diff --git a/tools/clusterdevel/roles/minishift/tasks/main.yml b/tools/clusterdevel/roles/minishift/tasks/main.yml deleted file mode 100644 index 674e963ab8..0000000000 --- a/tools/clusterdevel/roles/minishift/tasks/main.yml +++ /dev/null @@ -1,117 +0,0 @@ ---- -- name: Get status of minishift - shell: minishift status - register: minishift_status - -- name: Echo minishift status so if verification fails we can see the results - debug: - var: minishift_status.stdout - -- name: Verify status of minishift - assert: - that: - - "'Minishift: Running' == minishift_status.stdout_lines[0]" - - "'OpenShift: Running' in minishift_status.stdout_lines[2]" - -- name: Get minishift ip - shell: minishift ip - register: minishift_ip - -- name: Get minishift oc location - shell: minishift oc-env - register: minishift_oc_env - -- shell: | - eval $(minishift oc-env) - echo $PATH - register: oc_path - -- name: Deploy Tower - block: - - name: Login as admin - shell: "oc login -u system:admin" - - - name: Create privileged user service account awx - shell: "oc adm policy add-scc-to-user privileged system:serviceaccount:{{ awx_dev_project }}:awx" - - - name: Unattach AWX dev tree volume locally - shell: "minishift hostfolder remove awx || true" - - - name: Attach AWX dev tree volume locally - shell: "minishift hostfolder add -t sshfs --source {{ devtree_directory }} --target /mnt/sda1/awx awx" - - - name: Unmount AWX dev volume - shell: "minishift hostfolder umount awx || true" - - - name: Mount AWX dev volume - shell: minishift hostfolder mount awx - - - name: Get Project Detail - shell: "oc get project {{ awx_dev_project }}" - register: project_details - ignore_errors: true - - - name: Get Postgres Service Detail - shell: "oc describe svc postgresql -n {{ awx_dev_project }}" - register: postgres_svc_details - ignore_errors: true - - - name: Create AWX Openshift Project - shell: "oc new-project {{ awx_dev_project }}" - when: project_details.rc != 0 - - - name: Stage serviceacct.yml - template: - src: serviceacct.yml.j2 - dest: /tmp/serviceacct.yml - - - name: Apply svc account - shell: "oc apply -f /tmp/serviceacct.yml && rm -rf /tmp/serviceaccount.yml" - - - name: Stage hostfolderpvc.yml - template: - src: hostfolderpvc.yml.j2 - dest: /tmp/hostfolderpvc.yml - - - name: Create PV for host folder - shell: "oc apply -f /tmp/hostfolderpvc.yml && rm -rf /tmp/hostfolderpvc.yml" - - - name: Stage volumeclaim.yml - template: - src: volumeclaim.yml.j2 - dest: /tmp/volumeclaim.yml - - - name: Create PV for host folder - shell: "oc apply -f /tmp/volumeclaim.yml && rm -rf /tmp/volumeclaim.yml" - - - name: Deploy and Activate Postgres - shell: "oc new-app --template=postgresql-persistent -e MEMORY_LIMIT={{ pg_memory_limit|default('512') }}Mi -e NAMESPACE=openshift -e DATABASE_SERVICE_NAME=postgresql -e POSTGRESQL_USER={{ pg_username|default('awx') }} -e POSTGRESQL_PASSWORD={{ pg_password|default('awx') }} -e POSTGRESQL_DATABASE={{ pg_database|default('awx') }} -e VOLUME_CAPACITY={{ pg_volume_capacity|default('5')}}Gi -e POSTGRESQL_VERSION=10 -n {{ awx_dev_project }}" - when: postgres_svc_details is defined and postgres_svc_details.rc != 0 - register: openshift_pg_activate - - - name: Wait for Postgres to activate - pause: - seconds: 15 - when: openshift_pg_activate|changed - - - name: Template configmap - template: - src: configmap.yml.j2 - dest: "/tmp/configmap.yml" - - - name: Create configmap - shell: "oc apply -f /tmp/configmap.yml && rm -rf /tmp/configmap.yml" - - - name: Template deployment - template: - src: hostdev.yml.j2 - dest: "/tmp/hostdev.yml" - - - name: Create deployment - shell: "oc apply -f /tmp/hostdev.yml && rm -rf /tmp/hostdev.yml" - - - name: Please login - debug: - msg: "Login at https://{{ minishift_ip.stdout }}:8443 with admin / admin" - environment: - PATH: '{{ oc_path.stdout }}' diff --git a/tools/clusterdevel/roles/minishift/templates/configmap.yml.j2 b/tools/clusterdevel/roles/minishift/templates/configmap.yml.j2 deleted file mode 100644 index 74d0cb1fe8..0000000000 --- a/tools/clusterdevel/roles/minishift/templates/configmap.yml.j2 +++ /dev/null @@ -1,118 +0,0 @@ ---- -apiVersion: v1 -kind: ConfigMap -metadata: - name: awx-dev-config - namespace: {{ awx_dev_project }} -data: - secret_key: isasekrit - awx_settings: | - import os - import socket - ADMINS = () - - # Container environments don't like chroots - AWX_PROOT_ENABLED = False - - # Automatically deprovision pods that go offline - AWX_AUTO_DEPROVISION_INSTANCES = True - - SYSTEM_TASK_ABS_CPU = {{ ((awx_task_cpu_request|int / 1000) * 4)|int }} - SYSTEM_TASK_ABS_MEM = {{ ((awx_task_mem_request|int * 1024) / 100)|int }} - - #Autoprovisioning should replace this - CLUSTER_HOST_ID = socket.gethostname() - SYSTEM_UUID = '00000000-0000-0000-0000-000000000000' - - SESSION_COOKIE_SECURE = False - CSRF_COOKIE_SECURE = False - - REMOTE_HOST_HEADERS = ['HTTP_X_FORWARDED_FOR'] - - STATIC_ROOT = '/var/lib/awx/public/static' - PROJECTS_ROOT = '/var/lib/awx/projects' - JOBOUTPUT_ROOT = '/var/lib/awx/job_status' - SECRET_KEY = file('/etc/tower/SECRET_KEY', 'rb').read().strip() - ALLOWED_HOSTS = ['*'] - INTERNAL_API_URL = 'http://127.0.0.1:8052' - SERVER_EMAIL = 'root@localhost' - DEFAULT_FROM_EMAIL = 'webmaster@localhost' - EMAIL_SUBJECT_PREFIX = '[AWX] ' - EMAIL_HOST = 'localhost' - EMAIL_PORT = 25 - EMAIL_HOST_USER = '' - EMAIL_HOST_PASSWORD = '' - EMAIL_USE_TLS = False - - LOGGING['handlers']['console'] = { - '()': 'logging.StreamHandler', - 'level': 'DEBUG', - 'formatter': 'simple', - } - - LOGGING['loggers']['django.request']['handlers'] = ['console'] - LOGGING['loggers']['rest_framework.request']['handlers'] = ['console'] - LOGGING['loggers']['awx']['handlers'] = ['console'] - LOGGING['loggers']['awx.main.commands.run_callback_receiver']['handlers'] = ['console'] - LOGGING['loggers']['awx.main.commands.inventory_import']['handlers'] = ['console'] - LOGGING['loggers']['awx.main.tasks']['handlers'] = ['console'] - LOGGING['loggers']['awx.main.scheduler']['handlers'] = ['console'] - LOGGING['loggers']['django_auth_ldap']['handlers'] = ['console'] - 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']['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': { - 'ATOMIC_REQUESTS': True, - 'ENGINE': 'awx.main.db.profiled_pg', - 'NAME': "awx", - 'USER': "awx", - 'PASSWORD': "awx", - 'HOST': "postgresql", - 'PORT': "5432", - } - } - BROKER_URL = 'amqp://{}:{}@{}:{}/{}'.format( - "awx", - "abcdefg", - "localhost", - "5672", - "awx") - CHANNEL_LAYERS = { - 'default': {'BACKEND': 'asgi_amqp.AMQPChannelLayer', - 'ROUTING': 'awx.main.routing.channel_routing', - 'CONFIG': {'url': BROKER_URL}} - } ---- -apiVersion: v1 -kind: ConfigMap -metadata: - name: rabbitmq-config - namespace: {{ awx_dev_project }} -data: - enabled_plugins: | - [rabbitmq_management,rabbitmq_peer_discovery_k8s]. - rabbitmq.conf: | - default_user = awx - default_pass = abcdefg - default_vhost = awx - - ## Clustering - cluster_formation.peer_discovery_backend = rabbit_peer_discovery_k8s - cluster_formation.k8s.host = kubernetes.default.svc.cluster.local - cluster_formation.k8s.address_type = ip - cluster_formation.node_cleanup.interval = 10 - cluster_formation.node_cleanup.only_log_warning = false - cluster_partition_handling = autoheal - ## queue master locator - queue_master_locator=min-masters - ## enable guest user - loopback_users.guest = false diff --git a/tools/clusterdevel/roles/minishift/templates/hostdev.yml.j2 b/tools/clusterdevel/roles/minishift/templates/hostdev.yml.j2 deleted file mode 100644 index 77e5ec593f..0000000000 --- a/tools/clusterdevel/roles/minishift/templates/hostdev.yml.j2 +++ /dev/null @@ -1,178 +0,0 @@ ---- -apiVersion: apps/v1beta1 # for versions before 1.9.0 use apps/v1beta2 -kind: Deployment -metadata: - name: awx - namespace: {{ awx_dev_project }} -spec: - replicas: 1 - template: - metadata: - labels: - name: awx - app: rabbitmq - spec: - serviceAccountName: awx - containers: - - image: ansible/awx-dev:latest - name: awx - command: ["/awx_devel/tools/clusterdevel/bootstrap_minishift.sh"] - securityContext: - privileged: true - volumeMounts: - - name: localdev - mountPath: /awx_devel - - name: awx-application-config - mountPath: /etc/tower - - name: awx-rabbit - image: ansible/awx_rabbitmq:latest - imagePullPolicy: Always - ports: - - name: http - protocol: TCP - containerPort: 15672 - - name: amqp - protocol: TCP - containerPort: 5672 - livenessProbe: - exec: - command: ["rabbitmqctl", "status"] - initialDelaySeconds: 30 - timeoutSeconds: 10 - readinessProbe: - exec: - command: ["rabbitmqctl", "status"] - initialDelaySeconds: 10 - timeoutSeconds: 10 - env: - # For consupmption by rabbitmq-env.conf - - name: MY_POD_IP - valueFrom: - fieldRef: - fieldPath: status.podIP - - name: RABBITMQ_USE_LONGNAME - value: "true" - - name: RABBITMQ_NODENAME - value: "rabbit@$(MY_POD_IP)" - - name: K8S_SERVICE_NAME - value: "rabbitmq" - - name: RABBITMQ_ERLANG_COOKIE - value: "cookiemonster" - volumeMounts: - - name: rabbitmq-config - mountPath: /etc/rabbitmq - - name: awx-memcached - image: memcached - - name: postgres - image: postgres:10 - volumes: - - name: localdev - persistentVolumeClaim: - claimName: devtest - - name: awx-application-config - configMap: - name: awx-dev-config - items: - - key: awx_settings - path: settings.py - - key: secret_key - path: SECRET_KEY - - name: rabbitmq-config - configMap: - name: rabbitmq-config - items: - - key: rabbitmq.conf - path: rabbitmq.conf - - key: enabled_plugins - path: enabled_plugins ---- -apiVersion: v1 -kind: Service -metadata: - name: awx-web-svc - namespace: {{ awx_dev_project }} - labels: - name: awx-web-svc -spec: - type: "NodePort" - ports: - - name: https - port: 8043 - - name: http - port: 8013 - - name: notsure - port: 8080 - selector: - name: awx ---- -kind: Service -apiVersion: v1 -metadata: - namespace: {{ awx_dev_project }} - name: rabbitmq - labels: - app: rabbitmq - type: LoadBalancer -spec: - type: NodePort - ports: - - name: http - protocol: TCP - port: 15672 - targetPort: 15672 - - name: amqp - protocol: TCP - port: 5672 - targetPort: 5672 - selector: - app: rabbitmq ---- -apiVersion: v1 -kind: Service -metadata: - name: awx-rmq-mgmt - namespace: {{ awx_dev_project }} - labels: - name: awx-rmq-mgmt -spec: - type: ClusterIP - ports: - - name: rmqmgmt - port: 15672 - targetPort: 15672 - selector: - name: awx ---- -apiVersion: v1 -kind: Route -metadata: - name: awx-web-svc - namespace: {{ awx_dev_project }} -spec: - port: - targetPort: http - tls: - insecureEdgeTerminationPolicy: Allow - termination: edge - to: - kind: Service - name: awx-web-svc - weight: 100 - wildcardPolicy: None ---- -apiVersion: v1 -kind: Route -metadata: - name: awx-rmq-mgmt - namespace: {{ awx_dev_project }} -spec: - port: - targetPort: rmqmgmt - tls: - insecureEdgeTerminationPolicy: Allow - termination: edge - to: - kind: Service - name: rabbitmq - weight: 100 - wildcardPolicy: None diff --git a/tools/clusterdevel/roles/minishift/templates/hostfolderpvc.yml.j2 b/tools/clusterdevel/roles/minishift/templates/hostfolderpvc.yml.j2 deleted file mode 100644 index 2a04793717..0000000000 --- a/tools/clusterdevel/roles/minishift/templates/hostfolderpvc.yml.j2 +++ /dev/null @@ -1,15 +0,0 @@ -apiVersion: v1 -kind: PersistentVolume -metadata: - name: projdata - namespace: {{ awx_dev_project }} - labels: - project: awx -spec: - capacity: - storage: 10Gi - accessModes: - - ReadWriteMany - persistentVolumeReclaimPolicy: Retain - hostPath: - path: /mnt/sda1/awx diff --git a/tools/clusterdevel/roles/minishift/templates/serviceacct.yml.j2 b/tools/clusterdevel/roles/minishift/templates/serviceacct.yml.j2 deleted file mode 100644 index fd6fe9c9c0..0000000000 --- a/tools/clusterdevel/roles/minishift/templates/serviceacct.yml.j2 +++ /dev/null @@ -1,31 +0,0 @@ ---- -apiVersion: v1 -kind: ServiceAccount -metadata: - name: awx - namespace: {{ awx_dev_project }} ---- -kind: Role -apiVersion: v1 -metadata: - name: endpoint-reader - namespace: {{ awx_dev_project }} -rules: - - apiGroups: [""] - resources: ["endpoints"] - verbs: ["get"] ---- -kind: RoleBinding -apiVersion: v1 -metadata: - name: endpoint-reader - namespace: {{ awx_dev_project }} -roleRef: - name: endpoint-reader - namespace: {{ awx_dev_project }} -subjects: - - kind: ServiceAccount - name: awx - namespace: {{ awx_dev_project }} -userNames: - - system:serviceaccount:{{ awx_dev_project }}:awx diff --git a/tools/clusterdevel/roles/minishift/templates/volumeclaim.yml.j2 b/tools/clusterdevel/roles/minishift/templates/volumeclaim.yml.j2 deleted file mode 100644 index a2fe3634f6..0000000000 --- a/tools/clusterdevel/roles/minishift/templates/volumeclaim.yml.j2 +++ /dev/null @@ -1,15 +0,0 @@ ---- -apiVersion: v1 -kind: PersistentVolumeClaim -metadata: - name: devtest - namespace: {{ awx_dev_project }} -spec: - accessModes: - - ReadWriteMany - resources: - requests: - storage: 10Gi - selector: - matchLabels: - project: awx diff --git a/tools/clusterdevel/start_minishift_dev.yml b/tools/clusterdevel/start_minishift_dev.yml deleted file mode 100644 index cb9e62d579..0000000000 --- a/tools/clusterdevel/start_minishift_dev.yml +++ /dev/null @@ -1,11 +0,0 @@ ---- -- name: Setup minishift dev environment - hosts: localhost - gather_facts: false - vars: - - ansible_connection: local - - awx_dev_project: awx - - awx_task_cpu_request: 500 - - awx_task_mem_request: 512 - roles: - - {role: minishift}