-
Notifications
You must be signed in to change notification settings - Fork 49
/
README_EC2
106 lines (71 loc) · 3.85 KB
/
README_EC2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
Panda on EC2
============
Launch the AMI
--------------
ec2-run-instances ami-468e6a2f -k pv-keypair
Nginx
-----
Required for progress uploads. Config is in /usr/local/nginx/conf/nginx.conf
Bin is /usr/local/nginx/sbin/nginx
Grab Panda
----------
cd /var/local/www
git clone git://github.com/newbamboo/panda.git
mkdir /var/local/www/panda/videos # Place for temp videos
mkdir /var/local/www/panda/log
Configure Panda
---------------
Copy the example config file and enter your AWS keys and other details.
cd /var/local/www/panda/config
cp panda_init.rb.example panda_init.rb
vi panda_init.rb
Create buckets, domains and queues
----------------------------------
* S3 bucket for video files (tip: name this a domain such videos.pandastream.com and you can setup a CNAME to S3)
* SimpleDB domains for videos, profiles and admin users
Login to the console with `merb -i` and run the following, probably replacing names with your own:
Panda::Setup.create_s3_bucket 'videos.pandastream.com'
Panda::Setup.create_sdb_domain 'panda_videos'
Panda::Setup.create_sdb_domain 'panda_profiles'
Panda::Setup.create_sdb_domain 'panda_users'
S3VideoObject.store("flvplayer.swf", File.open("flvplayer.swf"), :access => :public_read)
S3VideoObject.store('swfobject.js', open('public/javascripts/swfobject.js'), :access => :public_read)
Custom player and swfobject2
S3VideoObject.store('player.swf', open('public/player.swf'), :access => :public_read)
S3VideoObject.store('kleur.swf', open('public/kleur.swf'), :access => :public_read)
S3VideoObject.store('swfobject2.js', open('public/javascripts/swfobject2.js'), :access => :public_read)
S3VideoObject.store('expressInstall.swf', open('public/expressInstall.swf'), :access => :public_read)
Create first admin user
-----------------------
Login to the console with `merb -i`:
u = User.new
u.login = 'admin'
u.email = 'email@mydomain'
u.set_password('SECRETPASS')
u.save
Create an encoding profile
--------------------------
Chose one or more of the following. Uploaded videos will be encoded to all profiles.
Profile.create!(:title => "Flash video SD", :container => "flv", :video_bitrate => 300, :audio_bitrate => 48, :width => 320, :height => 240, :fps => 24, :position => 0, :player => "flash")
Profile.create!(:title => "Flash video HI", :container => "flv", :video_bitrate => 400, :audio_bitrate => 48, :width => 480, :height => 360, :fps => 24, :position => 1, :player => "flash")
Profile.create!(:title => "Flash h264 SD", :container => "mp4", :video_bitrate => 300, :audio_codec => "aac", :audio_bitrate => 48, :width => 320, :height => 240, :fps => 24, :position => 2, :player => "flash")
Profile.create!(:title => "Flash h264 HI", :container => "mp4", :video_bitrate => 400, :audio_bitrate => 48, :audio_coded => "aac", :width => 480, :height => 360, :fps => 24, :position => 3, :player => "flash")
Profile.create!(:title => "Flash h264 480p", :container => "mp4", :video_bitrate => 600, :audio_bitrate => 48, :audio_coded => "aac", :width => 852, :height => 480, :fps => 24, :position => 4, :player => "flash")
Configure Nginx
---------------
Edit your Nginx config as needed. The default config symlinks to `/usr/local/nginx/conf/nginx-panda.conf` and is setup to talk to Merb on port 4001.
/etc/init.d/nginx restart
Start Panda
-----------
You can start Merb directly:
cd /var/local/www/panda
merb -p 4001
The encoder can be run with
cd /var/local/www/panda
merb -r lib/encoder.rb -p 5001 -e encoder
Using God with the supplied config is the best method to control Merb and the encoder:
god
god load /var/local/www/panda/panda.god
Upload some videos!
-------------------
Visit http://ec2-instance-name-123-456.compute-1.amazonaws.com and login with the detail of the user you created earlier!