gollum wip

This commit is contained in:
mwiegand 2021-10-26 00:14:32 +02:00
parent 2ecef5446a
commit 1a1121e010
3 changed files with 117 additions and 1 deletions

61
bundles/gollum/items.py Normal file
View file

@ -0,0 +1,61 @@
from shlex import quote
users = {
'gollum': {
'home': '/var/lib/gollum',
}
}
directories = {
'/opt/gollum': {
'owner': 'gollum',
},
'/opt/gollum/.bundle': {
'owner': 'gollum',
},
'/var/lib/gollum': {
'owner': 'gollum',
},
}
files = {
'/opt/gollum/.bundle/config': {
'content': 'BUNDLE_PATH: ".bundle/gems"',
}
}
git_deploy = {
'/opt/gollum': {
'repo': 'https://github.com/gollum/gollum.git',
'rev': f"v{node.metadata.get('gollum/version')}",
},
'/var/lib/gollum': {
'repo': node.metadata.get('gollum/wiki'),
'rev': 'main',
'unless': 'test -e /var/lib/gollum/.git',
},
}
def run(cmd):
return f"su gollum -c " + quote(f"cd /opt/gollum && {cmd}")
actions = {
'gollum_install_bundler': {
'command': run("gem install bundler --user"),
'unless': run("gem list -i bundler"),
'needs': [
'file:/opt/gollum/.bundle/config',
],
},
'gollum_bundle_install': {
'command': run("$(ruby -e 'puts Gem.user_dir')/bin/bundle install"),
'unless': run("$(ruby -e 'puts Gem.user_dir')/bin/bundle check"),
'needs': [
'git_deploy:/opt/gollum',
'action:gollum_install_bundler',
],
},
}
# TODO: AUTH
#https://github.com/bjoernalbers/gollum-auth

View file

@ -0,0 +1,49 @@
defaults = {
'apt': {
'packages': {
'libgit2-dev': {},
'libssl-dev': {},
'cmake': {},
},
},
'systemd': {
'units': {
'gollum.service': {
'Unit': {
'Description': 'gollum',
'After': 'syslog.target',
'After': 'network.target',
'Requires': 'postgresql.service',
},
'Service': {
'User': 'gollum',
'Group': 'gollum',
'WorkingDirectory': '/opt/gollum',
'ExecStart': 'true',
'Restart': 'always',
},
'Install': {
'WantedBy': {'multi-user.target'},
},
},
},
},
}
@metadata_reactor.provides(
'nginx/vhosts',
)
def nginx(metadata):
return {
'nginx': {
'vhosts': {
metadata.get('gollum/domain'): {
'content': 'nginx/proxy_pass.conf',
'context': {
'target': 'http://127.0.0.1:3600',
}
},
},
},
}

View file

@ -16,6 +16,7 @@
'redis',
'wireguard',
'zfs',
'gollum',
],
'metadata': {
'id': 'af96709e-b13f-4965-a588-ef2cd476437a',
@ -27,10 +28,15 @@
},
},
'gitea': {
'version': '1.14.2',
'version': '1.15.5',
'sha256': '0d11d87ce60d5d98e22fc52f2c8c6ba2b54b14f9c26c767a46bf102c381ad128',
'domain': 'git.sublimity.de',
},
'gollum': {
'domain': 'wiki.sublimity.de',
'wiki': 'https://git.sublimity.de/cronekorkn/wiki.git',
'version': '5.2.3',
},
'grafana': {
'hostname': 'grafana.sublimity.de',
'influxdb_node': 'home.server',