infobeamer-cms: initial commit

This commit is contained in:
Sophie Schiller 2021-12-23 13:48:44 +01:00
parent 38b449af35
commit bf125a73b1
4 changed files with 233 additions and 0 deletions

View file

@ -0,0 +1,47 @@
<%
from json import dumps
%>
# This github OAuth client will be used for authentication. Create
# one at https://github.com/organizations/ACCOUNT/settings/applications
GITHUB_CLIENT_ID = '${GITHUB_CLIENT_ID}'
GITHUB_CLIENT_SECRET = '${GITHUB_CLIENT_SECRET}'
SESSION_COOKIE_NAME = '${SESSION_COOKIE_NAME}'
PREFERRED_URL_SCHEME = '${PREFERRED_URL_SCHEME}'
# info-beamer API keys.
# This key needs access to setups and assets as well as the
# node-message calls. If you consider the host running this
# code trusted, you might use a key with full account access.
# The keys given out to users are adhoc keys based on this key.
HOSTED_API_KEY = '${HOSTED_API_KEY}'
# Maximum uploads per github user
MAX_UPLOADS = ${MAX_UPLOADS}
# Setup IDs using the scheduled player setup. One of the
# playlists must be named 'User Content'. Its pages will be
# autogenerated by the CMS when calling /sync
SETUP_IDS = ${SETUP_IDS}
# Generate some random string. It's used for signing
# urls send to moderators.
URL_KEY = '${URL_KEY}'
# Push notifications for moderation requests user pushover.
# Specify a target key and the app key to use.
PUSHOVER_TARGET = '${PUSHOVER_TARGET}'
PUSHOVER_APP_KEY = '${PUSHOVER_APP_KEY}'
# Unix timestamp allows for specifying start/end time
# of uploaded content
TIME_MIN = ${TIME_MIN}
TIME_MAX = ${TIME_MAX}
# change this to invalidate cached static files.
VERSION = ${VERSION}
# rooms. This is both used for the /last view as well
# as the interruption control on /interrupt.
ROOMS = ${dumps(node.metadata.get('infobeamer-cms/config/ROOMS', {}))}

View file

@ -0,0 +1,57 @@
git_deploy = {
'/opt/infobeamer-cms': {
'rev': 'MASTER',
'repo': 'https://github.com/sophieschi/36c3-cms.git',
'needs': {
'directory:/opt/infobeamer-cms',
},
'triggers': {
'svc_systemd:infobeamer-cms:restart',
},
},
}
directories = {
'/opt/infobeamer-cms': {},
}
files = {
'/opt/infobeamer-cms/settings.cfg': {
'content_type': 'mako',
'context': node.metadata.get('infobeamer-cms/config'),
'needs': {
'git_deploy:/opt/infobeamer-cms',
},
'triggers': {
'svc_systemd:infobeamer-cms:restart',
},
},
'/etc/systemd/system/infobeamer-cms.service': {
'triggers': {
'action:systemd-reload',
'svc_systemd:infobeamer-cms:restart',
},
}
}
pkg_pip = {
'github-flask': {
'needed_by': {
'git_deploy:/opt/infobeamer-cms',
},
},
}
svc_systemd = {
'infobeamer-cms': {
'needs': {
'file:/opt/infobeamer-cms/settings.cfg',
},
},
}
users = {
'infobeamer-cms': {
'home': '/opt/infobeamer-cms',
},
}

View file

@ -0,0 +1,86 @@
defaults = {
'apt': {
'packages': {
'gunicorn': {},
'python3-gevent': {},
'python3-flask': {},
'python3-redis': {},
'python3-virtualenv': {},
'python3-requests': {},
'python3-iso8601': {},
},
},
'infobeamer-cms': {
'config': {
'GITHUB_CLIENT_ID': 'encrypted1',
'GITHUB_CLIENT_SECRET': 'encryted2',
'SESSION_COOKIE_NAME': '__Host-sess',
'PREFERRED_URL_SCHEME': 'https',
'HOSTED_API_KEY': 'encrypted3',
'MAX_UPLOADS': 5,
'SETUP_IDS': '[123456]',
'URL_KEY': 'encrypted4',
'PUSHOVER_TARGET': 'encrypted5',
'PUSHOVER_APP_KEY': 'encrypted6',
'TIME_MIN': 1640039559,
'TIME_MAX': 1640905200,
'VERSION': 1,
'ROOMS': [
{
'name': 'Ada',
'device_id': 5919,
'interrupts': [
{
'name': 'Signal',
'data': 'signal',
},
],
},
{
'name': 'Borg',
'device_id': 5920,
'interrupts': [
{
'name': 'Signal',
'data': 'signal',
},
],
},
],
'unused': 'foobar',
},
},
}
@metadata_reactor.provides(
'nginx/vhosts',
)
def nginx(metadata):
if not node.has_bundle('nginx'):
raise DoNotRunAgain
locations = {
'/': {
'target': 'http://127.0.0.1:8000',
},
'/twitter/': {
'alias': '/export/twitter/',
},
'/static/': {
'alias': '/opt/infobeamer-cms/static',
},
}
vhosts = {
'infobeamer-cms': {
'locations': locations,
'website_check_path': '/',
'website_check_string': '',
},
}
return {
'nginx': {
'vhosts': vhosts
},
}

View file

@ -0,0 +1,43 @@
nodes['voc.infobeamer-cms'] = {
'hostname': 'pretalx.c3voc.de',
'bundles': {
'infobeamer-cms',
'redis',
},
'groups': {
'debian-buster',
'webserver',
},
'metadata': {
'apt': {
# Move patchday to somewhere where the possibility of
# clashing with actual events is less likely.
'unattended_upgrades': {
'day': 1,
},
},
'backups': {
'exclude_from_backups': True,
},
'interfaces': {
'default': {
'ips': {
'31.172.33.106/28',
'2a01:a700:48d1::106/64',
},
'gateway4': '31.172.33.110',
'gateway6': '2a01:a700:48d1::1',
},
},
'icinga_options': {
'pretty_name': 'infobeamer-cms.c3voc.de',
},
'nginx': {
'vhosts': {
'infobeamer-cms': {
'domain': 'infobeamer-cms.c3voc.de',
},
},
},
},
}