Changeset - 686083d16102
[Not reviewed]
0 4 0
Branko Majic (branko) - 22 months ago 2024-02-10 21:22:35
branko@majic.rs
MAR-191: Drop support for Debian 11 Buster from the wsgi_website role:

- Get rid of the workaround that used to cause issues in some of the
previous versions of Debian while at it. This should no longer pose
an issue.
4 files changed with 1 insertions and 50 deletions:
0 comments (0 inline, 0 general)
docs/rolereference.rst
Show inline comments
 
@@ -1976,25 +1976,24 @@ Parameters
 
  List of top level packages to use when performing the pip
 
  requirements upgrade checks for the Gunicorn requirements (listed
 
  via ``wsgi_requirements`` parameter). For Python 3-based websites,
 
  it should be sufficient to list only ``gunicorn`` (``futures`` is
 
  required for Python 2).
 

	
 

	
 
Distribution compatibility
 
~~~~~~~~~~~~~~~~~~~~~~~~~~
 

	
 
Role is compatible with the following distributions:
 

	
 
- Debian 10 (Buster)
 
- Debian 11 (Bullseye)
 

	
 

	
 
Examples
 
~~~~~~~~
 

	
 
Here is an example configuration for setting-up a (base) WSGI website (for
 
running a bare Django project):
 

	
 
.. code-block:: yaml
 

	
 
    # Sample for a Django installation.
roles/wsgi_website/meta/main.yml
Show inline comments
 
@@ -5,14 +5,13 @@ allow_duplicates: true
 
dependencies:
 
  - common
 
  - web_server
 

	
 
galaxy_info:
 
  author: Branko Majic
 
  description: Sets-up a website powered by WSGI application
 
  license: BSD
 
  min_ansible_version: 2.9
 
  platforms:
 
    - name: Debian
 
      versions:
 
        - 10
 
        - 11
roles/wsgi_website/molecule/default/molecule.yml
Show inline comments
 
@@ -5,35 +5,24 @@ dependency: {}
 
driver:
 
  name: vagrant
 
  provider:
 
    name: virtualbox
 

	
 
lint:
 
  name: yamllint
 
  options:
 
    config-file: ../../.yamllint.yml
 

	
 
platforms:
 

	
 
  - name: wsgi-website-buster
 
    groups:
 
      - wsgi-website
 
      - parameters-mandatory
 
      - parameters-optional
 
    box: debian/contrib-buster64
 
    memory: 512
 
    cpus: 1
 
    provider_raw_config_args:
 
      - "customize ['modifyvm', :id, '--paravirtprovider', 'minimal']"
 

	
 
  - name: wsgi-website-bullseye
 
    groups:
 
      - wsgi-website
 
      - parameters-mandatory
 
      - parameters-optional
 
    box: debian/bullseye64
 
    memory: 512
 
    cpus: 1
 
    provider_raw_config_args:
 
      - "customize ['modifyvm', :id, '--paravirtprovider', 'minimal']"
 

	
 
provisioner:
roles/wsgi_website/tasks/main.yml
Show inline comments
 
@@ -97,67 +97,31 @@
 
  when: "current_python_version.rc == 0 and not current_python_version.stdout.startswith(python_version | string)"
 
  notify:
 
    - Restart WSGI services
 

	
 
- name: Create directory for storing the Python virtual environment
 
  file:
 
    path: "{{ home }}/virtualenv"
 
    state: directory
 
    owner: "{{ admin }}"
 
    group: "{{ user }}"
 
    mode: 02750
 

	
 
# @TODO: Get rid of this if possible in Debian Buster.
 
# Do not install setuptools when creating the virtual environment -
 
# otherwise it will also install Debian-specific pkg-resources
 
# package. The pkg-resources package can be removed, but this breaks
 
# the package downloading via pip.
 
#
 
# Install setuptools later on via separate pip invocation.
 
#
 
# The pkg-resources package is also annoying because it shows-up in
 
# the output of the pip freeze command, and also interferes with the
 
# virtual environment management using pip-tools.
 
#
 
# For more details, see:
 
#
 
# - https://github.com/pypa/pip/issues/4022
 
# - https://bugs.launchpad.net/ubuntu/+source/python-pip/+bug/1635463
 
# - https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=871790
 

	
 
- name: Create Python virtual environment
 
  command: '/usr/bin/virtualenv --no-setuptools --python "{{ python_interpreter }}" --prompt "({{ fqdn }})" "{{ home }}/virtualenv"'
 
  command: '/usr/bin/virtualenv --python "{{ python_interpreter }}" --prompt "({{ fqdn }})" "{{ home }}/virtualenv"'
 
  args:
 
    creates: "{{ home }}/virtualenv/bin/{{ python_interpreter | basename }}"
 
  become: true
 
  become_user: "{{ admin }}"
 

	
 
# @TODO: Park of the pkg-resources described above.
 
- name: Install setuptools in virtual environment
 
  pip:
 
    name:
 
      - "setuptools"
 
    virtualenv: "{{ home }}/virtualenv"
 
  become: true
 
  become_user: "{{ admin }}"
 

	
 
# @TODO: Park of the pkg-resources described above.
 
- name: Remove the pkg-resources package from virtual environment (see comments above for details)
 
  pip:
 
    name: pkg-resources
 
    virtualenv: "{{ home }}/virtualenv"
 
    state: absent
 
  become: true
 
  become_user: "{{ admin }}"
 

	
 
- name: Configure project directory for the Python virtual environment
 
  template:
 
    src: "venv_project.j2"
 
    dest: "{{ home }}/virtualenv/.project"
 
    owner: "{{ admin }}"
 
    group: "{{ user }}"
 
    mode: 0640
 

	
 
- name: Deploy virtualenv wrapper
 
  template:
 
    src: "venv_exec.j2"
 
    dest: "{{ home }}/virtualenv/bin/exec"
0 comments (0 inline, 0 general)