pypiserver: drop pypi server

It is no longer needed because of how we are using python_venv_build
at the moment, so let's remove it.

Depends-On: https://review.openstack.org/648477
Change-Id: I56531388fb49a8c3d098fd762392299742b0e120
This commit is contained in:
Mohammed Naser 2019-03-28 18:51:25 -04:00 committed by Jesse Pretorius
parent e54506eb67
commit 44547c7b7b
9 changed files with 16 additions and 171 deletions

View File

@ -42,38 +42,9 @@ repo_recreate_keys: False
# Main web server port
repo_server_port: 8181
# Pypi Server port
repo_pypiserver_port: 8280
# Set the git file paths
repo_git_cache_dirname: openstackgit
repo_git_cache_dir: "{{ repo_service_home_folder }}/repo/{{ repo_git_cache_dirname }}"
# Set the log directory
repo_service_log_dir: /var/log/apt-cacher-ng
# Set the list of packages for the pypiserver
repo_pypiserver_pip_packages:
- "pypiserver[cache]==1.2.0"
# Set the path to place all built python wheels
# This is used by pypiserver to serve them
repo_pypiserver_package_path: "{{ repo_service_home_folder }}/repo/pools"
# Path to the pypiserver python virtualenv binaries
repo_pypiserver_bin: "/openstack/venvs/pypiserver-1.2.0/bin"
# Path to the pypiserver working directory
repo_pypiserver_working_dir: "{{ repo_service_home_folder }}/pypiserver"
# pypiserver service start options
repo_pypiserver_start_options: >-
-i localhost
-p {{ repo_pypiserver_port }}
--log-file /var/log/pypiserver/pypiserver.log
--disable-fallback
{{ (debug | bool) | ternary('-vv', '-v') }}
{{ repo_pypiserver_package_path }}
# config override var for systemd init file
repo_pypiserver_init_overrides: {}
repo_service_log_dir: /var/log/apt-cacher-ng

View File

@ -68,17 +68,6 @@
retries: 5
delay: 2
- name: reload pypiserver
service:
name: "pypiserver"
enabled: yes
state: restarted
daemon_reload: "{{ (ansible_service_mgr == 'systemd') | ternary('yes', omit) }}"
register: _restart
until: _restart is success
retries: 5
delay: 2
# TODO(odyssey4me):
# Remove these tasks in T. They are only present for the
# Q->R upgrade or for R->S upgrades for environments which

View File

@ -0,0 +1,13 @@
---
upgrade:
- |
The repo server no longer uses pypiserver, so it has been removed.
Along with this, the following variables have also been removed.
* ``repo_pypiserver_port``
* ``repo_pypiserver_pip_packages``
* ``repo_pypiserver_package_path``
* ``repo_pypiserver_bin``
* ``repo_pypiserver_working_dir``
* ``repo_pypiserver_start_options``
* ``repo_pypiserver_init_overrides``

View File

