From b4260a4ed17a4b40d365e684979850f7e3e5a95b Mon Sep 17 00:00:00 2001 From: jam Date: Sat, 4 Jan 2014 07:40:08 -0600 Subject: [PATCH 1/9] adde icecast file to gem library --- db/manifest | 1 + ruby/lib/jam_ruby.rb | 1 + 2 files changed, 2 insertions(+) diff --git a/db/manifest b/db/manifest index 6ddf7a6aa..340b63e20 100755 --- a/db/manifest +++ b/db/manifest @@ -81,3 +81,4 @@ notification_band_invite.sql band_photo_filepicker.sql bands_geocoding.sql store_s3_filenames.sql +icecast.sql \ No newline at end of file diff --git a/ruby/lib/jam_ruby.rb b/ruby/lib/jam_ruby.rb index bf158efb0..6e69914d4 100755 --- a/ruby/lib/jam_ruby.rb +++ b/ruby/lib/jam_ruby.rb @@ -83,6 +83,7 @@ require "jam_ruby/models/mix" require "jam_ruby/models/claimed_recording" require "jam_ruby/models/crash_dump" require "jam_ruby/models/isp_score_batch" +require "jam_ruby/models/icecast_limit" include Jampb From 8b3d1abd5c44dc511a9d2d1ad180e359da457e09 Mon Sep 17 00:00:00 2001 From: Anthony Davis Date: Tue, 7 Jan 2014 13:40:26 -0600 Subject: [PATCH 2/9] VRFS-923 - pushing a pretend delete. will review Jenkins --- ruby/spec/spec_helper.rb | 4 ++++ ruby/spec/support/utilities.rb | 15 ++++++++++++++- web/spec/spec_helper.rb | 12 +++++++----- web/spec/support/utilities.rb | 33 +++++++++++++++++++++++++++++++++ 4 files changed, 58 insertions(+), 6 deletions(-) diff --git a/ruby/spec/spec_helper.rb b/ruby/spec/spec_helper.rb index 9a43ca42f..77cdf2ddd 100644 --- a/ruby/spec/spec_helper.rb +++ b/ruby/spec/spec_helper.rb @@ -78,6 +78,10 @@ Spork.prefork do DatabaseCleaner.clean end + config.after(:suite) do + wipe_s3_test_bucket + end + # If you're not using ActiveRecord, or you'd prefer not to run each of your # examples within a transaction, remove the following line or assign false # instead of true. diff --git a/ruby/spec/support/utilities.rb b/ruby/spec/support/utilities.rb index 822d07c51..9a22c1b8d 100644 --- a/ruby/spec/support/utilities.rb +++ b/ruby/spec/support/utilities.rb @@ -1,8 +1,9 @@ +JAMKAZAM_TESTING_BUCKET = 'jamkazam-testing' # cuz i'm not comfortable using aws_bucket accessor directly def app_config klass = Class.new do def aws_bucket - 'jamkazam-testing' + JAMKAZAM_TESTING_BUCKET end def aws_access_key_id @@ -15,4 +16,16 @@ def app_config end return klass.new +end + +def wipe_s3_test_bucket + test_config = app_config + s3 = AWS::S3.new(:access_key_id => test_config.aws_access_key_id, + :secret_access_key => test_config.aws_secret_access_key) + test_bucket = s3.buckets[JAMKAZAM_TESTING_BUCKET] + + if test_bucket.name == JAMKAZAM_TESTING_BUCKET + puts "Ruby - Pretending to delete all contents of #{test_bucket.name}" + #test_bucket.delete_all + end end \ No newline at end of file diff --git a/web/spec/spec_helper.rb b/web/spec/spec_helper.rb index 968e32400..aa70cebc0 100644 --- a/web/spec/spec_helper.rb +++ b/web/spec/spec_helper.rb @@ -99,10 +99,11 @@ Spork.prefork do config.include Snapshot config.before(:suite) do + set_up_snapshot end config.before(:all) do - set_up_snapshot + end config.before(:each) do @@ -120,10 +121,6 @@ Spork.prefork do config.before(:each, :js => true) do end - config.before(:each) do - - end - config.append_after(:each) do Capybara.reset_sessions! @@ -144,7 +141,12 @@ Spork.prefork do end config.after(:all) do + + end + + config.after(:suite) do tear_down_snapshot + wipe_s3_test_bucket end end end diff --git a/web/spec/support/utilities.rb b/web/spec/support/utilities.rb index c8a076009..f755a6e48 100644 --- a/web/spec/support/utilities.rb +++ b/web/spec/support/utilities.rb @@ -29,6 +29,39 @@ def cookie_jar Capybara.current_session.driver.browser.current_session.instance_variable_get(:@rack_mock_session).cookie_jar end +#these S3 functions copied from ruby/spec/support/utilities.rb +JAMKAZAM_TESTING_BUCKET = 'jamkazam-testing' # cuz i'm not comfortable using aws_bucket accessor directly + +def app_config + klass = Class.new do + def aws_bucket + JAMKAZAM_TESTING_BUCKET + end + + def aws_access_key_id + 'AKIAJESQY24TOT542UHQ' + end + + def aws_secret_access_key + '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' + end + end + + return klass.new +end + +def wipe_s3_test_bucket + test_config = app_config + s3 = AWS::S3.new(:access_key_id => test_config.aws_access_key_id, + :secret_access_key => test_config.aws_secret_access_key) + test_bucket = s3.buckets[JAMKAZAM_TESTING_BUCKET] + + if test_bucket.name == JAMKAZAM_TESTING_BUCKET + puts "Web - Pretending to delete all contents of #{test_bucket.name}" + #test_bucket.delete_all + end +end +# --end of S3 methods copied from ruby/spec/support/utilities.rb def sign_in(user) From 932f59cea62bdbefa315000ba4e83f2a4273e486 Mon Sep 17 00:00:00 2001 From: jam Date: Tue, 7 Jan 2014 14:29:40 -0600 Subject: [PATCH 3/9] Icecast models --- .../models/icecast_admin_authentication.rb | 9 +++++++++ ruby/lib/jam_ruby/models/icecast_directory.rb | 9 +++++++++ ruby/lib/jam_ruby/models/icecast_limit.rb | 10 ++++++++++ .../jam_ruby/models/icecast_listen_socket.rb | 8 ++++++++ ruby/lib/jam_ruby/models/icecast_logging.rb | 9 +++++++++ .../jam_ruby/models/icecast_mastersvr_relay.rb | 7 +++++++ ruby/lib/jam_ruby/models/icecast_mount.rb | 9 +++++++++ ruby/lib/jam_ruby/models/icecast_path.rb | 9 +++++++++ ruby/lib/jam_ruby/models/icecast_relay.rb | 8 ++++++++ ruby/lib/jam_ruby/models/icecast_sercurity.rb | 9 +++++++++ ruby/lib/jam_ruby/models/icecast_server.rb | 18 ++++++++++++++++++ ruby/lib/jam_ruby/models/icecast_servermisc.rb | 7 +++++++ .../models/icecast_user_authentication.rb | 8 ++++++++ 13 files changed, 120 insertions(+) create mode 100644 ruby/lib/jam_ruby/models/icecast_admin_authentication.rb create mode 100644 ruby/lib/jam_ruby/models/icecast_directory.rb create mode 100644 ruby/lib/jam_ruby/models/icecast_limit.rb create mode 100644 ruby/lib/jam_ruby/models/icecast_listen_socket.rb create mode 100644 ruby/lib/jam_ruby/models/icecast_logging.rb create mode 100644 ruby/lib/jam_ruby/models/icecast_mastersvr_relay.rb create mode 100644 ruby/lib/jam_ruby/models/icecast_mount.rb create mode 100644 ruby/lib/jam_ruby/models/icecast_path.rb create mode 100644 ruby/lib/jam_ruby/models/icecast_relay.rb create mode 100644 ruby/lib/jam_ruby/models/icecast_sercurity.rb create mode 100644 ruby/lib/jam_ruby/models/icecast_server.rb create mode 100644 ruby/lib/jam_ruby/models/icecast_servermisc.rb create mode 100644 ruby/lib/jam_ruby/models/icecast_user_authentication.rb diff --git a/ruby/lib/jam_ruby/models/icecast_admin_authentication.rb b/ruby/lib/jam_ruby/models/icecast_admin_authentication.rb new file mode 100644 index 000000000..3abd1696c --- /dev/null +++ b/ruby/lib/jam_ruby/models/icecast_admin_authentication.rb @@ -0,0 +1,9 @@ +module JamRuby + class IcecastAdminAuthentication < ActiveRecord::Base + + self.primary_key = 'id' + + validates :source_password, length: {minimum: 5} + + end +end \ No newline at end of file diff --git a/ruby/lib/jam_ruby/models/icecast_directory.rb b/ruby/lib/jam_ruby/models/icecast_directory.rb new file mode 100644 index 000000000..7d5fd4b45 --- /dev/null +++ b/ruby/lib/jam_ruby/models/icecast_directory.rb @@ -0,0 +1,9 @@ +module JamRuby + class IcecastDirectory < ActiveRecord::Base + + self.primary_key = 'id' + + + + end +end \ No newline at end of file diff --git a/ruby/lib/jam_ruby/models/icecast_limit.rb b/ruby/lib/jam_ruby/models/icecast_limit.rb new file mode 100644 index 000000000..ea6b0e727 --- /dev/null +++ b/ruby/lib/jam_ruby/models/icecast_limit.rb @@ -0,0 +1,10 @@ +module JamRuby + class IcecastLimit < ActiveRecord::Base + + self.primary_key = 'id' + + validates :clients, numericality: {only_integer: true} + + + end +end \ No newline at end of file diff --git a/ruby/lib/jam_ruby/models/icecast_listen_socket.rb b/ruby/lib/jam_ruby/models/icecast_listen_socket.rb new file mode 100644 index 000000000..f6d13f7c0 --- /dev/null +++ b/ruby/lib/jam_ruby/models/icecast_listen_socket.rb @@ -0,0 +1,8 @@ +module JamRuby + class IcecastListenSocket < ActiveRecord::Base + + self.primary_key = 'id' + + + end +end \ No newline at end of file diff --git a/ruby/lib/jam_ruby/models/icecast_logging.rb b/ruby/lib/jam_ruby/models/icecast_logging.rb new file mode 100644 index 000000000..457afc2a2 --- /dev/null +++ b/ruby/lib/jam_ruby/models/icecast_logging.rb @@ -0,0 +1,9 @@ +module JamRuby + class IcecastLogging < ActiveRecord::Base + + self.primary_key = 'id' + + + + end +end \ No newline at end of file diff --git a/ruby/lib/jam_ruby/models/icecast_mastersvr_relay.rb b/ruby/lib/jam_ruby/models/icecast_mastersvr_relay.rb new file mode 100644 index 000000000..2ff4239f0 --- /dev/null +++ b/ruby/lib/jam_ruby/models/icecast_mastersvr_relay.rb @@ -0,0 +1,7 @@ +module JamRuby + class IcecastMastersvrRelay < ActiveRecord::Base + + self.primary_key = 'id' + + end +end \ No newline at end of file diff --git a/ruby/lib/jam_ruby/models/icecast_mount.rb b/ruby/lib/jam_ruby/models/icecast_mount.rb new file mode 100644 index 000000000..6627f3ddd --- /dev/null +++ b/ruby/lib/jam_ruby/models/icecast_mount.rb @@ -0,0 +1,9 @@ +module JamRuby + class IcecastMount < ActiveRecord::Base + + self.primary_key = 'id' + + has_one :authentication, :class_name => "IcecastUserAuthentication" + + end +end \ No newline at end of file diff --git a/ruby/lib/jam_ruby/models/icecast_path.rb b/ruby/lib/jam_ruby/models/icecast_path.rb new file mode 100644 index 000000000..434d7839c --- /dev/null +++ b/ruby/lib/jam_ruby/models/icecast_path.rb @@ -0,0 +1,9 @@ +module JamRuby + class IcecastPath < ActiveRecord::Base + + self.primary_key = 'id' + + + + end +end \ No newline at end of file diff --git a/ruby/lib/jam_ruby/models/icecast_relay.rb b/ruby/lib/jam_ruby/models/icecast_relay.rb new file mode 100644 index 000000000..e0228df0f --- /dev/null +++ b/ruby/lib/jam_ruby/models/icecast_relay.rb @@ -0,0 +1,8 @@ +module JamRuby + class IcecastRelay < ActiveRecord::Base + + self.primary_key = 'id' + + + end +end \ No newline at end of file diff --git a/ruby/lib/jam_ruby/models/icecast_sercurity.rb b/ruby/lib/jam_ruby/models/icecast_sercurity.rb new file mode 100644 index 000000000..510fd95c3 --- /dev/null +++ b/ruby/lib/jam_ruby/models/icecast_sercurity.rb @@ -0,0 +1,9 @@ +module JamRuby + class IcecastSecurity < ActiveRecord::Base + + self.primary_key = 'id' + + + + end +end \ No newline at end of file diff --git a/ruby/lib/jam_ruby/models/icecast_server.rb b/ruby/lib/jam_ruby/models/icecast_server.rb new file mode 100644 index 000000000..f015f35ac --- /dev/null +++ b/ruby/lib/jam_ruby/models/icecast_server.rb @@ -0,0 +1,18 @@ +module JamRuby + class IcecastServer < ActiveRecord::Base + + self.primary_key = 'id' + + has_one :limit, :class_name => "JamRuby::IcecastLimit" + has_one :adminauth, :class_name => "JamRuby::IcecastAdminAuthentication" + has_one :directory, :class_name => "JamRuby::IcecastDirectory" + has_one :misc, :class_name => "JamRuby::IcecastServermisc" + has_many :listen_sockets, :class_name => "JamRuby::IcecastListenSocket" + has_one :master_relay, :class_name => "JamRuby::IcecastMastersvrRelay" + has_one :relay, :class_name => "JamRuby::IcecastRelay" + has_many :mounts, :class_name => "JamRuby::IcecastMount" + has_one :path, :class_name => "JamRuby::IcecastPath" + has_one :logging, :class_name => "JamRuby::IcecastLogging" + has_one :security, :class_name => "JamRuby::IceCastSecurity" + end +end \ No newline at end of file diff --git a/ruby/lib/jam_ruby/models/icecast_servermisc.rb b/ruby/lib/jam_ruby/models/icecast_servermisc.rb new file mode 100644 index 000000000..d620f032e --- /dev/null +++ b/ruby/lib/jam_ruby/models/icecast_servermisc.rb @@ -0,0 +1,7 @@ +module JamRuby + class IcecastServermisc < ActiveRecord::Base + + self.primary_key = 'id' + + end +end \ No newline at end of file diff --git a/ruby/lib/jam_ruby/models/icecast_user_authentication.rb b/ruby/lib/jam_ruby/models/icecast_user_authentication.rb new file mode 100644 index 000000000..ec6974093 --- /dev/null +++ b/ruby/lib/jam_ruby/models/icecast_user_authentication.rb @@ -0,0 +1,8 @@ +module JamRuby + class IcecastUserAuthentication < ActiveRecord::Base + + self.primary_key = 'id' + + + end +end \ No newline at end of file From 66558b70e9b7901ebad7444a29942c45cf942434 Mon Sep 17 00:00:00 2001 From: jam Date: Tue, 7 Jan 2014 14:30:06 -0600 Subject: [PATCH 4/9] Icecast test models --- .../icecast_admin_authentication_spec.rb | 20 +++++++++++++++++++ .../jam_ruby/models/icecast_directory_spec.rb | 0 .../jam_ruby/models/icecast_limit_spec.rb | 20 +++++++++++++++++++ .../models/icecast_listen_socket_spec.rb | 0 .../jam_ruby/models/icecast_logging_spec.rb | 0 .../models/icecast_mastersvr_relay_spec.rb | 0 .../jam_ruby/models/icecast_mount_spec.rb | 0 .../spec/jam_ruby/models/icecast_path_spec.rb | 0 .../jam_ruby/models/icecast_relay_spec.rb | 0 .../jam_ruby/models/icecast_security_spec.rb | 0 .../jam_ruby/models/icecast_server_spec.rb | 0 .../models/icecast_servermisc_spec.rb | 0 .../icecast_user_authentication_spec.rb | 0 13 files changed, 40 insertions(+) create mode 100644 ruby/spec/jam_ruby/models/icecast_admin_authentication_spec.rb create mode 100644 ruby/spec/jam_ruby/models/icecast_directory_spec.rb create mode 100644 ruby/spec/jam_ruby/models/icecast_limit_spec.rb create mode 100644 ruby/spec/jam_ruby/models/icecast_listen_socket_spec.rb create mode 100644 ruby/spec/jam_ruby/models/icecast_logging_spec.rb create mode 100644 ruby/spec/jam_ruby/models/icecast_mastersvr_relay_spec.rb create mode 100644 ruby/spec/jam_ruby/models/icecast_mount_spec.rb create mode 100644 ruby/spec/jam_ruby/models/icecast_path_spec.rb create mode 100644 ruby/spec/jam_ruby/models/icecast_relay_spec.rb create mode 100644 ruby/spec/jam_ruby/models/icecast_security_spec.rb create mode 100644 ruby/spec/jam_ruby/models/icecast_server_spec.rb create mode 100644 ruby/spec/jam_ruby/models/icecast_servermisc_spec.rb create mode 100644 ruby/spec/jam_ruby/models/icecast_user_authentication_spec.rb diff --git a/ruby/spec/jam_ruby/models/icecast_admin_authentication_spec.rb b/ruby/spec/jam_ruby/models/icecast_admin_authentication_spec.rb new file mode 100644 index 000000000..cb29bfb86 --- /dev/null +++ b/ruby/spec/jam_ruby/models/icecast_admin_authentication_spec.rb @@ -0,0 +1,20 @@ +require 'spec_helper' + +describe IcecastAdminAuthentication do + + let(:admin) { IcecastAdminAuthentication.new } + + before(:all) do + + end + + it "save" do + admin.save.should be_true + end + + it "non-string password should be checked" do + admin.source_password = 1 + admin.save.should be_false + admin.errors[:source_password].should == ['is not a string'] + end +end diff --git a/ruby/spec/jam_ruby/models/icecast_directory_spec.rb b/ruby/spec/jam_ruby/models/icecast_directory_spec.rb new file mode 100644 index 000000000..e69de29bb diff --git a/ruby/spec/jam_ruby/models/icecast_limit_spec.rb b/ruby/spec/jam_ruby/models/icecast_limit_spec.rb new file mode 100644 index 000000000..aa3c34bdf --- /dev/null +++ b/ruby/spec/jam_ruby/models/icecast_limit_spec.rb @@ -0,0 +1,20 @@ +require 'spec_helper' + +describe IcecastLimit do + + let(:limit) { IcecastLimit.new } + + before(:all) do + + end + + it "save" do + limit.save.should be_true + end + + it "non-integer clients should be checked" do + limit.clients = "a" + limit.save.should be_false + limit.errors[:clients].should == ['is not a number'] + end +end diff --git a/ruby/spec/jam_ruby/models/icecast_listen_socket_spec.rb b/ruby/spec/jam_ruby/models/icecast_listen_socket_spec.rb new file mode 100644 index 000000000..e69de29bb diff --git a/ruby/spec/jam_ruby/models/icecast_logging_spec.rb b/ruby/spec/jam_ruby/models/icecast_logging_spec.rb new file mode 100644 index 000000000..e69de29bb diff --git a/ruby/spec/jam_ruby/models/icecast_mastersvr_relay_spec.rb b/ruby/spec/jam_ruby/models/icecast_mastersvr_relay_spec.rb new file mode 100644 index 000000000..e69de29bb diff --git a/ruby/spec/jam_ruby/models/icecast_mount_spec.rb b/ruby/spec/jam_ruby/models/icecast_mount_spec.rb new file mode 100644 index 000000000..e69de29bb diff --git a/ruby/spec/jam_ruby/models/icecast_path_spec.rb b/ruby/spec/jam_ruby/models/icecast_path_spec.rb new file mode 100644 index 000000000..e69de29bb diff --git a/ruby/spec/jam_ruby/models/icecast_relay_spec.rb b/ruby/spec/jam_ruby/models/icecast_relay_spec.rb new file mode 100644 index 000000000..e69de29bb diff --git a/ruby/spec/jam_ruby/models/icecast_security_spec.rb b/ruby/spec/jam_ruby/models/icecast_security_spec.rb new file mode 100644 index 000000000..e69de29bb diff --git a/ruby/spec/jam_ruby/models/icecast_server_spec.rb b/ruby/spec/jam_ruby/models/icecast_server_spec.rb new file mode 100644 index 000000000..e69de29bb diff --git a/ruby/spec/jam_ruby/models/icecast_servermisc_spec.rb b/ruby/spec/jam_ruby/models/icecast_servermisc_spec.rb new file mode 100644 index 000000000..e69de29bb diff --git a/ruby/spec/jam_ruby/models/icecast_user_authentication_spec.rb b/ruby/spec/jam_ruby/models/icecast_user_authentication_spec.rb new file mode 100644 index 000000000..e69de29bb From 111ab5811a675c20653ba0da15d99592e7602c8f Mon Sep 17 00:00:00 2001 From: jam Date: Tue, 7 Jan 2014 14:31:52 -0600 Subject: [PATCH 5/9] Icecast changes --- ruby/lib/jam_ruby.rb | 12 ++++++++++++ update | 3 +-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/ruby/lib/jam_ruby.rb b/ruby/lib/jam_ruby.rb index 6e69914d4..579e5588f 100755 --- a/ruby/lib/jam_ruby.rb +++ b/ruby/lib/jam_ruby.rb @@ -83,7 +83,19 @@ require "jam_ruby/models/mix" require "jam_ruby/models/claimed_recording" require "jam_ruby/models/crash_dump" require "jam_ruby/models/isp_score_batch" +require "jam_ruby/models/icecast_admin_authentication" +require "jam_ruby/models/icecast_directory" require "jam_ruby/models/icecast_limit" +require "jam_ruby/models/icecast_listen_socket" +require "jam_ruby/models/icecast_logging" +require "jam_ruby/models/icecast_mastersvr_relay" +require "jam_ruby/models/icecast_mount" +require "jam_ruby/models/icecast_path" +require "jam_ruby/models/icecast_relay" +require "jam_ruby/models/icecast_sercurity" +require "jam_ruby/models/icecast_server" +require "jam_ruby/models/icecast_servermisc" +require "jam_ruby/models/icecast_user_authentication" include Jampb diff --git a/update b/update index 50b3c776b..53e897bef 100755 --- a/update +++ b/update @@ -1,5 +1,4 @@ -#!/bin/bash - +#!/bin/bash set -e echo "" From 1ac74eadb3fb9adba66c63847da0bb89ef1fd037 Mon Sep 17 00:00:00 2001 From: jam Date: Tue, 7 Jan 2014 14:32:12 -0600 Subject: [PATCH 6/9] Icecast changes --- db/up/icecast.sql | 305 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 305 insertions(+) create mode 100644 db/up/icecast.sql diff --git a/db/up/icecast.sql b/db/up/icecast.sql new file mode 100644 index 000000000..8ad8c84b7 --- /dev/null +++ b/db/up/icecast.sql @@ -0,0 +1,305 @@ + +-- see http://www.icecast.org/docs/icecast-2.3.3/icecast2_config_file.html#limits +CREATE TABLE icecast_limits ( + id VARCHAR(64) PRIMARY KEY NOT NULL DEFAULT uuid_generate_v4(), + + -- number of listening clients + clients INTEGER NOT NULL DEFAULT 1000, + + --number of sources include souce clients and relays + sources INTEGER NOT NULL DEFAULT 50, + + -- maximum size (in bytes) of the stream queue + queue_size INTEGER NOT NULL DEFAULT 102400, + + -- does not appear to be used + client_timeout INTEGER DEFAULT 10, + + -- The maximum time (in seconds) to wait for a request to come in once + -- the client has made a connection to the server. + -- In general this value should not need to be tweaked. + header_timeout INTEGER DEFAULT 15, + + -- If a connected source does not send any data within this + -- timeout period (in seconds), then the source connection + -- will be removed from the server. + source_timeout INTEGER DEFAULT 10, + + -- The burst size is the amount of data (in bytes) + -- to burst to a client at connection time. + burst_size INTEGER DEFAULT 65536, + + created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP + + ); + + +create table icecast_admin_authentications ( + id VARCHAR(64) PRIMARY KEY NOT NULL DEFAULT uuid_generate_v4(), + + -- The unencrypted password used by sources to connect to icecast2. + -- The default username for all source connections is 'source' but + -- this option allows to specify a default password. This and the username + -- can be changed in the individual mount sections. + source_password character NOT NULL DEFAULT 'icejam321', + + -- Used in the master server as part of the authentication when a slave requests + -- the list of streams to relay. The default username is 'relay' + relay_user character NOT NULL DEFAULT 'relay', + relay_password character NOT NULL DEFAULT 'jkrelayhack', + + --The username/password used for all administration functions. + admin_user character NOT NULL DEFAULT 'jkadmin', + admin_password character NOT NULL DEFAULT 'jKadmin123', + + created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP + ); + + +--contains all the settings for listing a stream on any of the Icecast2 YP Directory servers. +-- Multiple occurances of this section can be specified in order to be listed on multiple directory servers. +create table icecast_directorys ( + id VARCHAR(64) PRIMARY KEY NOT NULL DEFAULT uuid_generate_v4(), + yp_url_timeout integer not null default 15, + yp_url character not null UNIQUE default 'http://dir.xiph.org/cgi-bin/yp-cgi', + created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP +); + +create table icecast_servermiscs ( + id VARCHAR(64) PRIMARY KEY NOT NULL DEFAULT uuid_generate_v4(), + -- This is the DNS name or IP address that will be used for the stream directory lookups or possibily + -- the playlist generation if a Host header is not provided. While localhost is shown as an example, + -- in fact you will want something that your listeners can use. + hostname character not null default 'concertsvr.jamkazam.com', + --This sets the location string for this icecast instance. It will be shown e.g in the web interface. + location character not null default 'earth', + --This should contain contact details for getting in touch with the server administrator. + admin character not null default 'icemaster@localhost', + -- This flag turns on the icecast2 fileserver from which static files can be served. + -- All files are served relative to the path specified in the configuration + -- setting. By default the setting is enabled so that requests for the images + -- on the status page are retrievable. + fileserve INTEGER not null default 1, + -- This optional setting allows for the administrator of the server to override the + -- default server identification. The default is icecast followed by a version number + -- and most will not care to change it however this setting will change that. + server_id character not null default 'icecast 2.3', + + + created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP +); + +create table icecast_listen_sockets ( + id VARCHAR(64) PRIMARY KEY NOT NULL DEFAULT uuid_generate_v4(), + + -- The TCP port that will be used to accept client connections. + port integer not null default 8001, + + -- An optional IP address that can be used to bind to a specific network card. + -- If not supplied, then it will bind to all interfaces. + bind_address character, + + shoutcast_mount character default NULL, + shoutcast_compat INTEGER not null default 0, + + created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP +); + + +create table icecast_mastersvr_relays ( + id VARCHAR(64) PRIMARY KEY NOT NULL DEFAULT uuid_generate_v4(), + + -- ip address of the master icecast server and port number + master_server character not null, + master_server_port integer not null, + --The interval (in seconds) that the Relay Server will poll the Master Server for any new mountpoints to relay. + master_update_interval integer not null default 120, + + -- This is the relay username on the master server. It is used to query the server for a list of + -- mountpoints to relay. If not specified then 'relay' is used + master_username character not null default 'relay', + master_password character not null, + + --Global on-demand setting for relays. Because you do not have individual relay options when + -- using a master server relay, you still may want those relays to only pull the stream when + -- there is at least one listener on the slave. The typical case here is to avoid surplus + -- bandwidth costs when no one is listening. + relays_on_demand INTEGER default 0, + + created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP + --make sure this combo is unique + --CONSTRAINT serverID UNIQUE KEY (master_server,master_server_port) +); + +create table icecast_relays ( + id VARCHAR(64) PRIMARY KEY NOT NULL DEFAULT uuid_generate_v4(), + + -- ip address of server we are relaying from and port number + server character not null, + port integer not null default 8001, + + -- mount at server. eg /example.ogg + mount character not null, + -- eg /different.ogg + local_mount character not null, + -- eg joe. could be null + username character default NULL , + -- user password + password character default null , + relay_shoutcast_metadata INTEGER default 0, + --- relay only if we have someone wanting to listen + on_demand INTEGER default 0, + + created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP +); + +create TABLE icecast_user_authentications( + id VARCHAR(64) PRIMARY KEY NOT NULL DEFAULT uuid_generate_v4(), + --"htpasswd or url" + type CHARACTER DEFAULT NULL , + -- these are for httpasswd + filename CHARACTER default NULL, + allow_duplicate_users INTEGER DEFAULT 0, + + -- these options are for url + -- eg value="http://myauthserver.com/stream_start.php" + mount_add CHARACTER default NULL, + --value="http://myauthserver.com/stream_end.php" + mount_remove CHARACTER default NULL, + --value="http://myauthserver.com/listener_joined.php" + listener_add CHARACTER default NULL, + --value="http://myauthserver.com/listener_left.php" + listener_remove CHARACTER default NULL, + -- value="user" + username CHARACTER default NULL, + -- value="pass" + password CHARACTER default NULL, + -- value="icecast-auth-user: 1" + auth_header CHARACTER default NULL, + -- value="icecast-auth-timelimit:" + timelimit_header CHARACTER default NULL, + + created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP +); + + +create table icecast_mounts ( + id VARCHAR(64) PRIMARY KEY NOT NULL DEFAULT uuid_generate_v4(), + -- eg/example-complex.ogg + mount_name CHARACTER UNIQUE NOT NULL, + username CHARACTER NOT NULL DEFAULT 'jamsource', + password CHARACTER NOT NULL DEFAULT 'jamksource', + max_listeners INTEGER NOT NULL DEFAULT 4, + max_listener_duration INTEGER NOT NULL DEFAULT 3600, + -- dump of the stream coming through on this mountpoint. + -- eg /tmp/dump-example1.ogg + dump_file CHARACTER DEFAULT NULL, + + -- intro music to play + -- This optional value specifies a mountpoint that clients are automatically moved to + -- if the source shuts down or is not streaming at the time a listener connects. + intro CHARACTER NOT NULL DEFAULT '/intro.ogg', + fallback_mount CHARACTER NOT NULL DEFAULT '/sourcedown.ogg', + -- When enabled, this allows a connecting source client or relay on this mountpoint + -- to move listening clients back from the fallback mount. + fallback_override INTEGER DEFAULT 1, + + -- When set to 1, this will cause new listeners, when the max listener count for the mountpoint + -- has been reached, to move to the fallback mount if there is one specified. + fallback_when_full INTEGER DEFAULT 1, + + --For non-Ogg streams like MP3, the metadata that is inserted into the stream often + -- has no defined character set. + charset CHARACTER NOT NULL DEFAULT 'ISO8859-1', + -- possilble values are -1, 0, 1 + public INTEGER DEFAULT 1, + + stream_name VARCHAR NOT NULL DEFAULT 'My Jamkazam Audio Stream', + stream_description VARCHAR NOT NULL DEFAULT 'My JK audio description', + -- direct to user page + stream_url CHARACTER NOT NULL DEFAULT 'http://wwww.jamakazam.com#user_id', + -- get this from the session info + genre VARCHAR NOT NULL DEFAULT 'Unknown', + bitrate integer NOT NULL default 92, + type CHARACTER NOT NULL DEFAULT 'application/ogg' , + subtype CHARACTER NOT NULL DEFAULT 'vorbis', + -- Enable this to prevent this mount from being shown on the xsl pages. + -- This is mainly for cases where a local relay is configured and you do + -- not want the source of the local relay to be shown + hidden INTEGER DEFAULT 1, + + -- This optional setting allows for providing a burst size which overrides the + -- default burst size as defined in limits. The value is in bytes. + burst_size INTEGER DEFAULT 65536, + mp3_metadata_interval INTEGER DEFAULT 4096, + + --called when the source connects or disconnects. The scripts are called with the name of the mount + on_connect CHARACTER DEFAULT '/home/icecast/bin/source-start', + on_disconnect CHARACTER DEFAULT '/home/icecast/bin/source-end', + + created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + auth_id VARCHAR(64) NOT NULL REFERENCES icecast_user_authentications(id) +); + + +create table icecast_paths ( + id VARCHAR(64) PRIMARY KEY NOT NULL DEFAULT uuid_generate_v4(), + basedir CHARACTER NOT NULL DEFAULT './', + logdir CHARACTER NOT NULL DEFAULT './logs', + pidfile CHARACTER NOT NULL DEFAULT './icecast.pid', + webroot CHARACTER NOT NULL DEFAULT './web', + adminroot CHARACTER NOT NULL DEFAULT './admin', + allow_ip CHARACTER NOT NULL DEFAULT '/path/to/ip_allowlist', + deny_ip CHARACTER NOT NULL DEFAULT '/path_to_ip_denylist', + alias CHARACTER DEFAULT 'source="/foo" dest="/bar"', + + created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP +); + + +create table icecast_loggings ( + id VARCHAR(64) PRIMARY KEY NOT NULL DEFAULT uuid_generate_v4(), + accesslog CHARACTER NOT NULL DEFAULT 'access.log', + errorlog CHARACTER NOT NULL DEFAULT 'error.log', + playlistlog CHARACTER NOT NULL DEFAULT 'playlist.log', + -- 4 Debug, 3 Info, 2 Warn, 1 Error + loglevel INTEGER NOT NULL DEFAULT 4 , + + created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP +); + + +create table icecast_securitys ( + id VARCHAR(64) PRIMARY KEY NOT NULL DEFAULT uuid_generate_v4(), + + chroot INTEGER NOT NULL DEFAULT 0, + changeowner_user CHARACTER DEFAULT 'nobody', + changeowner_group CHARACTER DEFAULT 'nogroup', + + created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP +); + +create TABLE icecast_servers( + id VARCHAR(64) PRIMARY KEY DEFAULT uuid_generate_v4(), + icecast_limit_id VARCHAR(64) REFERENCES icecast_limits(id) + + + + -- configs + -- mounts + +); + + From 4ff1674f20fb556182f9c7c5692fd472aae32964 Mon Sep 17 00:00:00 2001 From: Anthony Davis Date: Tue, 7 Jan 2014 14:42:39 -0600 Subject: [PATCH 7/9] Pulling out snapshot until it's finished --- web/spec/spec_helper.rb | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/web/spec/spec_helper.rb b/web/spec/spec_helper.rb index aa70cebc0..6466c3e01 100644 --- a/web/spec/spec_helper.rb +++ b/web/spec/spec_helper.rb @@ -99,7 +99,7 @@ Spork.prefork do config.include Snapshot config.before(:suite) do - set_up_snapshot + #set_up_snapshot end config.before(:all) do @@ -107,15 +107,10 @@ Spork.prefork do end config.before(:each) do - if example.metadata[:js] page.driver.resize(1920, 1080) page.driver.headers = { 'User-Agent' => 'Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:25.0) Gecko/20100101 Firefox/25.0' } end - - if example.metadata[:snap] - snapshot_example - end end config.before(:each, :js => true) do @@ -145,7 +140,7 @@ Spork.prefork do end config.after(:suite) do - tear_down_snapshot + #tear_down_snapshot wipe_s3_test_bucket end end From ae1fd60bbff387402c562dd0831cb07139d9fbfd Mon Sep 17 00:00:00 2001 From: jam Date: Tue, 7 Jan 2014 22:27:00 +0000 Subject: [PATCH 8/9] add builder to gems list --- ruby/lib/jam_ruby.rb | 1 + ruby/lib/jam_ruby/models/icecast_limit.rb | 3 +++ web/Gemfile | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ruby/lib/jam_ruby.rb b/ruby/lib/jam_ruby.rb index 579e5588f..1f16a8104 100755 --- a/ruby/lib/jam_ruby.rb +++ b/ruby/lib/jam_ruby.rb @@ -13,6 +13,7 @@ require "sendgrid" require "postgres-copy" require "geokit-rails" require "postgres_ext" +require 'builder' require "jam_ruby/constants/limits" require "jam_ruby/constants/notification_types" diff --git a/ruby/lib/jam_ruby/models/icecast_limit.rb b/ruby/lib/jam_ruby/models/icecast_limit.rb index ea6b0e727..006ee6e69 100644 --- a/ruby/lib/jam_ruby/models/icecast_limit.rb +++ b/ruby/lib/jam_ruby/models/icecast_limit.rb @@ -5,6 +5,9 @@ module JamRuby validates :clients, numericality: {only_integer: true} + def dumpXml() + + end end end \ No newline at end of file diff --git a/web/Gemfile b/web/Gemfile index 86d95f4a4..7a301fbb9 100644 --- a/web/Gemfile +++ b/web/Gemfile @@ -18,7 +18,7 @@ else gem 'jam_ruby', "0.1.#{ENV["BUILD_NUMBER"]}" gem 'jam_websockets', "0.1.#{ENV["BUILD_NUMBER"]}" end - +gem 'builder' gem 'rails', '>=3.2.11' gem 'jquery-rails', '2.0.2' gem 'jquery-ui-rails' From a7be00c8f9eb7d9348155f350bddbbe2623b2822 Mon Sep 17 00:00:00 2001 From: Anthony Davis Date: Tue, 7 Jan 2014 16:32:16 -0600 Subject: [PATCH 9/9] VRFS-923 --- web/spec/support/utilities.rb | 29 ++++------------------------- 1 file changed, 4 insertions(+), 25 deletions(-) diff --git a/web/spec/support/utilities.rb b/web/spec/support/utilities.rb index f755a6e48..a4578efa4 100644 --- a/web/spec/support/utilities.rb +++ b/web/spec/support/utilities.rb @@ -29,39 +29,18 @@ def cookie_jar Capybara.current_session.driver.browser.current_session.instance_variable_get(:@rack_mock_session).cookie_jar end -#these S3 functions copied from ruby/spec/support/utilities.rb -JAMKAZAM_TESTING_BUCKET = 'jamkazam-testing' # cuz i'm not comfortable using aws_bucket accessor directly - -def app_config - klass = Class.new do - def aws_bucket - JAMKAZAM_TESTING_BUCKET - end - - def aws_access_key_id - 'AKIAJESQY24TOT542UHQ' - end - - def aws_secret_access_key - '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' - end - end - - return klass.new -end +#see also ruby/spec/support/utilities.rb +JAMKAZAM_TESTING_BUCKET = 'jamkazam-testing' #at least, this is the name given in jam-ruby def wipe_s3_test_bucket - test_config = app_config - s3 = AWS::S3.new(:access_key_id => test_config.aws_access_key_id, - :secret_access_key => test_config.aws_secret_access_key) + s3 = AWS::S3.new(:access_key_id => Rails.application.config.aws_access_key_id, + :secret_access_key => Rails.application.config.aws_secret_access_key) test_bucket = s3.buckets[JAMKAZAM_TESTING_BUCKET] - if test_bucket.name == JAMKAZAM_TESTING_BUCKET puts "Web - Pretending to delete all contents of #{test_bucket.name}" #test_bucket.delete_all end end -# --end of S3 methods copied from ruby/spec/support/utilities.rb def sign_in(user)