Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Serve planetpython.org via haproxy instead of direct #391

Merged
merged 6 commits into from
Jul 17, 2024
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions pillar/base/firewall/planet.sls
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{% include "networking.sls" %}

firewall:
frontend-planet:
port: 9000
source: *psf_internal_network
7 changes: 7 additions & 0 deletions pillar/base/haproxy.sls
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,13 @@ haproxy:
extra:
- http-request replace-header Host ^.*$ pythonsoftwarefoundation.applytojob.com

planet:
domains:
- planetpython.org
- www.planetpython.org
verify_host: planet.psf.io
check: "HEAD / HTTP/1.1\\r\\nHost:\\ planet.psf.io"

pypy-web:
domains:
- www.pypy.org
Expand Down
4 changes: 4 additions & 0 deletions pillar/base/tls.sls
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ tls:
roles:
- moin

planet.psf.io:
roles:
- planet

postgresql.psf.io:
roles:
- postgresql
Expand Down
772 changes: 420 additions & 352 deletions pillar/dev/secrets/tls/certs/loadbalancer.sls

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions pillar/dev/top.sls
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ base:
- match: nodegroup
- planet
- firewall.http
- firewall.planet

'salt-master':
- match: nodegroup
Expand Down
1 change: 1 addition & 0 deletions pillar/prod/top.sls
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ base:
- match: nodegroup
- planet
- firewall.http
- firewall.planet

'pypy-web':
- match: nodegroup
Expand Down
6 changes: 3 additions & 3 deletions salt/haproxy/config/haproxy.cfg.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@ listen tls:
bind :20007 ssl alpn h2,http/1.1 crt www.pycon.org.pem
bind :20008 ssl alpn h2,http/1.1 crt jython.org.pem
bind :20009 ssl alpn h2,http/1.1 crt pypy.org.pem
bind 0.0.0.0:443 ssl alpn h2,http/1.1 crt star.python.org.pem crt star.pypa.io.pem crt star.pyfound.org.pem crt speed.pypy.org.pem crt www.pycon.org.pem crt jython.org.pem crt pypy.org.pem crt salt-public.psf.io.pem
bind :::443 ssl alpn h2,http/1.1 crt star.python.org.pem crt star.pypa.io.pem crt star.pyfound.org.pem crt speed.pypy.org.pem crt www.pycon.org.pem crt jython.org.pem crt pypy.org.pem crt salt-public.psf.io.pem
bind :20010 ssl alpn h2,http/1.1 crt star.python.org.pem crt star.pypa.io.pem crt star.pyfound.org.pem crt speed.pypy.org.pem crt www.pycon.org.pem crt jython.org.pem crt pypy.org.pem crt salt-public.psf.io.pem
bind 0.0.0.0:443 ssl alpn h2,http/1.1 crt star.python.org.pem crt star.pypa.io.pem crt star.pyfound.org.pem crt speed.pypy.org.pem crt www.pycon.org.pem crt jython.org.pem crt pypy.org.pem crt salt-public.psf.io.pem crt planetpython.org
bind :::443 ssl alpn h2,http/1.1 crt star.python.org.pem crt star.pypa.io.pem crt star.pyfound.org.pem crt speed.pypy.org.pem crt www.pycon.org.pem crt jython.org.pem crt pypy.org.pem crt salt-public.psf.io.pem crt planetpython.org
bind :20010 ssl alpn h2,http/1.1 crt star.python.org.pem crt star.pypa.io.pem crt star.pyfound.org.pem crt speed.pypy.org.pem crt www.pycon.org.pem crt jython.org.pem crt pypy.org.pem crt salt-public.psf.io.pem crt planetpython.org

mode http

Expand Down
11 changes: 11 additions & 0 deletions salt/planet/config/nginx.planet.conf.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,17 @@ server {
root /srv/{{ site }}/;
}

server {
listen 9000 ssl;
server_name {{ site }};
error_log /var/log/nginx/{{ site }}.error.log;
access_log /var/log/nginx/{{ site }}.access.log;
ssl_certificate /etc/ssl/private/planet.psf.io.pem;
ssl_certificate_key /etc/ssl/private/planet.psf.io.pem;

root /srv/{{ site }}/;
}

{% for domain in info.get("subject_alternative_names", []) %}
server {
server_name {{ domain }};
Expand Down
13 changes: 13 additions & 0 deletions salt/planet/init.sls
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,19 @@ planet-user:
- require:
- file: /etc/nginx/sites.d/

/etc/consul.d/service-planet.json:
file.managed:
- source: salt://consul/etc/service.jinja
- template: jinja
- context:
name: planet
port: 9000
- user: root
- group: root
- mode: "0644"
- require:
- pkg: consul-pkgs

lego_bootstrap:
cmd.run:
- name: /usr/local/bin/lego -a --email="[email protected]" {% if pillar["dc"] == "vagrant" %}--server=https://salt-master.vagrant.psf.io:14000/dir{% endif %} --domains="{{ grains['fqdn'] }}" {%- for domain in pillar['planet']['subject_alternative_names'] %} --domains {{ domain }}{%- endfor %} --http --path /etc/lego --key-type ec256 run
Expand Down
Loading