@ -76,63 +76,4 @@
src: "rsync.defaults"
dest: "/etc/default/rsync"
notify:
- reload rsyncd
# TODO(odyssey4me):
# The following two tasks only applies to Pike->Queens upgrades,
# so they can be removed in Rocky. See:
# https://bugs.launchpad.net/openstack-ansible/+bug/1746935
- name: List the current virtualenv_support folders in dist/site-packages
find:
file_type: any
patterns: "virtualenv_support"
paths:
- "/usr/local/lib/python2.7/dist-packages"
- "/usr/local/lib/python2.7/site-packages"
register: _virtualenv_support
- name: Create the virtualenv (if it does not exist)
command: "virtualenv --never-download --no-site-packages {{ repo_pypiserver_bin | dirname }}"
args:
creates: "{{ repo_pypiserver_bin }}/activate"
# Note(odyssey4me):
# To cater for a situation where the pip packages are changing, but the repo
# does not yet have the package built, we need to ensure that this task can
# fetch from pypi. To do this we try the local repo first, then fall back to
# using pypi.
- name: Try installing from the repo first, then fall back to using pypi
block:
- name: Install pip packages (from repo)
pip:
name: "{{ repo_pypiserver_pip_packages }}"
state: "{{ repo_server_pip_package_state }}"
virtualenv: "{{ repo_pypiserver_bin | dirname }}"
virtualenv_site_packages: "no"
extra_args: >-
{{ (pip_install_upper_constraints is defined) | ternary('--constraint ' + pip_install_upper_constraints | default(''),'') }}
{{ pip_install_options | default('') }}
register: install_packages
until: install_packages is success
retries: 5
delay: 2
notify:
- reload pypiserver
rescue:
- name: Install pip packages (from pypi mirror)
pip:
name: "{{ repo_pypiserver_pip_packages }}"
state: "{{ repo_server_pip_package_state }}"
virtualenv: "{{ repo_pypiserver_bin | dirname }}"
virtualenv_site_packages: "no"
extra_args: >-
--index-url {{ repo_build_pip_default_index | default('https://pypi.python.org/simple') }}
--trusted-host {{ (repo_build_pip_default_index | default('https://pypi.python.org/simple')) | netloc_no_port }}
{{ (pip_install_upper_constraints is defined) | ternary('--constraint ' + pip_install_upper_constraints | default(''),'') }}
{{ pip_install_options | default('') }}
register: install_packages
until: install_packages is success
retries: 5
delay: 2
notify:
- reload pypiserver
- reload rsyncd

View File

@ -53,8 +53,6 @@
dest: "/etc/rsyncd.conf"
- src: "openstack-slushee.vhost.j2"
dest: "/etc/nginx/sites-available/openstack-slushee.vhost"
- src: "nginx-pypi.conf.j2"
dest: "/etc/nginx/conf.d/pypi.conf"
notify:
- reload nginx
@ -79,16 +77,4 @@
- src: "git.socket.j2"
dest: "{{ systemd_utils_prefix }}/system/git.socket"
notify:
- reload git socket
- name: Place the pypiserver systemd init script
config_template:
src: "pypiserver-systemd-init.j2"
dest: "/etc/systemd/system/pypiserver.service"
mode: "0644"
owner: "root"
group: "root"
config_overrides: "{{ repo_pypiserver_init_overrides }}"
config_type: "ini"
notify:
- reload pypiserver
- reload git socket

View File

@ -49,10 +49,6 @@
- path: "/var/lib/nginx"
- path: "/var/log/nginx"
mode: "0775"
- path: "/var/log/pypiserver"
mode: "0775"
- path: "{{ repo_pypiserver_working_dir }}"
mode: "0775"
- name: Drop repo pre/post command script
template:

View File

@ -1,5 +0,0 @@
# {{ ansible_managed }}
upstream pypiserver {
server localhost:{{ repo_pypiserver_port }};
}

View File

@ -6,20 +6,6 @@ server {
access_log /var/log/nginx/{{ repo_server_name }}.access.log gzip buffer=32k;
error_log /var/log/nginx/{{ repo_server_name }}.error.log notice;
location /simple {
proxy_set_header Host $host:$server_port;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_pass http://pypiserver;
}
location /packages {
proxy_set_header Host $host:$server_port;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_pass http://pypiserver;
}
location / {
root {{ repo_service_home_folder }}/repo/;
autoindex on;

View File

@ -1,32 +0,0 @@
# {{ ansible_managed }}
[Unit]
Description=pypiserver
After=network.target
[Service]
Type=simple
User={{ repo_service_user_name }}
Group={{ repo_service_group_name }}
ExecStart={{ repo_pypiserver_bin }}/pypi-server {{ repo_pypiserver_start_options }}
ExecStop=/bin/kill -TERM $MAINPID
WorkingDirectory={{ repo_pypiserver_working_dir }}
# Give a reasonable amount of time for the server to start up/shut down
TimeoutSec=120
TimeoutStartSec=3
Restart=on-failure
RestartSec=2
# This creates a specific slice which all services will operate from
# The accounting options give us the ability to see resource usage through
# the `systemd-cgtop` command.
Slice=pypiserver.slice
CPUAccounting=true
BlockIOAccounting=true
MemoryAccounting=false
TasksAccounting=true
[Install]
WantedBy=multi-user.target