Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement pypiserver and pypi proxy cache
This patch implements nginx as a reverse proxy for python packages. The initial query will be to a local deployment of pypiserver in order to serve any locally built packages, but if the package is not available locally it will retry the query against pypi and cache the response. Depends-On: Id20a43fed833d53ca0f147f517deafba6587352d Change-Id: Ic4fd64f4dc82121a65088f3d7f4ae53f373df608 Implements: blueprint python-build-install-simplification Signed-off-by: Jesse Pretorius <jesse.pretorius@rackspace.co.uk>
- Loading branch information
Jesse Pretorius
committed
Nov 24, 2017
1 parent
956a942
commit 6320c00
Showing
10 changed files
with
194 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,3 +38,4 @@ dependencies: | |
- role: apt_package_pinning | ||
when: | ||
- ansible_pkg_mgr == 'apt' | ||
- role: pip_install |
8 changes: 8 additions & 0 deletions
8
releasenotes/notes/pypiserver-pypi-cache-216e9e087f6d3f24.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
features: | ||
- | | ||
The repo server now implements nginx as a reverse proxy for python | ||
packages sourced from pypi. The initial query will be to a local | ||
deployment of pypiserver in order to serve any locally built packages, | ||
but if the package is not available locally it will retry | ||
the query against pypi and cache the response. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# {{ ansible_managed }} | ||
|
||
proxy_cache_path {{ repo_nginx_proxy_cache_path }}; | ||
|
||
upstream pypiserver { | ||
server localhost:8080; | ||
} | ||
|
||
upstream pypi { | ||
server pypi.python.org:443; | ||
keepalive 16; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# {{ 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 |