2020-08-20 13:34:27 +00:00
|
|
|
defaults = {
|
2020-11-13 11:37:26 +00:00
|
|
|
'backups': {
|
|
|
|
'paths': {
|
|
|
|
'/home/git',
|
2021-07-09 14:22:37 +00:00
|
|
|
'/var/lib/gitea',
|
2020-11-13 11:37:26 +00:00
|
|
|
},
|
|
|
|
},
|
2020-08-20 13:34:27 +00:00
|
|
|
'gitea': {
|
2021-05-01 12:27:31 +00:00
|
|
|
'app_name': 'Gitea',
|
2020-08-20 13:34:27 +00:00
|
|
|
'database': {
|
|
|
|
'username': 'gitea',
|
|
|
|
'password': repo.vault.password_for('{} postgresql gitea'.format(node.name)),
|
|
|
|
'database': 'gitea',
|
|
|
|
},
|
2022-07-12 18:28:59 +00:00
|
|
|
'disable_registration': True,
|
2021-05-01 12:27:31 +00:00
|
|
|
'email_domain_blocklist': set(),
|
|
|
|
'enable_git_hooks': False,
|
|
|
|
'internal_token': repo.vault.password_for('{} gitea internal_token'.format(node.name)),
|
2020-08-20 13:34:27 +00:00
|
|
|
'lfs_secret_key': repo.vault.password_for('{} gitea lfs_secret_key'.format(node.name)),
|
|
|
|
'oauth_secret_key': repo.vault.password_for('{} gitea oauth_secret_key'.format(node.name)),
|
2021-05-01 12:27:31 +00:00
|
|
|
'security_secret_key': repo.vault.password_for('{} gitea security_secret_key'.format(node.name)),
|
2020-08-20 13:34:27 +00:00
|
|
|
},
|
2020-11-10 10:32:59 +00:00
|
|
|
'icinga2_api': {
|
|
|
|
'gitea': {
|
|
|
|
'services': {
|
|
|
|
'GITEA PROCESS': {
|
|
|
|
'command_on_monitored_host': '/usr/local/share/icinga/plugins/check_systemd_unit gitea',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2020-11-14 13:35:54 +00:00
|
|
|
'openssh': {
|
|
|
|
'allowed_users': {
|
|
|
|
'git',
|
|
|
|
},
|
|
|
|
},
|
2020-08-20 13:34:27 +00:00
|
|
|
'postgresql': {
|
2020-11-10 11:37:58 +00:00
|
|
|
'roles': {
|
2020-08-20 13:34:27 +00:00
|
|
|
'gitea': {
|
|
|
|
'password': repo.vault.password_for('{} postgresql gitea'.format(node.name)),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
'databases': {
|
|
|
|
'gitea': {
|
|
|
|
'owner': 'gitea',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2021-07-09 14:22:10 +00:00
|
|
|
'zfs': {
|
|
|
|
'datasets': {
|
|
|
|
'tank/gitea': {},
|
|
|
|
'tank/gitea/home': {
|
|
|
|
'mountpoint': '/home/git',
|
2021-07-17 17:40:41 +00:00
|
|
|
'needed_by': {
|
|
|
|
'directory:/home/git',
|
|
|
|
},
|
2021-07-09 14:22:10 +00:00
|
|
|
},
|
|
|
|
'tank/gitea/var': {
|
|
|
|
'mountpoint': '/var/lib/gitea',
|
2021-07-17 17:40:41 +00:00
|
|
|
'needed_by': {
|
|
|
|
'directory:/var/lib/gitea',
|
|
|
|
},
|
2021-07-09 14:22:10 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2020-08-20 13:34:27 +00:00
|
|
|
}
|
2020-08-20 13:49:11 +00:00
|
|
|
|
|
|
|
|
2021-01-07 17:44:38 +00:00
|
|
|
@metadata_reactor.provides(
|
2021-07-16 12:20:01 +00:00
|
|
|
'nginx/vhosts/gitea',
|
2021-01-07 17:44:38 +00:00
|
|
|
)
|
2020-08-20 13:49:11 +00:00
|
|
|
def nginx(metadata):
|
|
|
|
if not node.has_bundle('nginx'):
|
|
|
|
raise DoNotRunAgain
|
|
|
|
|
|
|
|
return {
|
|
|
|
'nginx': {
|
|
|
|
'vhosts': {
|
2021-07-09 13:55:31 +00:00
|
|
|
'gitea': {
|
|
|
|
'domain': metadata.get('gitea/domain'),
|
2021-07-04 17:27:12 +00:00
|
|
|
'locations': {
|
2020-09-22 16:36:10 +00:00
|
|
|
'/': {
|
|
|
|
'target': 'http://127.0.0.1:22000',
|
|
|
|
},
|
2022-08-19 05:26:01 +00:00
|
|
|
'/debug': {
|
|
|
|
'return': 403,
|
|
|
|
},
|
2020-08-20 13:49:11 +00:00
|
|
|
},
|
2020-11-10 10:32:59 +00:00
|
|
|
'website_check_path': '/user/login',
|
|
|
|
'website_check_string': 'Sign In',
|
2020-08-20 13:49:11 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
2020-11-21 19:35:51 +00:00
|
|
|
|
|
|
|
|
2021-01-07 17:44:38 +00:00
|
|
|
@metadata_reactor.provides(
|
|
|
|
'icinga2_api/gitea/services',
|
|
|
|
)
|
2020-11-21 19:35:51 +00:00
|
|
|
def icinga_check_for_new_release(metadata):
|
|
|
|
return {
|
|
|
|
'icinga2_api': {
|
|
|
|
'gitea': {
|
|
|
|
'services': {
|
|
|
|
'GITEA UPDATE': {
|
2022-12-23 13:57:32 +00:00
|
|
|
# this is only temporary. We will switch to forgejo once they have their first stable release.
|
2022-12-24 12:45:44 +00:00
|
|
|
'command_on_monitored_host': '/usr/local/share/icinga/plugins/check_forgejo_for_new_release codeberg.org forgejo/forgejo v{}'.format(metadata.get('gitea/version')),
|
2020-12-05 08:17:21 +00:00
|
|
|
'vars.notification.mail': True,
|
2020-11-22 10:38:53 +00:00
|
|
|
'check_interval': '60m',
|
2020-11-21 19:35:51 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|