Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Vincent Bechu
slapos
Commits
fcdd29f6
Commit
fcdd29f6
authored
May 03, 2013
by
Cédric Le Ninivin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
squid: Add Squid Recipe from erp5-vifib (Romain C.)
parent
f2b48450
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
129 additions
and
0 deletions
+129
-0
setup.py
setup.py
+1
-0
slapos/recipe/squid/__init__.py
slapos/recipe/squid/__init__.py
+94
-0
slapos/recipe/squid/template/squid.conf.in
slapos/recipe/squid/template/squid.conf.in
+34
-0
No files found.
setup.py
View file @
fcdd29f6
...
@@ -191,6 +191,7 @@ setup(name=name,
...
@@ -191,6 +191,7 @@ setup(name=name,
'slaprunner.import = slapos.recipe.slaprunner.backup:ImportRecipe'
,
'slaprunner.import = slapos.recipe.slaprunner.backup:ImportRecipe'
,
'softwaretype = slapos.recipe.softwaretype:Recipe'
,
'softwaretype = slapos.recipe.softwaretype:Recipe'
,
'sphinx= slapos.recipe.sphinx:Recipe'
,
'sphinx= slapos.recipe.sphinx:Recipe'
,
'squid = slapos.recipe.squid:Recipe'
,
'sshkeys_authority = slapos.recipe.sshkeys_authority:Recipe'
,
'sshkeys_authority = slapos.recipe.sshkeys_authority:Recipe'
,
'sshkeys_authority.request = slapos.recipe.sshkeys_authority:Request'
,
'sshkeys_authority.request = slapos.recipe.sshkeys_authority:Request'
,
'stunnel = slapos.recipe.stunnel:Recipe'
,
'stunnel = slapos.recipe.stunnel:Recipe'
,
...
...
slapos/recipe/squid/__init__.py
0 → 100644
View file @
fcdd29f6
##############################################################################
#
# Copyright (c) 2012 Vifib SARL and Contributors. All Rights Reserved.
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsibility of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# guarantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 3
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
from
slapos.recipe.librecipe
import
GenericBaseRecipe
class
Recipe
(
GenericBaseRecipe
):
"""
squid instance configuration.
wrapper-path -- location of the init script to generate
prepare-path -- location of the directory creation script to generate
binary-path -- location of the squid command
conf-path -- location of the configuration file
cache-path -- location of the cache directory
ip -- ip of the squid server
port -- port of the squid server
backend-ip -- ip of the service to cache
backend-port -- port of the service to cache
access-log-path -- location of the access log
cache-log-path -- location of the cache log
pid-filename-path -- location of the pid filename
"""
def
install
(
self
):
config
=
dict
(
ip
=
self
.
options
[
'ip'
],
port
=
self
.
options
[
'port'
],
backend_ip
=
self
.
options
[
'backend-ip'
],
backend_port
=
self
.
options
[
'backend-port'
],
cache_path
=
self
.
options
[
'cache-path'
],
access_log_path
=
self
.
options
[
'access-log-path'
],
cache_log_path
=
self
.
options
[
'cache-log-path'
],
pid_filename_path
=
self
.
options
[
'pid-filename-path'
],
)
template_filename
=
self
.
getTemplateFilename
(
'squid.conf.in'
)
configuration_path
=
self
.
createFile
(
self
.
options
[
'conf-path'
],
self
.
substituteTemplate
(
template_filename
,
config
))
# Prepare directories
prepare_path
=
self
.
createPythonScript
(
self
.
options
[
'prepare-path'
],
'slapos.recipe.librecipe.execute.execute'
,
arguments
=
[
self
.
options
[
'binary-path'
].
strip
(),
'-z'
,
'-f'
,
configuration_path
,
],)
# Create running wrapper
wrapper_path
=
self
.
createPythonScript
(
self
.
options
[
'wrapper-path'
],
'slapos.recipe.librecipe.execute.execute'
,
arguments
=
[
self
.
options
[
'binary-path'
].
strip
(),
'-N'
,
'-f'
,
configuration_path
,
],)
return
[
configuration_path
,
wrapper_path
,
prepare_path
]
slapos/recipe/squid/template/squid.conf.in
0 → 100644
View file @
fcdd29f6
refresh_pattern . 0 20%% 4320 max-stale=604800
# Dissallow cachemgr access
http_access deny manager
# Squid service configuration
http_port %(ip)s:%(port)s accel defaultsite=%(ip)s
cache_peer %(backend_ip)s parent %(backend_port)s 0 no-query originserver name=backend
acl our_sites dstdomain %(ip)s
http_access allow our_sites
cache_peer_access backend allow our_sites
cache_peer_access backend deny all
# Drop squid headers
# via off
# reply_header_access X-Cache-Lookup deny all
# reply_header_access X-Squid-Error deny all
# reply_header_access X-Cache deny all
header_replace X-Forwarded-For
follow_x_forwarded_for allow all
forwarded_for on
# Use 1Go of RAM
cache_mem 1024 MB
# But do not keep big object in RAM
maximum_object_size_in_memory 2048 KB
# Log
access_log %(access_log_path)s
cache_log %(cache_log_path)s
pid_filename %(pid_filename_path)s
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment