bundlewrap/bundles/gitea/items.py

71 lines
1.8 KiB
Python

users = {
'git': {},
}
directories = {
'/home/git': {
'mode': '0755',
'owner': 'git',
'group': 'git',
},
'/home/git/.ssh': {
'mode': '0755',
'owner': 'git',
'group': 'git',
},
'/var/lib/gitea': {
'owner': 'git',
'mode': '0700',
'triggers': {
'svc_systemd:gitea:restart',
},
},
}
files = {
'/etc/systemd/system/gitea.service': {
'content_type': 'mako',
'context': node.metadata.get('gitea'),
'triggers': {
'action:systemd-reload',
'svc_systemd:gitea:restart',
},
},
'/etc/gitea/app.ini': {
'content_type': 'mako',
'context': node.metadata.get('gitea'),
'triggers': {
'svc_systemd:gitea:restart',
},
},
'/usr/local/bin/gitea': {
'content_type': 'download',
#'source': 'https://dl.gitea.io/gitea/{version}/gitea-{version}-linux-amd64'.format(version=node.metadata.get('gitea/version')),
'source': 'https://github.com/go-gitea/gitea/releases/download/v{version}/gitea-{version}-linux-amd64'.format(
version=node.metadata.get('gitea/version'),
),
'content_hash': node.metadata.get('gitea/sha1', None),
'mode': '0755',
'preceded_by': {
'svc_systemd:gitea:stop',
},
},
}
if node.metadata['gitea'].get('install_ssh_key', False):
files['/home/git/.ssh/id_ed25519'] = {
'content': repo.vault.decrypt_file(f'gitea/files/ssh-keys/{node.name}.key.vault'),
'mode': '0600',
'owner': 'git',
'group': 'git',
}
svc_systemd = {
'gitea': {
'needs': {
'file:/etc/gitea/app.ini',
'file:/etc/systemd/system/gitea.service',
'file:/usr/local/bin/gitea',
},
},
}