voctoweb – the frontend and backend software behind media.ccc.de
Clone or download
Mario Manno
Latest commit 7632533 Oct 9, 2018
Permalink
Failed to load latest commit information.
.bundle Add bundler config to replace insecure git:// protocol downloads with… Apr 1, 2017
app Merge pull request #327 from blinry/timelens Oct 3, 2018
bin cleanup received demo-data for a working dev-env Nov 16, 2017
config add harmony: true to Uglifier init, refers to #331 Oct 9, 2018
db Add Timelens support, to improve video navigation capabilities Oct 1, 2018
lib Fixes to playlist feature Jul 12, 2018
log initial rails project May 23, 2013
public Replace TV logo with voctocat Mar 1, 2017
test Add Timelens support, to improve video navigation capabilities Oct 1, 2018
vendor/assets Add Timelens support, to improve video navigation capabilities Oct 1, 2018
.codeclimate.yml new codeclimate config Jan 5, 2016
.dockerignore Basic Docker containerization for development May 28, 2018
.env.development Add relive player (#273) Jul 8, 2018
.env.test Add relive player (#273) Jul 8, 2018
.gitignore Merge branch 'bug-235-event-date' of git://github.com/dedeibel/voctow… Aug 13, 2017
.rubocop.yml Add relive player (#273) Jul 8, 2018
.travis.yml Add new Ruby versions to travis Jul 4, 2018
Capfile add mqtt notifications to deployment Apr 24, 2016
Dockerfile Basic Docker containerization for development May 28, 2018
Gemfile Update activeadmin to fix search Jul 10, 2018
Gemfile.lock Update activeadmin to fix search Jul 10, 2018
LICENSE.txt Add gplv3 license Nov 16, 2017
Procfile remove puma.rb from procfile Mar 31, 2016
README.md Merge pull request #327 from blinry/timelens Oct 3, 2018
Rakefile initial rails project May 23, 2013
Vagrantfile Remove hostsupdater plugin from vagrant dev setup Jul 3, 2018
config.ru initial rails project May 23, 2013
docker-compose.yml Basic Docker containerization for development May 28, 2018
env.example Add relive player (#273) Jul 8, 2018

README.md

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. For an explanation what the timeline_url and thumbnails_url parameters are, see https://timelens.io.

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",
    "timeline_url":"http://koeln.ccc.de/images/chaosknoten.timeline.jpg",
    "thumbnails_url":"http://koeln.ccc.de/images/chaosknoten.thumbnails.vtt",
    "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.

curl -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

Set up development environment

A convenient way to set up an environment for developing voctoweb is Docker.

First, install Docker and Docker Compose – you will probably find them in your distribution's package manager.

Then, clone this repository, make it your working directory, and run the following commands:

cp config/database.yml.docker config/database.yml
cp config/settings.yml.template config/settings.yml
docker-compose build
docker-compose run voctoweb rake db:setup
docker-compose run voctoweb bin/update-data
docker-compose up

You can now reach the voctoweb frontend at http://localhost:3000. The backend is at http://localhost:3000/admin/, with the default username admin@example.org and the password media123. You can stop the running containers using Ctrl-C. To start them again, just run docker-compose up.

The whole application directory is mounted into the containers, so all changes you make to the files are reflected inside the application automatically. To run commands inside the voctoweb container, run docker-compose run voctoweb $COMMAND. If you ever need to rebuild the containers (because of new dependencies, for example), run the docker-compose build command again.

Install for Production

Ruby Version

ruby 2.4.1

Dependencies

  • redis-server >= 2.8
  • elasticsearch
  • postgresql
  • nodejs

Quickstart / Development Notes

## for ubuntu 15.10

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

# install deps for voctoweb
sudo apt-get install redis-server libpqxx-dev

# install node.js
sudo apt-get install nodejs

# install rvm
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
\curl -O https://raw.githubusercontent.com/rvm/rvm/master/binscripts/rvm-installer
\curl -O https://raw.githubusercontent.com/rvm/rvm/master/binscripts/rvm-installer.asc
gpg --verify rvm-installer.asc
bash rvm-installer stable
source ~/.rvm/scripts/rvm

# install ruby 2.4.1
rvm install ruby-2.4.1

# install bundler
gem install bundler

# postgresql setup
sudo -u postgres -i
createuser -d -P voctoweb

# obtaining & setting up a voctoweb instance
git clone git@github.com:voc/voctoweb.git
cd voctoweb
bundle install
./bin/setup
rake db:migrate
rake db:fixtures:load

Run Development-Server manually

source ~/.rvm/scripts/rvm
rails server -b 0.0.0.0

# done
http://localhost:3000/ <- Frontend
http://localhost:3000/admin/ <- Backend
Backend-Login:
  Username: admin@example.org
  Password: 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.

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

#!/usr/bin/env puma

directory '/srv/www/media-site/current'
rackup "/srv/www/media-site/current/config.ru"
environment 'production'

pidfile "/srv/www/media-site/shared/tmp/pids/puma.pid"
state_path "/srv/www/media-site/shared/tmp/pids/puma.state"
stdout_redirect '/srv/www/media-site/current/log/puma.error.log', '/srv/www/media-site/current/log/puma.access.log', true

threads 4,16

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

workers 2

on_restart do
  puts 'Refreshing Gemfile'
  ENV["BUNDLE_GEMFILE"] = "/srv/www/media-site/current/Gemfile"
end

First Login

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