Compare commits
	
		
			6 Commits
		
	
	
		
			026f626dbe
			...
			fb7878aa8f
		
	
	| Author | SHA1 | Date | 
|---|---|---|
|  | fb7878aa8f | |
|  | eb537b7231 | |
|  | 9d503a50a2 | |
|  | ee8b036231 | |
|  | 8eb884a046 | |
|  | 504a72a48c | 
|  | @ -124,15 +124,6 @@ commands: | ||||||
| 		args => "certonly --agree-tos -n $(webroot_arg) --expand --email $(site[email]) $(args)"; | 		args => "certonly --agree-tos -n $(webroot_arg) --expand --email $(site[email]) $(args)"; | ||||||
| 
 | 
 | ||||||
| reports: | reports: | ||||||
| #	"CURRENT DOMAINS FOR $(site[domain]) : $(current_domains)"; |  | ||||||
| #	"EXEC IST: $(cert_test_cmd)"; |  | ||||||
| 
 |  | ||||||
| #	"IS '$(domains_txt)' == '$(current_domains_txt) ' ?"; |  | ||||||
| 	 |  | ||||||
| #	run_certbot_new:: |  | ||||||
| #		"WE MUST RUN CERTBOT FOR $(domains_txt)"; |  | ||||||
| #	!run_certbot_new:: |  | ||||||
| #		"WE SHOULD NOT RUN CERTBOT FOR $(domains_txt)"; |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
							
								
								
									
										71
									
								
								lib.cf
								
								
								
								
							
							
						
						
									
										71
									
								
								lib.cf
								
								
								
								
							|  | @ -288,3 +288,74 @@ methods: | ||||||
| 
 | 
 | ||||||
| reports: | reports: | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | bundle agent download_file(method,src,dst,cls,prms_arg) | ||||||
|  | { | ||||||
|  | vars: | ||||||
|  | 	"prms_default" data => '{ | ||||||
|  | 		"m":"600", | ||||||
|  | 		"o":"$(sys.user_data[uid])", | ||||||
|  | 		"g":"$(sys.user_data[gid])" | ||||||
|  | 	}'; | ||||||
|  | 
 | ||||||
|  | 	"prms" data => mergedata(@(prms_default),parsejson($(prms_arg))); | ||||||
|  | 
 | ||||||
|  | classes: | ||||||
|  | 	"$(method)"; | ||||||
|  | 	wget:: | ||||||
|  | 		"run_wget" expression => not(fileexists($(dst))); | ||||||
|  | 	 | ||||||
|  | files: | ||||||
|  | 	policyhub:: | ||||||
|  | 		"$(dst)" | ||||||
|  | 		copy_from => remote_dcp("$(src)","$(sys.policy_hub)"), | ||||||
|  | 		classes => if_repaired("$(cls)_repaired"), | ||||||
|  | 		perms => mog ("$(prms[m])","$(prms[o])","$(prms[g])"); | ||||||
|  | methods: | ||||||
|  | 	wget:: | ||||||
|  | 	"any" usebundle => "install_wget", handle=>"wget_installed"; | ||||||
|  | 
 | ||||||
|  | commands: | ||||||
|  | 	run_wget:: | ||||||
|  | 		"$(wget.exe)" | ||||||
|  | 		args => "-q -O $(dst) $(src) || (rm -f $(dst) && /usr/bin/false) ", | ||||||
|  | 		contain => wmde_cmd_useshell, | ||||||
|  | 		handle => "$(cls)_downloaded", | ||||||
|  | 		classes => results("namespace","$(cls)"), | ||||||
|  | 		depends_on => {"wget_installed"}, | ||||||
|  | 		inform => "true"; | ||||||
|  | 		 | ||||||
|  | 		"/usr/bin/true" | ||||||
|  | 		depends_on => {"$(cls)_downloaded"}, | ||||||
|  | 		classes => if_repaired("$(cls)_kept"); | ||||||
|  | 			 | ||||||
|  | 		 | ||||||
|  | 	(!run_wget)&(wget):: | ||||||
|  | 		"/usr/bin/true" | ||||||
|  | 		classes => if_repaired("$(cls)_kept"); | ||||||
|  | 			 | ||||||
|  | 
 | ||||||
|  | files: | ||||||
|  | 		"$(dst)" | ||||||
|  | 		perms => mog ("$(prms[m])","$(prms[o])","$(prms[g])"), | ||||||
|  | 		depends_on => {"$(cls)_downloaded"}; | ||||||
|  | 		 | ||||||
|  | reports: | ||||||
|  | 	!run_wget:: | ||||||
|  | 		"Not run wget"; | ||||||
|  | 	run_wget:: | ||||||
|  | 		"Run wget"; | ||||||
|  | 
 | ||||||
|  | 	"$(cls)_repaired":: | ||||||
|  | 		"$(cls) repaired";  | ||||||
|  | 	"!($(cls)_repaired)":: | ||||||
|  | 		"$(cls) not repaired";  | ||||||
|  | 
 | ||||||
|  | 	"$(cls)_kept":: | ||||||
|  | 		"$(cls) kept";  | ||||||
|  | 	"!($(cls)_kept)":: | ||||||
|  | 		"$(cls) not kept";  | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |  | ||||||
							
								
								
									
										49
									
								
								php.cf
								
								
								
								
							
							
						
						
									
										49
									
								
								php.cf
								
								
								
								
							|  | @ -21,14 +21,26 @@ vars: | ||||||
| 			"php$(php.bsdvs)-zip", | 			"php$(php.bsdvs)-zip", | ||||||
| 			"php$(php.bsdvs)-pgsql", | 			"php$(php.bsdvs)-pgsql", | ||||||
| 			"php$(php.bsdvs)-mysqli", | 			"php$(php.bsdvs)-mysqli", | ||||||
| 			"php$(php.bsdvs)-pdo_mysql", |  | ||||||
| 			"php$(php.bsdvs)-pdo", |  | ||||||
| 			"php$(php.bsdvs)-filter", | 			"php$(php.bsdvs)-filter", | ||||||
| 			"php$(php.bsdvs)-mbstring", | 			"php$(php.bsdvs)-mbstring", | ||||||
| 			"php$(php.bsdvs)-dom", | 			"php$(php.bsdvs)-dom", | ||||||
| 			"php$(php.bsdvs)-xml", | 			"php$(php.bsdvs)-xml", | ||||||
| 			"php$(php.bsdvs)-ctype", | 			"php$(php.bsdvs)-ctype", | ||||||
| 			"php$(php.bsdvs)-intl", | 			"php$(php.bsdvs)-intl", | ||||||
|  | 			"php$(php.bsdvs)-curl", | ||||||
|  | 			"php$(php.bsdvs)-fileinfo", | ||||||
|  | 			"php$(php.bsdvs)-exif", | ||||||
|  | 			"php$(php.bsdvs)-iconv", | ||||||
|  | 			"php$(php.bsdvs)-ldap", | ||||||
|  | 			"php$(php.bsdvs)-gd", | ||||||
|  | 			"php$(php.bsdvs)-pecl-imagick", | ||||||
|  | 			"php$(php.bsdvs)-pdo", | ||||||
|  | 			"php$(php.bsdvs)-pdo_sqlite", | ||||||
|  | 			"php$(php.bsdvs)-sqlite3", | ||||||
|  | 			"php$(php.bsdvs)-pdo_pgsql", | ||||||
|  | 			"php$(php.bsdvs)-pdo_mysql", | ||||||
|  | 
 | ||||||
|  | 			 | ||||||
| 		}; | 		}; | ||||||
| 	#	"php$(bsdvs)-json", | 	#	"php$(bsdvs)-json", | ||||||
| 
 | 
 | ||||||
|  | @ -110,7 +122,10 @@ methods: | ||||||
| 		depends_on => {"php_repo_ready"}; | 		depends_on => {"php_repo_ready"}; | ||||||
| 
 | 
 | ||||||
| commands: | commands: | ||||||
| 
 | 	freebsd:: | ||||||
|  | 		"/usr/bin/true" | ||||||
|  | 		inform => "false", | ||||||
|  | 		handle => "php_repo_ready"; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | @ -171,6 +186,7 @@ vars: | ||||||
| 		"fpm_pkgs" slist => { "php$(version)-fpm" }; | 		"fpm_pkgs" slist => { "php$(version)-fpm" }; | ||||||
| 		"fpm_service_name" string => "php$(version)-fpm"; | 		"fpm_service_name" string => "php$(version)-fpm"; | ||||||
| 		"fpm_socket" string => "/run/php/php$(version)-fpm.sock"; | 		"fpm_socket" string => "/run/php/php$(version)-fpm.sock"; | ||||||
|  | 		"fpm_socket_type" string => "unix"; | ||||||
| 
 | 
 | ||||||
