Initial commit

This commit is contained in:
Tube 2023-11-13 13:50:25 +01:00
parent 20d1366ac1
commit 47c8c7878f
1 changed files with 101 additions and 0 deletions

101
gitea.cf Normal file
View File

@ -0,0 +1,101 @@
#
#
#
bundle agent gitea
{
vars:
debian::
"pkgs" slist => {
"daemon","git"
};
"user_home_dir" string => "/home/git";
centos::
"pkgs" slist => {
"daemonize","git"
};
"user_home_dir" string => "/home/git";
freebsd::
"pkgs" slist => {"gitea"};
"user_home_dir" string => "/usr/home/git";
any::
"user" string => "git";
}
body perms m_rxdirs( mode, rxdirs )
{
mode => "$(mode)";
rxdirs => "$(rxdirs)";
}
bundle agent install_gitea(cfg_param)
{
vars:
"default_cfg" data => '{
"version":"1.20.5",
"install_dir":"/var/gitea",
"work_dir":"/var/gitea/data",
}';
"cfg" data => mergedata(@(default_cfg),@(cfg_param));
"dlsrc" string => "https://dl.gitea.io/gitea/$(cfg[version])/gitea-$(cfg[version])-linux-amd64";
"gitea_exe" string => "$(cfg[install_dir])/gitea";
"app_ini" string => "$(work_dir)/app_ini";
methods:
"any" usebundle => wmde_install_packages(@(gitea.pkgs),"gitea");
!freebsd::
"any" usebundle => download_file("wget","$(dlsrc)","$(gitea_exe)","gitea", '{ "m":"755" }');
files:
"$(cfg[install_dir])/."
create => "true",
handle => "gitea_work_dir_created",
perms => mo("755","$(gitea.user)");
"$(gitea.user_home_dir)/."
create => "true",
perms => mo("755","$(gitea.user)");
# freebsd::
# "/home"
# link_from => ln_s("/usr/home"),
# move_obstructions => "true";
users:
"$(gitea.user)"
policy => "present",
home_dir => "$(gitea.user_home_dir)",
#group_primary => "users",
shell => "/bin/sh",
handle => "gitea_user_created";
processes:
"gitea"
restart_class => "start_gitea";
methods:
(!freebsd)&start_gitea::
"any" usebundle => daemonize(
"/usr/bin/su git -c '$(gitea_exe) --config /var/gitea/app.ini'"
),
classes => if_ok("gitea_ok_start");
reports:
}