Squid service-name macro one config and different ports

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Squid service-name macro one config and different ports

Peter Viskup
Want to run multiple instances of Squid4 on the same server with different ports and one configuration file.
Not sure whether (and how) the http_port and snmp_port options can be made as conditional options in squid.conf.
At the moment it looks like it is not possible.

The workaround can be to use separate configuration file for each instance (inst1.conf, inst2.cond) and include the "global" part of the configuration in both of them or separate files with the same global part.

Does somebody of you have other proposal?

Thank you.

Peter

_______________________________________________
squid-users mailing list
[hidden email]
http://lists.squid-cache.org/listinfo/squid-users
Reply | Threaded
Open this post in threaded view
|

Re: Squid service-name macro one config and different ports

Amos Jeffries
Administrator
On 02/02/18 23:42, Peter Viskup wrote:
> Want to run multiple instances of Squid4 on the same server with
> different ports and one configuration file.
> Not sure whether (and how) the http_port and snmp_port options can be
> made as conditional options in squid.conf.
> At the moment it looks like it is not possible.

"conditional" on what exactly?

When run properly as multi-tenant instances with the -n namespace
separation the Squid instances know nothing about each other. So there
is no possible way to configure "I am X not Y" conditions.


That said the namespace is provided as a config macro for a reason.
Which is to make it possible to do this:

squid.conf:
 ...
 include /etc/squid/${service_name}.conf
 ...

With the unique parts being in the per-service / instance config files.


Or you can do it the other way around, with -f parameters pointing each
instance at a unique master config file, each of which includes the
shared config file.

see <http://www.squid-cache.org/Versions/v3/3.5/RELEASENOTES.html#ss2.3>


Amos
_______________________________________________
squid-users mailing list
[hidden email]
http://lists.squid-cache.org/listinfo/squid-users
Reply | Threaded
Open this post in threaded view
|

Re: Squid service-name macro one config and different ports

Peter Viskup
On Fri, Feb 2, 2018 at 12:13 PM, Amos Jeffries <[hidden email]> wrote:

>
> On 02/02/18 23:42, Peter Viskup wrote:
> > Want to run multiple instances of Squid4 on the same server with
> > different ports and one configuration file.
> > Not sure whether (and how) the http_port and snmp_port options can be
> > made as conditional options in squid.conf.
> > At the moment it looks like it is not possible.
>
> "conditional" on what exactly?
>
> When run properly as multi-tenant instances with the -n namespace
> separation the Squid instances know nothing about each other. So there
> is no possible way to configure "I am X not Y" conditions.
>
>
> That said the namespace is provided as a config macro for a reason.
> Which is to make it possible to do this:
>
> squid.conf:
>  ...
>  include /etc/squid/${service_name}.conf
>  ...

This is exactly I was looking for.

This way I would be able to use one global config with service
specific includes.

Thank you.

Peter
_______________________________________________
squid-users mailing list
[hidden email]
http://lists.squid-cache.org/listinfo/squid-users
Reply | Threaded
Open this post in threaded view
|

Re: Squid service-name macro one config and different ports

Alex Rousskov
In reply to this post by Peter Viskup
On 02/02/2018 03:42 AM, Peter Viskup wrote:
> Want to run multiple instances of Squid4 on the same server with
> different ports and one configuration file.

Set the service name to the port number and use the ${service_name}
squid.conf macro.

Needless to say, if your configurations differ by more than port
numbers, then using ${service_name} in include directives, as suggested
by Amos, offers a lot more flexibility.

Alex.
_______________________________________________
squid-users mailing list
[hidden email]
http://lists.squid-cache.org/listinfo/squid-users