| 		"apt_repo_url" string => "https://packages.sury.org/php/"; | 		"apt_repo_url" string => "https://packages.sury.org/php/"; | ||||||
| 		"apt_repo_key" string => "https://packages.sury.org/php/apt.gpg"; | 		"apt_repo_key" string => "https://packages.sury.org/php/apt.gpg"; | ||||||
|  | @ -190,14 +206,18 @@ vars: | ||||||
| 
 | 
 | ||||||
| 	freebsd:: | 	freebsd:: | ||||||
| 		"ini_files" slist => { | 		"ini_files" slist => { | ||||||
| 			"/etc/php/$(install_php.version)/apache2/php.ini", | #			"/etc/php/$(install_php.version)/apache2/php.ini", | ||||||
| 			"/etc/php/$(install_php.version)/fpm/php.ini" | #			"/etc/php/$(install_php.version)/fpm/php.ini" | ||||||
| 		}; | 		}; | ||||||
| 		"cli_exe" string => "/usr/local/bin/php"; | 		"cli_exe" string => "/usr/local/bin/php"; | ||||||
| 		"version" string => "8.2"; | 		"version" string => "8.2"; | ||||||
| 		"bsdvs" string => "82"; | 		"bsdvs" string => "82"; | ||||||
| 		"apache_m" string => "php"; | 		"apache_m" string => "php"; | ||||||
| 		"apache_f" string => "libphp"; | 		"apache_f" string => "libphp"; | ||||||
|  | 		"fpm_pkgs" slist => {}; | ||||||
|  | 		"fpm_service_name" string => "php-fpm"; | ||||||
|  | 		"fpm_socket" string => "127.0.0.1:9000"; | ||||||
|  | 		"fpm_socket_type" string => "inet"; | ||||||
| 
 | 
 | ||||||
| 	centos:: | 	centos:: | ||||||
| 		"cli_exe" string => "/usr/bin/php"; | 		"cli_exe" string => "/usr/bin/php"; | ||||||
|  | @ -219,22 +239,31 @@ files: | ||||||
| #methods: | #methods: | ||||||
| #	"any" usebundle => install_php; | #	"any" usebundle => install_php; | ||||||
| reports: | reports: | ||||||
| 	"PHP VERSION: $(ini_files) V:$(install_php.version)"; | #	"PHP VERSION: $(ini_files) V:$(install_php.version)"; | ||||||
| 
 | 
 | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| bundle agent install_php_fpm | bundle agent install_php_fpm | ||||||
| { | { | ||||||
|  | vars: | ||||||
|  | 	"service_deps" slist => { | ||||||
|  |                 "php_fpm_pkgs_installed", | ||||||
|  |                 "php_pkgs_installed" | ||||||
|  |         }; | ||||||
|  | 	freebsd:: | ||||||
|  | 		"service_deps" slist => { | ||||||
|  |        	         "php_pkgs_installed" | ||||||
|  |        		 }; | ||||||
|  | 	 | ||||||
| methods: | methods: | ||||||
| 	"any" usebundle => install_php;  | 	"any" usebundle => install_php;  | ||||||
| 	"any" usebundle => wmde_install_packages(@(php.fpm_pkgs),"php_fpm"); | 	"any" usebundle => wmde_install_packages(@(php.fpm_pkgs),"php_fpm"); | ||||||
| 	 | 	 | ||||||
| 
 | 
 | ||||||
| 	"any" usebundle => wmde_service("$(php.fpm_service_name)","php_kept|php_fpm_kept","php_repaired|php_fpm_repaired"), | 	"any" usebundle => wmde_service("$(php.fpm_service_name)","php_kept|php_fpm_kept","php_repaired|php_fpm_repaired"), | ||||||
| 	depends_on =>{ | 	depends_on => @(service_deps); | ||||||
| 		"php_fpm_pkgs_installed", | reports: | ||||||
| 		"php_pkgs_installed"	 | #	"php ????"; | ||||||
| 	}; |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
							
								
								
									
										78
									
								
								roundcube.cf
								
								
								
								
							
							
						
						
									
										78
									
								
								roundcube.cf
								
								
								
								
							|  | @ -5,12 +5,13 @@ | ||||||
| 
 | 
 | ||||||
| bundle agent roundcube(cfg) | bundle agent roundcube(cfg) | ||||||
| { | { | ||||||
|  | 
 | ||||||
| classes: | classes: | ||||||
|  | 	"dlbyversion" expression => not (isvariable ("cfg[src_tgz]")); | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| 
 | 	"roundcube_untar" expression => not(fileexists("$(install_sub_dir)/index.php")); | ||||||
| 	"roundcube_untar" expression => not(fileexists("$(cfg[install_sub_dir])/index.php")); | 	"config_exists" expression => fileexists("$(install_sub_dir)/config/config.inc.php"); | ||||||
| 	"config_exists" expression => fileexists("$(cfg[install_sub_dir])/config/config.inc.php"); |  | ||||||
| 	"backup_config_exists" expression => fileexists("$(cfg[backup_dir])/config.inc.php"); | 	"backup_config_exists" expression => fileexists("$(cfg[backup_dir])/config.inc.php"); | ||||||
| 	 | 	 | ||||||
| 
 | 
 | ||||||
|  | @ -22,21 +23,51 @@ classes: | ||||||
| 		"sql_backup_exists" expression => fileexists("$(cfg[backup_dir])/roundcube.sql"); | 		"sql_backup_exists" expression => fileexists("$(cfg[backup_dir])/roundcube.sql"); | ||||||
| 
 | 
 | ||||||
| vars: | vars: | ||||||
| 	"dlfile" string => "$(sys.workdir)/data/public/$(cfg[src_tgz])"; | 	"dldir" string =>"$(sys.workdir)/data/agent/roundcube"; | ||||||
| files: |  | ||||||
|         "$(dlfile)" |  | ||||||
|                 copy_from => remote_dcp("$(def.hub_public_dir)/$(cfg[src_tgz])","$(sys.policy_hub)"), |  | ||||||
|                 handle => "roundcube_tgz_copied", |  | ||||||
| 		classes => if_repaired ("roundcube_untar"), |  | ||||||
|                 perms => m(644); |  | ||||||
| 
 | 
 | ||||||
|  | 	!(dlbyversion):: | ||||||
|  | 		"dlfile" string => "$(sys.workdir)/data/public/$(cfg[src_tgz])"; | ||||||
|  | 		"dltype" string => "policyhub"; | ||||||
|  | 		"dlsrc" string => "$(def.hub_public_dir)/$(cfg[src_tgz])";	 | ||||||
|  | 		"install_sub_dir" string => "$(cfg[install_sub_dir])"; | ||||||
|  | 
 | ||||||
|  | 	dlbyversion:: | ||||||
|  | 		"tgzname" string => "roundcubemail-$(cfg[version])-complete.tar.gz"; | ||||||
|  | 		"dlfile" string => "$(dldir)/$(tgzname)"; | ||||||
|  | 		"install_sub_dir" string => "$(cfg[install_dir])/roundcubemail-$(cfg[version])"; | ||||||
|  | 		"dltype" string => "wget"; | ||||||
|  | 		"dlsrc" string => "https://github.com/roundcube/roundcubemail/releases/download/$(cfg[version])/$(tgzname)"; | ||||||
|  | 
 | ||||||
|  | reports: | ||||||
|  | 	dlbyversion:: | ||||||
|  | 		"dl by version"; | ||||||
|  | 	!dlbyversion:: | ||||||
|  | 		"not dl by version"; | ||||||
|  | 	 | ||||||
|  | files: | ||||||
|  | 	"$(dldir)/." | ||||||
|  | 	create => "true", | ||||||
|  | 	handle => "roundcube_agent_dir_created"; | ||||||
|  | 
 | ||||||
|  | methods: | ||||||
|  | 	"any" usebundle => download_file("$(dltype)","$(dlsrc)","$(dlfile)","roundcube_tgz_file",'{}'), | ||||||
|  | 	handle => "roundcube_tgz_copied", | ||||||
|  | 	depends_on => {"roundcube_agent_dir_created"}, | ||||||
|  | 	classes => if_repaired ("roundcube_untar"); | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     #    "$(dlfile)" | ||||||
|  |      #          copy_from => remote_dcp("$(def.hub_public_dir)/$(cfg[src_tgz])","$(sys.policy_hub)"), | ||||||
|  |  #               perms => m(644); | ||||||
|  | 
 | ||||||
|  | files: | ||||||
| 	"$(cfg[install_dir])/public" | 	"$(cfg[install_dir])/public" | ||||||
| 		link_from => ln_s("$(cfg[install_sub_dir])"), | 		link_from => ln_s("$(install_sub_dir)"), | ||||||
| 		move_obstructions => "true", | 		move_obstructions => "true", | ||||||
| 		depends_on => {"roundcube_untarred"}; | 		depends_on => {"roundcube_untarred"}; | ||||||
| 
 | 
 | ||||||
| 	run_backups&(!config_exists)&backup_config_exists:: | 	run_backups&(!config_exists)&backup_config_exists:: | ||||||
| 		"$(cfg[install_sub_dir])/config/config.inc.php" | 		"$(install_sub_dir)/config/config.inc.php" | ||||||
| 		copy_from => local_cp("$(cfg[backup_dir])/config.inc.php"), | 		copy_from => local_cp("$(cfg[backup_dir])/config.inc.php"), | ||||||
| 		perms => m("644"), | 		perms => m("644"), | ||||||
| 		classes => if_repaired("roundcube_config_repaired"), | 		classes => if_repaired("roundcube_config_repaired"), | ||||||
|  | @ -44,14 +75,14 @@ files: | ||||||
| 
 | 
 | ||||||
| 	run_backups&config_exists:: | 	run_backups&config_exists:: | ||||||
| 		"$(cfg[backup_dir])/config.inc.php" | 		"$(cfg[backup_dir])/config.inc.php" | ||||||
| 		copy_from => local_dcp("$(cfg[install_sub_dir])/config/config.inc.php"), | 		copy_from => local_dcp("$(install_sub_dir)/config/config.inc.php"), | ||||||
| 		depends_on => {"roundcube_untarred"};	 | 		depends_on => {"roundcube_untarred"};	 | ||||||
| 
 | 
 | ||||||
| methods: | methods: | ||||||
| 	"any" usebundle => mysql_table_exists(@(cfg),"users"); | 	"any" usebundle => mysql_table_exists(@(cfg),"users"); | ||||||
| 	 | 	 | ||||||
| 	config_exists|roundcube_configr_repaired:: | 	config_exists|roundcube_configr_repaired:: | ||||||
| 		"any" usebundle => rm_rf ("$(cfg[install_sub_dir])/installer"); | 		"any" usebundle => rm_rf ("$(install_sub_dir)/installer"); | ||||||
| 
 | 
 | ||||||
| commands: | commands: | ||||||
| 	roundcube_untar:: | 	roundcube_untar:: | ||||||
|  | @ -94,3 +125,22 @@ reports: | ||||||
| #		"ROUNDCUBE SHOULD RUN BACKUPS";	 | #		"ROUNDCUBE SHOULD RUN BACKUPS";	 | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | 
 | ||||||
|  | bundle agent download_roundcube(cfg) | ||||||
|  | { | ||||||
|  | vars: | ||||||
|  | 
 | ||||||
|  | 	"tgzname" string => "roundcubemail-$(cfg[version])-complete.tar.gz"; | ||||||
|  | 	"dldir" string =>"$(sys.workdir)/data/agent/roundcube"; | ||||||
|  | 	"dst" string => "$(dldir)/$(tgzname)"; | ||||||
|  | files: | ||||||
|  | 	"$(dldir)/." | ||||||
|  | 	create => "true", | ||||||
|  | 	handle => "roundcube_agentdir_created"; | ||||||
|  | 
 | ||||||
|  | methods: | ||||||
|  | 	"any" usebundle => download_file("wget", | ||||||
|  | 		"https://github.com/roundcube/roundcubemail/releases/download/$(cfg[version])/$(tgzname)", | ||||||
|  | 		"$(dst)","roundcube_tgz_file",'{}');	 | ||||||
|  | 	 | ||||||
|  | } | ||||||
|  |  | ||||||
							
								
								
									
										10
									
								
								wget.cf
								
								
								
								
							
							
						
						
									
										10
									
								
								wget.cf
								
								
								
								
							|  | @ -1,8 +1,16 @@ | ||||||
|  | # | ||||||
|  | # | ||||||
|  | # | ||||||
| 
 | 
 | ||||||
| bundle agent wget | bundle agent wget | ||||||
| { | { | ||||||
| vars: | vars: | ||||||
| 	"pkgs" slist => {"wget","tar"}; | 	freebsd:: | ||||||
|  | 		"pkgs" slist => {"wget","curl"}; | ||||||
|  | 	centos:: | ||||||
|  | 		"pkgs" slist => {"wget","tar","bzip2","xz","unzip"}; | ||||||
|  | 		 | ||||||
|  | 
 | ||||||
| 
 | 
 | ||||||
| 	"exe" string => "/usr/bin/wget"; | 	"exe" string => "/usr/bin/wget"; | ||||||
| 	freebsd:: | 	freebsd:: | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue