Skip to content
This repository has been archived by the owner on Dec 7, 2022. It is now read-only.

Switches dev env to qpid #108

Merged
merged 1 commit into from Jan 19, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Switches dev env to qpid
Adds a new role called kombu_fixup which provides a source install of
qpid-tools and kombu.

Also adds a commented example line to switch the environment back to
rabbitmq. See the change in Vagrantfile.example.

I tested the resulting environment against the pulp_file sync commands,
and it ran as expected with both brokers.

closes #2259
  • Loading branch information
Brian Bouterse committed Jan 19, 2018
commit 27638cd52f4c97e9c729eb476e747854508c5bc5
3 changes: 3 additions & 0 deletions .gitignore
Expand Up @@ -94,3 +94,6 @@ Vagrantfile*
.vagrant
.dnf-cache
ansible/*.retry

# PyCharm
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

vim > pycharm 😄

.idea/
6 changes: 4 additions & 2 deletions Vagrantfile.example
Expand Up @@ -27,7 +27,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# to browse that repository a bit to find the latest successful Vagrant image. For example, at the
# time of this writing, I could set this setting like this for the latest F24 image:
# config.vm.box = "https://kojipkgs.fedoraproject.org/compose/rawhide/latest-Fedora-Rawhide/compose/CloudImages/x86_64/images/<imagename>.vagrant-libvirt.box"
config.vm.box = "fedora/25-cloud-base"
config.vm.box = "fedora/27-cloud-base"

# Comment out if you don't want Vagrant to add and remove entries from /etc/hosts for each VM.
# requires the vagrant-hostmanager plugin to be installed
Expand All @@ -37,8 +37,10 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
end

config.vm.provision "ansible" do |ansible|
# ansible.verbose = "vvv"
ansible.playbook = "ansible/pulp-from-source.yml"
# ansible.verbose = "vvv"
# ansible.start_at_task = "ansible task name here"
# ansible.extra_vars = { use_rabbitmq: true }
end

# Create the "pulp3_dev" box
Expand Down
1 change: 1 addition & 0 deletions ansible/pulp-from-source.yml
Expand Up @@ -8,6 +8,7 @@
become: true
vars:
pulp_user: vagrant
use_rabbitmq: False
pre_tasks:
# Developers want to know if Pulp works with the latest packages.
- name: Upgrade all currently installed packages
Expand Down
18 changes: 16 additions & 2 deletions ansible/roles/broker/tasks/main.yml
@@ -1,9 +1,23 @@
- name: Install packages
- name: Install Qpid packages
package: name={{ item }} state=present
with_items:
- qpid-cpp-server
when: use_rabbitmq == False

- name: Start and enable Qpid services
service: name={{ item }} state=started enabled=yes
with_items:
- qpidd
when: use_rabbitmq == False

- name: Install rabbitmq packages
package: name={{ item }} state=present
with_items:
- rabbitmq-server
when: use_rabbitmq == True

- name: Start and enable services
- name: Start and enable rabbitmq services
service: name={{ item }} state=started enabled=yes
with_items:
- rabbitmq-server
when: use_rabbitmq == True
15 changes: 14 additions & 1 deletion ansible/roles/dev/tasks/main.yml
Expand Up @@ -101,7 +101,16 @@
block: |
# Pulp Development Configuration
DEBUG: True
SECRET_KEY: {{ random_secret.stdout | to_nice_yaml }}
SECRET_KEY: "{{ random_secret.stdout }}"

- name: Add Qpid broker settings override in server.yaml
blockinfile:
path: "/etc/pulp/server.yaml"
marker: "# {mark} QPID SETTINGS OVERRIDE BLOCK"
block: |
broker:
url: qpid://localhost/
when: use_rabbitmq == False

- name: Create /var/lib/pulp directory
file:
Expand All @@ -121,3 +130,7 @@

- include: roles/django_db/tasks/makemigrations.yml app_label=pulp_app
- include: roles/django_db/tasks/reset.yml

- include_role:
name: kombu_fixup
when: use_rabbitmq == False
38 changes: 38 additions & 0 deletions ansible/roles/kombu_fixup/tasks/main.yml
@@ -0,0 +1,38 @@
- name: "Uninstall the Kombu we received from PyPI"
pip:
state: absent
name: kombu
virtualenv: "{{ pulp_venv }}"
virtualenv_command: /usr/bin/python3 -m venv

- name: "Install kombu from source"
pip:
name: "git+https://github.com/bmbouter/kombu.git@624-convert-qpid-to-amqp-1.0#egg=kombu"
extra_args: "-e"
virtualenv: "{{ pulp_venv }}"
virtualenv_command: /usr/bin/python3 -m venv

- name: "Install system packages proton needs"
package: name={{ item }} state=present
with_items:
- qpid-tools # on system to provide 'qpid-stat' command
- python-qpid-proton # a required dependency of kombu
- python3-devel # allows for compilation during pip installs
- gcc # allows for compilation during pip installs

- name: "clone the patched qpid-tools"
git:
repo: 'https://github.com/bmbouter/qpid-cpp'
dest: /tmp/qpid-cpp
version: qpid-for-pulp

- name: "Install qpid-tools from source"
command: "{{ pulp_venv }}/bin/python3 setup.py install"
args:
chdir: "/tmp/qpid-cpp/management/python"

- name: "Install python-qpid-proton from PyPI"
pip:
name: "python-qpid-proton"
virtualenv: "{{ pulp_venv }}"
virtualenv_command: /usr/bin/python3 -m venv