Skip to content

Commit d1b023c

Browse files
committed
Adapt sameersbn role to meet StackHPC requirements
1 parent 924b085 commit d1b023c

4 files changed

Lines changed: 106 additions & 24 deletions

File tree

Dockerfile

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,21 @@
1-
FROM ubuntu:bionic-20190612
2-
LABEL maintainer="sameer@damagehead.com"
1+
FROM centos:centos7
2+
MAINTAINER StackHPC
33

4-
ENV SQUID_VERSION=3.5.27 \
4+
ENV SQUID_VERSION=3.5.20 \
55
SQUID_CACHE_DIR=/var/spool/squid \
66
SQUID_LOG_DIR=/var/log/squid \
7-
SQUID_USER=proxy
7+
SQUID_USER=squid
88

9-
RUN apt-get update \
10-
&& DEBIAN_FRONTEND=noninteractive apt-get install -y squid=${SQUID_VERSION}* \
11-
&& rm -rf /var/lib/apt/lists/*
9+
RUN yum install -y \
10+
which \
11+
squid-${SQUID_VERSION}
12+
13+
COPY squid.conf /etc/squid/squid.conf
14+
RUN chown root.squid /etc/squid/squid.conf
15+
RUN chmod 0640 /etc/squid/squid.conf
1216

1317
COPY entrypoint.sh /sbin/entrypoint.sh
14-
RUN chmod 755 /sbin/entrypoint.sh
18+
RUN chmod 0755 /sbin/entrypoint.sh
1519

1620
EXPOSE 3128/tcp
1721
ENTRYPOINT ["/sbin/entrypoint.sh"]

README.md

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
[![Circle CI](https://circleci.com/gh/sameersbn/docker-squid.svg?style=shield)](https://circleci.com/gh/sameersbn/docker-squid) [![Docker Repository on Quay.io](https://quay.io/repository/sameersbn/squid/status "Docker Repository on Quay.io")](https://quay.io/repository/sameersbn/squid)
2-
3-
# sameersbn/squid:3.5.27-2
1+
# stackhpc/squid:3.5.20
42

53
- [Introduction](#introduction)
64
- [Contributing](#contributing)
@@ -23,13 +21,20 @@
2321

2422
Squid is a caching proxy for the Web supporting HTTP, HTTPS, FTP, and more. It reduces bandwidth and improves response times by caching and reusing frequently-requested web pages. Squid has extensive access controls and makes a great server accelerator.
2523

24+
Based on the Squid container by [sameersbn](https://github.com/sameersbn/docker-squid), with some changes:
25+
26+
- Based on CentOS base image and packages
27+
- Uses a disk cache (4 GB) in `/var/spool/squid`
28+
- Configures for logging to files under `/var/log/squid`
29+
- Raises the RAM cache to 768 MB (default is 256 MB)
30+
- Raises the maximum object size to 16 MB (default is 512 KB)
31+
2632
## Contributing
2733

2834
If you find this image useful here's how you can help:
2935

3036
- Send a pull request with your awesome features and bug fixes
3137
- Help users resolve their [issues](../../issues?q=is%3Aopen+is%3Aissue).
32-
- Support the development of this image with a [donation](http://www.damagehead.com/donate/)
3338

3439
## Issues
3540

@@ -47,18 +52,14 @@ If the above recommendations do not help then [report your issue](../../issues/n
4752

4853
## Installation
4954

50-
Automated builds of the image are available on [Dockerhub](https://hub.docker.com/r/sameersbn/squid) and is the recommended method of installation.
51-
52-
> **Note**: Builds are also available on [Quay.io](https://quay.io/repository/sameersbn/squid)
53-
5455
```bash
55-
docker pull sameersbn/squid:3.5.27-2
56+
docker pull stackhpc/squid:3.5.20-1
5657
```
5758

5859
Alternatively you can build the image yourself.
5960

6061
```bash
61-
docker build -t sameersbn/squid github.com/sameersbn/docker-squid
62+
docker build -t stackhpc/squid github.com/stackhpc/docker-squid
6263
```
6364

6465
## Quickstart
@@ -68,8 +69,9 @@ Start Squid using:
6869
```bash
6970
docker run --name squid -d --restart=always \
7071
--publish 3128:3128 \
72+
--volume /srv/docker/squid/log:/var/log/squid \
7173
--volume /srv/docker/squid/cache:/var/spool/squid \
72-
sameersbn/squid:3.5.27-2
74+
stackhpc/squid:3.5.20-1
7375
```
7476

7577
*Alternatively, you can use the sample [docker-compose.yml](docker-compose.yml) file to start the container using [Docker Compose](https://docs.docker.com/compose/)*
@@ -81,8 +83,9 @@ You can customize the launch command of the Squid server by specifying arguments
8183
```bash
8284
docker run --name squid -it --rm \
8385
--publish 3128:3128 \
86+
--volume /srv/docker/squid/log:/var/log/squid \
8487
--volume /srv/docker/squid/cache:/var/spool/squid \
85-
sameersbn/squid:3.5.27-2 -h
88+
stackhpc/squid:3.5.20-1 -h
8689
```
8790

8891
## Persistence
@@ -107,7 +110,7 @@ docker run --name squid -d --restart=always \
107110
--publish 3128:3128 \
108111
--volume /path/to/squid.conf:/etc/squid/squid.conf \
109112
--volume /srv/docker/squid/cache:/var/spool/squid \
110-
sameersbn/squid:3.5.27-2
113+
stackhpc/squid:3.5.20-1
111114
```
112115

113116
To reload the Squid configuration on a running instance you can send the `HUP` signal to the container.
@@ -155,7 +158,7 @@ To upgrade to newer releases:
155158
1. Download the updated Docker image:
156159

157160
```bash
158-
docker pull sameersbn/squid:3.5.27-2
161+
docker pull stackhpc/squid:3.5.20-1
159162
```
160163

161164
2. Stop the currently running image:
@@ -175,7 +178,7 @@ To upgrade to newer releases:
175178
```bash
176179
docker run -name squid -d \
177180
[OPTIONS] \
178-
sameersbn/squid:3.5.27-2
181+
stackhpc/squid:3.5.20-1
179182
```
180183

181184
## Shell Access

entrypoint.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ if [[ -z ${1} ]]; then
3131
$(which squid) -N -f /etc/squid/squid.conf -z
3232
fi
3333
echo "Starting squid..."
34-
exec $(which squid) -f /etc/squid/squid.conf -NYCd 1 ${EXTRA_ARGS}
34+
exec $(which squid) -f /etc/squid/squid.conf -NYC ${EXTRA_ARGS}
3535
else
3636
exec "$@"
3737
fi

squid.conf

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
#
2+
# Recommended minimum configuration:
3+
#
4+
5+
# Example rule allowing access from your local networks.
6+
# Adapt to list your (internal) IP networks from where browsing
7+
# should be allowed
8+
acl localnet src 10.0.0.0/8 # RFC1918 possible internal network
9+
acl localnet src 172.16.0.0/12 # RFC1918 possible internal network
10+
acl localnet src 192.168.0.0/16 # RFC1918 possible internal network
11+
acl localnet src fc00::/7 # RFC 4193 local private network range
12+
acl localnet src fe80::/10 # RFC 4291 link-local (directly plugged) machines
13+
14+
acl SSL_ports port 443
15+
acl Safe_ports port 80 # http
16+
acl Safe_ports port 21 # ftp
17+
acl Safe_ports port 443 # https
18+
acl Safe_ports port 70 # gopher
19+
acl Safe_ports port 210 # wais
20+
acl Safe_ports port 1025-65535 # unregistered ports
21+
acl Safe_ports port 280 # http-mgmt
22+
acl Safe_ports port 488 # gss-http
23+
acl Safe_ports port 591 # filemaker
24+
acl Safe_ports port 777 # multiling http
25+
acl CONNECT method CONNECT
26+
27+
#
28+
# Recommended minimum Access Permission configuration:
29+
#
30+
# Deny requests to certain unsafe ports
31+
http_access deny !Safe_ports
32+
33+
# Deny CONNECT to other than secure SSL ports
34+
http_access deny CONNECT !SSL_ports
35+
36+
# Only allow cachemgr access from localhost
37+
http_access allow localhost manager
38+
http_access deny manager
39+
40+
# We strongly recommend the following be uncommented to protect innocent
41+
# web applications running on the proxy server who think the only
42+
# one who can access services on "localhost" is a local user
43+
#http_access deny to_localhost
44+
45+
#
46+
# INSERT YOUR OWN RULE(S) HERE TO ALLOW ACCESS FROM YOUR CLIENTS
47+
#
48+
49+
# Example rule allowing access from your local networks.
50+
# Adapt localnet in the ACL section to list your (internal) IP networks
51+
# from where browsing should be allowed
52+
http_access allow localnet
53+
http_access allow localhost
54+
55+
# And finally deny all other access to this proxy
56+
http_access deny all
57+
58+
# Squid normally listens to port 3128
59+
http_port 3128
60+
61+
# Uncomment and adjust the following to add a disk cache directory.
62+
cache_dir ufs /var/spool/squid 4096 16 256
63+
cache_mem 768 MB
64+
maximum_object_size_in_memory 32 MB
65+
66+
# Leave coredumps in the first cache dir
67+
coredump_dir /var/spool/squid
68+
69+
#
70+
# Add any of your own refresh_pattern entries above these.
71+
#
72+
refresh_pattern ^ftp: 1440 20% 10080
73+
refresh_pattern ^gopher: 1440 0% 1440
74+
refresh_pattern -i (/cgi-bin/|\?) 0 0% 0
75+
refresh_pattern . 0 20% 4320

0 commit comments

Comments
 (0)