Skip to content

Commit 8fe4bab

Browse files
committed
add support for default eessi proxy config to squid role
1 parent 7d505f4 commit 8fe4bab

File tree

3 files changed

+64
-5
lines changed

3 files changed

+64
-5
lines changed

ansible/roles/squid/README.md

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,30 @@
22

33
Deploy a caching proxy.
44

5-
**NB:** The default configuration is aimed at providing a proxy for package installs etc. for
6-
nodes which do not have direct internet connectivity. It assumes access to the proxy is protected
7-
by the OpenStack security groups applied to the cluster. The generated configuration should be
8-
reviewed if this is not case.
5+
**NB:** This role provides two default configurations, selected by setting
6+
`squid_conf_template`:
7+
- `squid.conf.j2`: This is aimed at providing a proxy for package installs etc.
8+
for nodes which do not have direct internet connectivity. It assumes access
9+
to the proxy is protected by the OpenStack security groups applied to the
10+
cluster. The generated configuration should be reviewed if this is not case.
11+
- `squid-eessi.conf.j2`: This provides a proxy server for EESSI clients. It uses
12+
the [recommended configuration](https://www.eessi.io/docs/tutorial/access/proxy/#configuration)
13+
which assumes a server with:
14+
- 10Gbit link or faster to the client systems
15+
- a sufficiently powerful CPU
16+
- a decent amount of memory for the kernel cache (tens of GBs)
17+
- fast local storage - 50GB is used for cache
18+
For this use-case the above link recommends at least two squid servers and at
19+
least one for every (100-500) client nodes.
920

1021
## Role Variables
22+
- `squid_conf_template`: Optional str. Path (using Ansible search paths) to
23+
squid.conf template. Default is in-role `squid.conf.j2` template as above.
24+
25+
### Role Variables for squid_conf_template=squid.conf.j2
1126

1227
Where noted these map to squid parameters of the same name without the `squid_` prefix - see [squid documentation](https://www.squid-cache.org/Doc/config) for details.
1328

14-
- `squid_conf_template`: Optional str. Path (using Ansible search paths) to squid.conf template. Default is in-role template.
1529
- `squid_started`: Optional bool. Whether to start squid service. Default `true`.
1630
- `squid_enabled`: Optional bool. Whether squid service is enabled on boot. Default `true`.
1731
- `squid_cache_mem`: Required str. Size of memory cache, e.g "1024 KB", "12 GB" etc. See squid parameter.
@@ -37,3 +51,12 @@ Where noted these map to squid parameters of the same name without the `squid_`
3751
http_access deny all
3852

3953
See squid parameter.
54+
55+
### Role Variables for squid_conf_template=squid-eessi.conf.j2
56+
57+
- `squid_eessi_clients`: Optional string. CIDR specifying clients allowed to
58+
access this proxy. The default is to use the CIDR of the host's default IPv4
59+
interface, which should allow access from the [cluster network](../../../docs/networks.md).
60+
For clusters with multiple networks this may not be appropriate.
61+
- `squid_eessi_stratum_1`: Optional string. Domain (squid `acl dstdomain` format)
62+
of Stratum 1 replica servers. Default is the upstream EEESI Stratum 1 servers.

ansible/roles/squid/defaults/main.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
---
2+
## squid dnf configuration:
23
squid_conf_template: squid.conf.j2
34
squid_started: true
45
squid_enabled: true
@@ -23,3 +24,8 @@ squid_http_access: |
2324
http_access allow localhost
2425
# Finally deny all other access to this proxy
2526
http_access deny all
27+
28+
## squid eeesi configuration:
29+
#squid_conf_template: squid-eessi.conf.j2
30+
squid_eessi_clients: "{{ ansible_default_ipv4.network }}/{{ ansible_default_ipv4.prefix }}"
31+
squid_eessi_stratum_1: '.eessi.science'
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# From https://www.eessi.io/docs/tutorial/access/proxy/
2+
# List of local IP addresses (separate IPs and/or CIDR notation) allowed to access your local proxy
3+
acl local_nodes src {{ squid_eessi_clients }}
4+
5+
# Destination domains that are allowed
6+
# cern.ch + opensciencegrid.org domains because of cvmfs-config.cern.ch repository,
7+
# which are provided via Stratum-1 mirror servers hosted by CERN and OSG
8+
acl stratum_ones dstdomain .cern.ch .opensciencegrid.org {{ squid_eessi_stratum_1 }}
9+
10+
# Squid port
11+
http_port 3128
12+
13+
# Deny access to anything which is not part of our stratum_ones ACL.
14+
http_access deny !stratum_ones
15+
16+
# Only allow access from our local machines
17+
http_access allow local_nodes
18+
http_access allow localhost
19+
20+
# Finally, deny all other access to this proxy
21+
http_access deny all
22+
23+
minimum_expiry_time 0
24+
maximum_object_size 1024 MB
25+
26+
# proxy memory cache of 1GB
27+
cache_mem 1024 MB
28+
maximum_object_size_in_memory 128 KB
29+
# 50 GB disk cache
30+
cache_dir ufs {{ squid_cache_dir }} 50000 16 256

0 commit comments

Comments
 (0)