freifunk/voctoweb

Name: voctoweb

Owner: Freifunk

Description: voctoweb ? the frontend and backend software behind media.ccc.de

Forked from: voc/voctoweb

Created: 2017-10-09 14:52:29.0

Updated: 2018-01-01 09:51:25.0

Pushed: 2018-01-18 11:49:16.0

Homepage:

Size: 6699

Language: Ruby

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

media.ccc.de

media.ccc.de webfrontend, meta data editor and API.

Build Status Code Climate

APIs

Every talk (alias event, in other systems also called lecture or session) is assigned to exactly one conference (e.g. the congress or lecture series like datengarten or openchaos) and consists of multiple files alias recordings. These files can be video or audio recordings of the talk in different formats and languages (live-translation), subtitle tracks as srt or slides as pdf.

Public JSON API

The public API provides a programatic access to the data behind media.ccc.de. Consumers of this API are typically player apps for different eco systems, see https://media.ccc.de/about.html#apps for a 'full' list. The whole API is “discoverable” starting from https://api.media.ccc.de/public/conferences ; Available methods:

/public/conferences
/public/conferences/:id
/public/conferences/:acronym
/public/events
/public/events/:id
/public/events/:guid
/public/events/search?q=:term
/public/recordings
/public/recordings/:id

The id's are internal database ids, not to be confused with remote talk ids (alias pentabarf/frab id), e.g. https://media.ccc.de/public/events/2935 which is also accessible via https://media.ccc.de/public/events/f9d33869-f9a2-4570-9e9a-25c56e32082a. Same for conferences: https://media.ccc.de/public/conferences/54 is the same response as https://media.ccc.de/public/conferences/31c3.

Example:

curl -H "CONTENT-TYPE: application/json" http://localhost:3000/public/conferences

The resulting JSON will contain URLs to each of the individual conferences.

Additionally the API for events and recordings uses RFC-5988 HTTP header based pagination to reduce the server load.

curl -H "CONTENT-TYPE: application/json" "http://localhost:3000/public/events?page=10"
Private REST API

The private API is used by our (video) production teams. They manage the content by adding new conferences, events and other files (so called recordings). All API calls need to use the JSON format. An example API client can be found as part of our publishing-script repository: https://github.com/voc/publishing/

Most REST operations work as expected. Examples for resource creation are listed on the applications dashboard page.

You can use the API to register a new conference. The conference acronym and the URL of the schedule.xml are required. However folders and access rights need to be setup manually, before you can upload images and videos.

curl -H "CONTENT-TYPE: application/json" -d '{
    "api_key":"4","acronym":"frab123",
    "conference":{
      "recordings_path":"conference/frab123",
      "images_path":"events/frab",
      "slug":"event/frab/frab123",
      "aspect_ratio":"16:9",
      "title":null,
      "schedule_url":"http://progam/schedule.xml"
    }
  }' "http://localhost:3000/api/conferences"

You can add images to an event, like the poster image. The event is identified by its guid and the conference acronym.

curl -H "CONTENT-TYPE: application/json" -d '{
    "api_key":"4",
    "acronym":"frab123",
    "poster_url":"http://koeln.ccc.de/images/chaosknoten_preview.jpg",
    "thumb_url":"http://koeln.ccc.de/images/chaosknoten.jpg",
    "event":{
      "guid":"123",
      "slug":"123",
      "title":"qwerty"
    }
  }' "http://localhost:3000/api/events"

Recordings are added by specifiying the parent events guid, an URL and a filename. The recording length is specified in seconds.

 -H "CONTENT-TYPE: application/json" -d '{
"api_key":"4",
"guid":"123",
"recording":{
  "filename":"some.mp4",
  "folder":"h264-hd",
  "mime_type":"video/mp4",
  "language":"deu"
  "size":"12",
  "length":"3600"
  }
 "http://localhost:3000/api/recordings"

Create news items

/api/news

Update promoted flag of events by view count

/api/events/update_promoted

Update view counts of events viewed in the last 30 minutes

/api/events/update_view_counts
Setup Development-Server
r ubuntu and debian one might want to install vagrant from upstream
ttps://www.vagrantup.com/downloads.html), because of a packaging bug:
tps://bugs.debian.org/cgi-bin/bugreport.cgi?bug=818237
do apt-get install vagrant virtualbox

grant plugin install vagrant-hostsupdater
grant up
grant ssh -c 'cd /vagrant && ./bin/update-data'

://media.ccc.vm:3000/ <- Frontend
://media.ccc.vm:3000/admin/ <- Backend
end-Login:
ername: admin@example.org
ssword: media123
Install for Production
Ruby Version

ruby 2.4.1

Dependencies
Quickstart / Development Notes
or ubuntu 15.10

stall deps for ruby
 apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev \
aml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev \
on-software-properties libffi-dev libgdbm-dev libncurses5-dev automake libtool bison

stall deps for media.ccc.de
 apt-get install redis-server libpqxx-dev

stall node.js
 apt-get install nodejs

stall rvm
--keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
l -O https://raw.githubusercontent.com/rvm/rvm/master/binscripts/rvm-installer
l -O https://raw.githubusercontent.com/rvm/rvm/master/binscripts/rvm-installer.asc
--verify rvm-installer.asc
 rvm-installer stable
ce ~/.rvm/scripts/rvm

stall ruby 2.4.1
install ruby-2.4.1

stall bundler
install bundler

stgresql setup
 -u postgres -i
teuser -d -P media

taining & setting up a voctoweb instance
clone git@github.com:voc/voctoweb.git
octoweb
le install
n/setup
 db:migrate
 db:fixtures:load
Run Development-Server manually
ce ~/.rvm/scripts/rvm
s server -b 0.0.0.0

ne
://localhost:3000/ <- Frontend
://localhost:3000/admin/ <- Backend
end-Login:
ername: admin@example.org
ssword: media123
Production Deployment Notes

Copy and edit the configuration file config/settings.yml.template to config/settings.yml.

You need to create a secret token for sessions, copy env.example to .env.production and edit.

Asset creation

Compile your assets with `RAILS_ENV=production bin/rails assets:precompile`

Database Creation & Fixtures import

Setup your database in config/database.yml needed.

rake db:setup
./bin/update-data
Services (job queues, cache servers, search engines, etc.)
sidekiq
Puma
sr/bin/env puma

ctory '/srv/www/media-site/current'
up "/srv/www/media-site/current/config.ru"
ronment 'production'

ile "/srv/www/media-site/shared/tmp/pids/puma.pid"
e_path "/srv/www/media-site/shared/tmp/pids/puma.state"
ut_redirect '/srv/www/media-site/current/log/puma.error.log', '/srv/www/media-site/current/log/puma.access.log', true

ads 4,16

 'unix:///srv/www/media-site/shared/tmp/sockets/media-site-puma.sock'
 'tcp://127.0.0.1:3080'

ers 2

estart do
ts 'Refreshing Gemfile'
V["BUNDLE_GEMFILE"] = "/srv/www/media-site/current/Gemfile"

First Login

Login as user admin@example.org with password media123. Change these values after the first login.


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.