bundlewrap/bundles/forgejo/metadata.py

108 lines
3.1 KiB
Python
Raw Normal View History

2020-08-20 13:34:27 +00:00
defaults = {
2020-11-13 11:37:26 +00:00
'backups': {
'paths': {
2023-08-02 14:37:48 +00:00
'/var/lib/forgejo',
2020-11-13 11:37:26 +00:00
},
},
2023-08-02 14:37:48 +00:00
'forgejo': {
2023-01-29 08:42:36 +00:00
'app_name': 'Forgejo',
2020-08-20 13:34:27 +00:00
'database': {
2023-08-02 14:37:48 +00:00
'username': 'forgejo',
'password': repo.vault.password_for('{} postgresql forgejo'.format(node.name)),
'database': 'forgejo',
2020-08-20 13:34:27 +00:00
},
'disable_registration': True,
'email_domain_blocklist': set(),
'enable_git_hooks': False,
2023-08-02 14:37:48 +00:00
'internal_token': repo.vault.password_for('{} forgejo internal_token'.format(node.name)),
'lfs_secret_key': repo.vault.password_for('{} forgejo lfs_secret_key'.format(node.name)),
'oauth_secret_key': repo.vault.password_for('{} forgejo oauth_secret_key'.format(node.name)),
'security_secret_key': repo.vault.password_for('{} forgejo security_secret_key'.format(node.name)),
2020-08-20 13:34:27 +00:00
},
2020-11-10 10:32:59 +00:00
'icinga2_api': {
2023-08-02 14:37:48 +00:00
'forgejo': {
2020-11-10 10:32:59 +00:00
'services': {
2023-01-29 08:42:36 +00:00
'FORGEJO PROCESS': {
2023-08-02 14:37:48 +00:00
'command_on_monitored_host': '/usr/local/share/icinga/plugins/check_systemd_unit forgejo',
2020-11-10 10:32:59 +00:00
},
'FORGEJO UPDATE': {
'vars.notification.mail': True,
'check_interval': '60m',
},
2020-11-10 10:32:59 +00:00
},
},
},
'openssh': {
'allowed_users': {
'git',
},
},
2020-08-20 13:34:27 +00:00
'postgresql': {
'roles': {
2023-08-02 14:37:48 +00:00
'forgejo': {
'password': repo.vault.password_for('{} postgresql forgejo'.format(node.name)),
2020-08-20 13:34:27 +00:00
},
},
'databases': {
2023-08-02 14:37:48 +00:00
'forgejo': {
'owner': 'forgejo',
2020-08-20 13:34:27 +00:00
},
},
},
'zfs': {
'datasets': {
2023-08-02 14:37:48 +00:00
'tank/forgejo': {
'mountpoint': '/var/lib/forgejo',
'needed_by': {
2023-08-02 14:37:48 +00:00
'directory:/var/lib/forgejo',
},
},
},
},
2020-08-20 13:34:27 +00:00
}
2023-09-09 19:09:30 +00:00
@metadata_reactor.provides(
'icinga2_api/forgejo',
)
def update_monitoring(metadata):
return {
'icinga2_api': {
'forgejo': {
'services': {
'FORGEJO UPDATE': {
'command_on_monitored_host': '/usr/local/share/icinga/plugins/check_forgejo_for_new_release codeberg.org forgejo/forgejo v{}'.format(metadata.get('forgejo/version')),
},
},
},
},
}
@metadata_reactor.provides(
2023-01-29 08:42:36 +00:00
'nginx/vhosts/forgejo',
)
def nginx(metadata):
if not node.has_bundle('nginx'):
raise DoNotRunAgain
return {
'nginx': {
'vhosts': {
2023-01-29 08:42:36 +00:00
'forgejo': {
2023-08-02 14:37:48 +00:00
'domain': metadata.get('forgejo/domain'),
'locations': {
'/': {
'target': 'http://127.0.0.1:22000',
},
'/debug': {
'return': 403,
},
},
2020-11-10 10:32:59 +00:00
'website_check_path': '/user/login',
'website_check_string': 'Sign In',
},
},
},
}