OP#414 add service definition
This commit is contained in:
@@ -7,4 +7,9 @@ class confdroid_gitea::main::config (
|
||||
|
||||
) inherits confdroid_gitea::params {
|
||||
include confdroid_gitea::main::service
|
||||
|
||||
exec { 'systemd-daemon-reload':
|
||||
command => '/bin/systemctl daemon-reload',
|
||||
refreshonly => true,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,5 +31,14 @@ class confdroid_gitea::main::files (
|
||||
mode => '0640',
|
||||
content => template($ga_config_erb),
|
||||
}
|
||||
|
||||
file { $ga_service_file:
|
||||
ensure => 'file',
|
||||
owner => 'root',
|
||||
group => 'root',
|
||||
mode => '0644',
|
||||
content => template($ga_service_erb),
|
||||
notify => Exec['systemd-daemon-reload'],
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,5 +9,14 @@ class confdroid_gitea::main::service (
|
||||
if $ga_host_fqdn == $fqdn {
|
||||
require confdroid_gitea::firewall::iptables
|
||||
require confdroid_gitea::main::files
|
||||
|
||||
service { $ga_service_name:
|
||||
ensure => 'running',
|
||||
enable => true,
|
||||
hasrestart => true,
|
||||
hasstatus => true,
|
||||
require => File[$ga_service_file],
|
||||
subscribe => File[$ga_config_file],
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -133,6 +133,11 @@ class confdroid_gitea::params (
|
||||
# files
|
||||
$ga_config_file = "${ga_conf_dir}/app.ini"
|
||||
$ga_config_erb = 'confdroid_gitea/app.ini.erb'
|
||||
$ga_service_file = '/etc/systemd/system/gitea.service'
|
||||
$ga_service_erb = 'confdroid_gitea/gitea_service.erb'
|
||||
|
||||
# Service
|
||||
$ga_service_name = 'gitea'
|
||||
|
||||
# includes must be last
|
||||
include confdroid_gitea::main::config
|
||||
|
||||
26
templates/gitea_service.erb
Normal file
26
templates/gitea_service.erb
Normal file
@@ -0,0 +1,26 @@
|
||||
### File created by Puppet ###
|
||||
### manual changes will be lost ###
|
||||
### reference https://github.com/go-gitea/gitea/blob/release/v1.25/contrib/systemd/gitea.service ###
|
||||
###########################################################################################################
|
||||
|
||||
[Unit]
|
||||
Description=Gitea (Git with a cup of tea)
|
||||
After=network.target
|
||||
|
||||
Wants=<%= @ga_db_type %>.service
|
||||
After=<%= @ga_db_type %>.service
|
||||
|
||||
[Service]
|
||||
# Uncomment the next line if you have repos with lots of files and get a HTTP 500 error because of that
|
||||
# LimitNOFILE=524288:524288
|
||||
RestartSec=2s
|
||||
Type=simple
|
||||
User=<%= @ga_user %>
|
||||
Group=<%= @ga_user %>
|
||||
WorkingDirectory=<%= @ga_working_dir %>
|
||||
ExecStart=/usr/local/bin/gitea web --config /etc/gitea/app.ini
|
||||
Restart=always
|
||||
Environment=USER=<%= @ga_user %> HOME=/home/<%= @ga_user %> GITEA_WORK_DIR=<%= @ga_working_dir %>
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
Reference in New Issue
Block a user