Compare commits
	
		
			7 Commits
		
	
	
		
			b962c1452a
			...
			94abf0568a
		
	
	| Author | SHA1 | Date | 
|---|---|---|
| 
							
							
								 | 
						94abf0568a | |
| 
							
							
								 | 
						20683ccbc4 | |
| 
							
							
								 | 
						46810b3b75 | |
| 
							
							
								 | 
						024f2767cd | |
| 
							
							
								 | 
						c57bf87e34 | |
| 
							
							
								 | 
						5c7dad802e | |
| 
							
							
								 | 
						240f257bfd | 
							
								
								
									
										46
									
								
								apache.cf
								
								
								
								
							
							
						
						
									
										46
									
								
								apache.cf
								
								
								
								
							| 
						 | 
				
			
			@ -50,6 +50,7 @@ vars:
 | 
			
		|||
	freebsd::
 | 
			
		||||
		"pkgs" slist => {
 | 
			
		||||
			"apache24",
 | 
			
		||||
			"mod_dav_svn",
 | 
			
		||||
		};
 | 
			
		||||
		"log_dir" string =>"/var/log/httpd";
 | 
			
		||||
		"log_dir_owner" string => "root";
 | 
			
		||||
| 
						 | 
				
			
			@ -80,7 +81,10 @@ vars:
 | 
			
		|||
			{m:"proxy_fcgi",f:"mod_proxy_fcgi"},
 | 
			
		||||
			{m:"proxy_http",f:"mod_proxy_http"},
 | 
			
		||||
			{m:"proxy_http2",f:"mod_proxy_http2"},
 | 
			
		||||
			{m:"remoteip",f:"mod_remoteip"}
 | 
			
		||||
			{m:"remoteip",f:"mod_remoteip"},
 | 
			
		||||
			{m: "dav",f:"mod_dav"},
 | 
			
		||||
			{m: "dav_svn", f:"mod_dav_svn"},
 | 
			
		||||
			{m: "authz_svn", f:"mod_authz_svn"}
 | 
			
		||||
		]';
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -450,15 +454,17 @@ vars:
 | 
			
		|||
	"pid" string => "/var/run/matomo-logger-$(site[domain]).pid";
 | 
			
		||||
	"log" string => "$(apache.log_dir)/$(site[domain])-access.log";
 | 
			
		||||
	"siteid" string => "$(site[matomoid])";
 | 
			
		||||
	"logger_script" string => "/tmp/matomo-logger-$(site[domain]).sh";
 | 
			
		||||
freebsd::
 | 
			
		||||
	"analyt_cmd" string => "/usr/local/bin/python3.9 /var/www/matomo/misc/log-analytics/import_logs.py";
 | 
			
		||||
	"analyt_cmd" string => "/usr/local/bin/python3.9 $(matomo.log_importer)";
 | 
			
		||||
debian::
 | 
			
		||||
	"analyt_cmd" string => "/usr/bin/python3 /var/www/matomo/misc/log-analytics/import_logs.py";
 | 
			
		||||
	"analyt_cmd" string => "/usr/bin/python3 $(matomo.log_importer)";
 | 
			
		||||
centos::
 | 
			
		||||
	"analyt_cmd" string => "/usr/bin/python3 /var/www/matomo/misc/log-analytics/import_logs.py";
 | 
			
		||||
	"analyt_cmd" string => "/usr/bin/python3 $(matomo.log_importer)";
 | 
			
		||||
	
 | 
			
		||||
matomo::
 | 
			
		||||
	"cmd" string => "/usr/bin/pkill -P `cat $(pid)` ; exec /bin/sh -c 'echo $$ > $(pid); /usr/bin/tail -n+1 -f $(log) | $(analyt_cmd) --token-auth=$(site[matomotoken]) --disable-bulk-tracking --idsite=$(siteid) --url=$(site[matomosite]) --exclude-path=/wp-login.php --exclude-path=/wp-json/* --recorders=1 --recorder-max-payload-size=1 --log-format-name=ncsa_extended --exclude-path=*.php --exclude-path=/wp-admin/* - > /dev/null' ";
 | 
			
		||||
	"cmd" string => "/usr/bin/pkill -P `cat $(pid)` ; exec /bin/sh -c 'echo $$ > $(pid); echo \"hello\" | /usr/bin/tail -n+1 -f $(log) | $(analyt_cmd) --token-auth=$(site[matomotoken]) --disable-bulk-tracking --idsite=$(siteid) --url=$(site[matomosite]) --exclude-path=/wp-login.php --exclude-path=/wp-json/\\* --recorders=1 --recorder-max-payload-size=1 --log-format-name=ncsa_extended --exclude-path=\\*.php --exclude-path=/wp-admin/\\* - > /dev/null'
 | 
			
		||||
";
 | 
			
		||||
!matomo::
 | 
			
		||||
	"cmd" string => "";
 | 
			
		||||
any::
 | 
			
		||||
| 
						 | 
				
			
			@ -495,6 +501,20 @@ files:
 | 
			
		|||
	create => "true";
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	"$(logger_script)"
 | 
			
		||||
	create => "true",
 | 
			
		||||
	perms => m("755"),
 | 
			
		||||
	content => '#!/bin/sh
 | 
			
		||||
if [ "$1" != "child" ]; then
 | 
			
		||||
	"$(logger_script)" child &
 | 
			
		||||
else
 | 
			
		||||
	setsid >/dev/null 2>&1
 | 
			
		||||
	exec 0<&- 1>/dev/null 2>&1
 | 
			
		||||
	$(cmd)
 | 
			
		||||
fi
 | 
			
		||||
',
 | 
			
		||||
	handle => "loggerscript_$(site[domain])_created";	
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
classes:
 | 
			
		||||
	"matomo" expression => isvariable("site[matomoid]");
 | 
			
		||||
| 
						 | 
				
			
			@ -507,10 +527,22 @@ commands:
 | 
			
		|||
	inform => "false",
 | 
			
		||||
	module => "true";
 | 
			
		||||
 | 
			
		||||
	start_matomo::
 | 
			
		||||
		"$(logger_script)"
 | 
			
		||||
		args => "$(logger_script)",
 | 
			
		||||
		contain => wmde_cmd_useshell,
 | 
			
		||||
		depends_on => {"loggerscript_$(site[domain])_created"}; 
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#		"/bin/sh"
 | 
			
		||||
#		args => "$(logger_script) &",
 | 
			
		||||
#		contain => wmde_cmd_useshell,
 | 
			
		||||
#		depends_on => {"loggerscript_$(site[domain])_created"}; 
 | 
			
		||||
 | 
			
		||||
methods:
 | 
			
		||||
	start_matomo::
 | 
			
		||||
		"call" usebundle => daemonize( "$(cmd)" );
 | 
			
		||||
#	start_matomo::
 | 
			
		||||
#		"call" usebundle => daemonize( "/bin/sh $(logger_script)" ),
 | 
			
		||||
#			depends_on => {"loggerscript_$(site[domain])_created"};
 | 
			
		||||
 | 
			
		||||
reports:
 | 
			
		||||
	#start_matomo::
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -44,7 +44,7 @@ files:
 | 
			
		|||
	freebsd::
 | 
			
		||||
		"/etc/cron.d/certbot"
 | 
			
		||||
			create => "true",
 | 
			
		||||
			copy_from => local_cp("$(sys.workdir)/inputs/$(def.wmde_libdir)/templates/certbot-cron.mustache");
 | 
			
		||||
			copy_from => local_dcp("$(sys.workdir)/inputs/$(def.wmde_libdir)/templates/certbot-cron.mustache");
 | 
			
		||||
	
 | 
			
		||||
#			content => '# 
 | 
			
		||||
# Managed by CFEngine
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										17
									
								
								lib.cf
								
								
								
								
							
							
						
						
									
										17
									
								
								lib.cf
								
								
								
								
							| 
						 | 
				
			
			@ -336,7 +336,7 @@ files:
 | 
			
		|||
		perms => mog ("$(prms[m])","$(prms[o])","$(prms[g])");
 | 
			
		||||
methods:
 | 
			
		||||
	wget::
 | 
			
		||||
	"any" usebundle => "install_wget", handle=>"wget_installed";
 | 
			
		||||
	"any" usebundle => "install_wget"; #, handle=>"wget_installed";
 | 
			
		||||
 | 
			
		||||
commands:
 | 
			
		||||
	run_wget::
 | 
			
		||||
| 
						 | 
				
			
			@ -393,3 +393,18 @@ commands:
 | 
			
		|||
		args => "-a"; 
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
bundle agent etc_hosts(hosts)
 | 
			
		||||
{
 | 
			
		||||
vars:
 | 
			
		||||
	"idx" slist  => getindices(@(hosts));
 | 
			
		||||
	"settings[$(idx)]" string => "$(hosts[$(idx)])";
 | 
			
		||||
files:
 | 
			
		||||
	"/etc/hosts"
 | 
			
		||||
		create => "true",
 | 
			
		||||
		perms => m("644"),
 | 
			
		||||
		edit_line => set_config_values("$(this.bundle).settings"),
 | 
			
		||||
		classes => results("namespace","etc_hosts");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										10
									
								
								mysql.cf
								
								
								
								
							
							
						
						
									
										10
									
								
								mysql.cf
								
								
								
								
							| 
						 | 
				
			
			@ -20,11 +20,12 @@ vars:
 | 
			
		|||
		"user" string => "mysql";
 | 
			
		||||
		"server_pkgs"  slist => {"mysql80-server"};
 | 
			
		||||
		"client_pkgs" slist => {"mysql80-client"};
 | 
			
		||||
		"type" string => "mysql8";
 | 
			
		||||
 | 
			
		||||
		"server_pkgs"  slist => {"mariadb106-server"}, if => strcmp("$(cfg[mariadb])","true");
 | 
			
		||||
		"client_pkgs"  slist => {"mariadb106-client"}, if => strcmp("$(cfg[mariadb])","true");
 | 
			
		||||
		"type" string => "mariadb",if => strcmp("$(cfg[mariadb])","true");
 | 
			
		||||
 | 
			
		||||
		"type" string => "mysql8";
 | 
			
		||||
		"service_name" string => "mysql-server";
 | 
			
		||||
		"cfg_dir" string => "/usr/local/etc/mysql";
 | 
			
		||||
		"cfg_file" string => "/usr/local/etc/mysql/my.cnf";
 | 
			
		||||
| 
						 | 
				
			
			@ -434,9 +435,12 @@ classes:
 | 
			
		|||
vars:
 | 
			
		||||
	"table_exists" string => "mysql_$(cfg[db_name])_$(cfg[db_check_table])_exists";
 | 
			
		||||
methods:
 | 
			
		||||
	"any" usebundle => mysql_table_exists(@(cfg),"$(cfg[db_check_table])");
 | 
			
		||||
	"any" usebundle => mysql_table_exists(@(cfg),"$(cfg[db_check_table])"),
 | 
			
		||||
		handle=>"$(table_exists)_checked";
 | 
			
		||||
 | 
			
		||||
	"!$(table_exists)&backup_exists"::
 | 
			
		||||
		"any" usebundle => restore_mysql_db(@(cfg),"$(file)");
 | 
			
		||||
		"any" usebundle => restore_mysql_db(@(cfg),"$(file)"),
 | 
			
		||||
		depends_on=>{"$(table_exists)_checked"};
 | 
			
		||||
reports:
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										8
									
								
								php.cf
								
								
								
								
							
							
						
						
									
										8
									
								
								php.cf
								
								
								
								
							| 
						 | 
				
			
			@ -192,7 +192,7 @@ vars:
 | 
			
		|||
		"fpm_pkgs" slist => { "php$(version)-fpm" };
 | 
			
		||||
		"fpm_service_name" string => "php$(version)-fpm";
 | 
			
		||||
		"fpm_socket" string => "/run/php/php$(version)-fpm.sock";
 | 
			
		||||
		"fpm_socket_type" string => "unix";
 | 
			
		||||
		"fpm_socket_type" string => "unix:";
 | 
			
		||||
 | 
			
		||||
		"apt_repo_url" string => "https://packages.sury.org/php/";
 | 
			
		||||
		"apt_repo_key" string => "https://packages.sury.org/php/apt.gpg";
 | 
			
		||||
| 
						 | 
				
			
			@ -223,7 +223,7 @@ vars:
 | 
			
		|||
		"fpm_pkgs" slist => {};
 | 
			
		||||
		"fpm_service_name" string => "php-fpm";
 | 
			
		||||
		"fpm_socket" string => "127.0.0.1:9000";
 | 
			
		||||
		"fpm_socket_type" string => "inet";
 | 
			
		||||
		"fpm_socket_type" string => "fcgi://";
 | 
			
		||||
 | 
			
		||||
	centos::
 | 
			
		||||
		"cli_exe" string => "/usr/bin/php";
 | 
			
		||||
| 
						 | 
				
			
			@ -231,6 +231,7 @@ vars:
 | 
			
		|||
		"fpm_pkgs" slist => { "php-fpm" };
 | 
			
		||||
		"fpm_service_name" string => "php$(version)-fpm";
 | 
			
		||||
		"fpm_socket" string => "/run/php-fpm/www.sock";
 | 
			
		||||
		"fpm_socket_type" string => "unix:";
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
files:
 | 
			
		||||
| 
						 | 
				
			
			@ -260,11 +261,14 @@ vars:
 | 
			
		|||
		"service_deps" slist => {
 | 
			
		||||
       	         "php_pkgs_installed"
 | 
			
		||||
       		 };
 | 
			
		||||
		"service_name" string => "$(php.fpm_service_name)";
 | 
			
		||||
		"service_cfg_name" string => "php_fpm";
 | 
			
		||||
	
 | 
			
		||||
methods:
 | 
			
		||||
	"any" usebundle => install_php; 
 | 
			
		||||
	"any" usebundle => wmde_install_packages(@(php.fpm_pkgs),"php_fpm");
 | 
			
		||||
	
 | 
			
		||||
	"any" usebundle => wmde_enable_service("$(this.bundle)");
 | 
			
		||||
 | 
			
		||||
	"any" usebundle => wmde_service("$(php.fpm_service_name)","php_kept|php_fpm_kept","php_repaired|php_fpm_repaired"),
 | 
			
		||||
	depends_on => @(service_deps);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -11,7 +11,7 @@ vars:
 | 
			
		|||
 | 
			
		||||
	freebsd::
 | 
			
		||||
		"pkgs" slist => {
 | 
			
		||||
			"postfix-mysql",
 | 
			
		||||
			"postfix",
 | 
			
		||||
			#"postfix",
 | 
			
		||||
		};
 | 
			
		||||
		"db_dir" string => "/var/db";
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue