Difference between pages "Package:Monit" and "Package:Varnish"

From Funtoo
(Difference between pages)
Jump to: navigation, search
 
 
Line 1: Line 1:
 
{{Ebuild
 
{{Ebuild
|Summary=a utility for monitoring and managing daemons or similar programs running on a Unix system.
+
|Summary=Varnish is a state-of-the-art, high-performance HTTP accelerator
|CatPkg=app-admin/monit
+
|CatPkg=www-servers/varnish
 
|Maintainer=
 
|Maintainer=
 
}}
 
}}
[http://mmonit.com/monit/ Monit] is a utility for managing and monitoring processes, programs, files, directories and filesystems on a UNIX system.  
+
__TOC__
 +
'''Varnish''' is a webcache & http accelerator. Varnish will either serve cached content, or retireve content from the server, and cache it.  Varnish will reduce I/O pressure from webservers.
  
== Installation ==
+
==Install==
=== Emerge ===
+
===Emerge===
To install {{Package|app-admin/monit}}:
+
<console>###i## emerge monit</console>
+
  
== Configuration ==
+
Install {{Package|www-servers/varnish}}
Config file of monit resides in <tt>/etc/monitrc</tt>. And there is a item to specify a config directory. Uncomment if needed.
+
<console>###i## www-servers/varnish</console>
  
{{File|name=/etc/monitrc|desc=config dir|body=
+
==Configuration==
## It is possible to include additional configuration parts from other files or
+
## directories.
+
#
+
#  include /etc/monit.d/*
+
#
+
}}
+
  
=== Users ===
+
Configuration is controlled by /etc/varnish/default.vcl
Users added to the monit or users group will be able to manipulate monit through the web interface.
+
  
<console>###i## gpasswd -a $USER monit</console>
+
{{file|name=/etc/varnish/default.vcl|desc=varnish configuration file|body=
<console>###i## gpasswd -a $USER users</console>
+
# backend default {
 
+
#    .host = "127.0.0.1";
{{fancywarning|passwords can be streamed to monits web interface, disable it all together after it is setup}}
+
#     .port = "8080";
 
+
# }
{{fancyimportant|for security purposes change this entry}}
+
 
+
{{file|name=/etc/monitrc|desc=|body=
+
allow admin:monit}}
+
 
+
== Boot Services ==
+
=== inittab ===
+
{{fancynote|this is the preferred method to run monit}}
+
{{file|name=/etc/inittab|desc=auto restart monit in case of failure|body=
+
ca:12345:ctrlaltdel:/sbin/shutdown -r now
+
 
+
# Run monit in standard runlevels
+
mo:2345:respawn:/usr/bin/monit -Ic /etc/monitrc
+
 
+
# Used by /etc/init.d/xdm to control DM startup.
+
 
}}
 
}}
  
to start monit immediately after changing inittab
+
Any traffic pointed at port 8080 will be through varnish.
  
<console>###i## telinit q</console>
+
== BootService ==
  
=== OpenRC ===
+
To start varnish immediately:
{{fancynote|prefer inittab method over rc services}}
+
<console>###i## rc-service varnishd start</console>
To start the service at boot.
+
<console>###i## rc-update add monit default</console>
+
To start the service immediately.
+
<console>###i## /etc/init.d/monit start</console>
+
  
==== Monitoring Monit ====
+
To start varnish at boot:
This hourly cron script will check to make sure monit has not crashed.  As this uses pgrep, make sure to not name it monit.
+
<console>###i## rc-update add varnishd default</console>
 
+
{{file|name=/etc/cron.hourly/moncheck|desc=|body=
+
#!/bin/bash
+
if ! pgrep monit >/dev/null;then
+
rc-service monit restart
+
fi
+
}}
+
 
+
== Pidfile Check ==
+
Monit relies upon pid files. For daemons that do not create a pidfile: a [http://mmonit.com/wiki/Monit/FAQ#pidfile work around] is needed.
+
 
+
== Examples ==
+
=== Auto Restart Mysql ===
+
{{file|name=/etc/monitrc|desc=auto restart mysql|body=
+
check process mysql with pidfile /var/run/mysqld/mysqld.pid
+
    start program = "/bin/bash -c 'rc-service mysql start'"
+
    stop program  = "/bin/bash -c 'rc-service mysql stop'"
+
}}
+
  
== Web Interface ==
+
== Verification ==
 +
To verify that your traffic is going through varnish.
 +
<console>$##i## curl -I https://www.varnish-cache.org/</console>
  
Navigate to http://localhost:2812/ & login using your edited configuration line or admin / monit if you have not changed it yet.
+
[[Category:Server]]
 +
[[Category:Daemons]]
  
[[Category:Monitoring]]
 
 
{{EbuildFooter}}
 
{{EbuildFooter}}

Revision as of 06:38, 27 June 2014

www-servers/varnish


Source Repository:Gentoo Portage Tree

Summary: Varnish is a state-of-the-art, high-performance HTTP accelerator


Varnish

Varnish is a webcache & http accelerator. Varnish will either serve cached content, or retireve content from the server, and cache it. Varnish will reduce I/O pressure from webservers.

Install

Emerge

Install www-servers/varnish

# www-servers/varnish

Configuration

Configuration is controlled by /etc/varnish/default.vcl

/etc/varnish/default.vcl: varnish configuration file
# backend default {
#     .host = "127.0.0.1";
#     .port = "8080";
# }

Any traffic pointed at port 8080 will be through varnish.

BootService

To start varnish immediately:

# rc-service varnishd start

To start varnish at boot:

# rc-update add varnishd default

Verification

To verify that your traffic is going through varnish.

$ curl -I https://www.varnish-cache.org/