Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vagrant to demonstrate install #57

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 12 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions Vagrantfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :

# time to build: 160 seconds

$script = <<SCRIPT

apt-get --assume-yes update
apt-get --assume-yes install git python-virtualenv

# things to do as the user (vagrant)
cat <<B2 >bootstrap2.sh
#!/bin/bash -x

echo User vagrant is now running $0 in:
pwd

cd

# git clone https://github.com/timvideos/streaming-system.git
git clone https://github.com/CarlFK/streaming-system.git
cd streaming-system/website
cp private/settings.py.example private/settings.py
make serve
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The backgrounding should occur here not in the make file.

sleep 5
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't really reliable...


cd ..
cd tools/register
python fake_register.py --ip 127.0.0.1 &
sleep 5

curl http://127.0.0.1:8000/av?template=group
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this doing?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am trying to do what the Readme says to set up a development environment.

In the end these things should happen:

  1. bring up the dev server
  2. fake_register
  3. "Open http://127.0.0.1:8000/av?template=group to view the page." (from
    readme)

#3 or something like it seems like a good test to make sure #1 and #2 are
working correctly.

Backgrounding make means the sleep needs to be long enough to wait for make
to do whatever it needs to do, which is on the order of 10 minutes.

btw, I pypi has been timing out and causing pip to fail about 1/2 the
time. I setup a local dir for pip to read from, that works 100%. For now
if someone runs into this "try again" will get them though it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am trying to do what the Readme says to set up a development environment.

In the end these things should happen:

  1. bring up the dev server
  2. fake_register
  3. "Open http://127.0.0.1:8000/av?template=group to view the page." (from
    readme)

Issue #58 has been fixed now. Should update your vagrant script.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Backgrounding make means the sleep needs to be long enough to wait
for make to do whatever it needs to do, which is on the order of 10 minutes.

Adding the background to make breaks the script when run interactively. We could make the make output a sential/stamp file when it finishes?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

btw, I pypi has been timing out and causing pip to fail about 1/2 the
time. I setup a local dir for pip to read from, that works 100%. For now
if someone runs into this "try again" will get them though it.

Maybe something like https://pypi.python.org/pypi/proxypypi or https://pypi.python.org/pypi/pip-accel ?


# eof: bootstrap2.sh
B2
chown vagrant ./bootstrap2.sh
chmod u+x ./bootstrap2.sh

su vagrant ./bootstrap2.sh

SCRIPT

VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|

config.vm.box = "precise64-current"
config.vm.box_url = "https://cloud-images.ubuntu.com/vagrant/precise/current/precise-server-cloudimg-amd64-vagrant-disk1.box"
config.vm.provision "shell", inline: $script
config.vm.network "forwarded_port", guest: 8000, host: 8000,
auto_correct: true

config.vm.provider :virtualbox do |vb|
vb.gui = false
vb.customize ["modifyvm", :id, "--memory", "256"]
vb.customize ["modifyvm", :id, "--cpuexecutioncap", "80"]
vb.customize ["modifyvm", :id, "--cpus", "1"]
end

end

3 changes: 1 addition & 2 deletions tools/setup/05-update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,5 @@ sudo rm /etc/apt/apt.conf.d/02cache || true
sudo rm /etc/apt/sources.list.d/*.save || true

# Update the software
sudo apt-get --assume-yes install aptitude
sudo apt-get update
sudo apt-get --assume-yes update
sudo apt-get --assume-yes dist-upgrade
18 changes: 15 additions & 3 deletions tools/setup/30-custom-flumotion.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,21 @@ fi
sudo cp -rf ../flumotion-config/fromdeb/etc/* /usr/local/etc/
sudo ln -sf /usr/local/etc/init.d/flumotion /etc/init.d/flumotion

# Create a SSL certificate used for encryption.
sudo make-ssl-cert /usr/share/ssl-cert/ssleay.cnf /usr/local/etc/flumotion/default.pem || true
sudo chown flumotion:flumotion /usr/local/etc/flumotion/default.pem
# setup SSL certificate used for encryption.
CERT="/usr/local/etc/flumotion/default.pem"
sudo DEBIAN_FRONTEND=noninteractive DEBCONF_DB_FALLBACK=Pipe make-ssl-cert /usr/share/ssl-cert/ssleay.cnf $CERT <<EOF
Name: make-ssl-cert/hostname
Template: make-ssl-cert/hostname
Value: $HOST
Owners: ssl-cert

Name: make-ssl-cert/title
Template: make-ssl-cert/title
Value: Flumotion Certificate
Owners: ssl-cert
EOF

sudo chown flumotion:flumotion $CERT

# Give access to the firewire ports
sudo adduser flumotion video
2 changes: 1 addition & 1 deletion tools/setup/99-remove-ppa.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
#

# Remove the ppa files as they cause problems for puppet.
rm /etc/apt/sources.list.d/*ppa*
rm /etc/apt/sources.list.d/*ppa* || true
48 changes: 48 additions & 0 deletions tools/setup/Vagrantfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :

# 1013 seconds to build. (15min)

$script = <<SCRIPT

apt-get install -y git-core

# things to do as the user (vagrant)
cat <<B2 >bootstrap2.sh
#!/bin/bash -x

if [ -f /vagrant/streaming-system/tools/setup/runall.sh ]; then
# for testing before pushing to github
cp -av /vagrant/streaming-system .
else
git clone https://github.com/timvideos/streaming-system.git
# git clone https://github.com/CarlFK/streaming-system.git
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be some type of argument?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure.
My primary goal is to demonstrate a sucessful install to help respond to "it wont' install." so I want to keep it simple.
Also I am not really sure how/when I would do what, but I'll keep thinking about it. I expect to have 3 or 4 of these soon.

fi

streaming-system/tools/setup/runall.sh

# eof: bootstrap2.sh
B2
chown vagrant ./bootstrap2.sh
chmod u+x ./bootstrap2.sh

su vagrant ./bootstrap2.sh

SCRIPT

VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|

config.vm.box = "precise64-current"
config.vm.box_url = "https://cloud-images.ubuntu.com/vagrant/precise/current/precise-server-cloudimg-amd64-vagrant-disk1.box"
config.vm.provision "shell", inline: $script

config.vm.provider :virtualbox do |vb|
vb.gui = false
vb.customize ["modifyvm", :id, "--memory", "256"]
vb.customize ["modifyvm", :id, "--cpuexecutioncap", "60"]
vb.customize ["modifyvm", :id, "--cpus", "1"]
end

end

8 changes: 5 additions & 3 deletions website/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,11 @@ frontend/data.py: eventfeed2internal.py

prepare-serve: install
$(ACTIVATE) && python manage.py collectstatic --noinput
# $(ACTIVATE) && python manage.py syncdb
# createsuperuser on a seperate line
# for when vagrant skips the interactive prompting.
$(ACTIVATE) && python manage.py syncdb --noinput
# $(ACTIVATE) && python manage.py createsuperuser || true
$(ACTIVATE) && python manage.py runserver &
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The runserver line should be under the serve target.


lint: install
@# R0904 - Disable "Too many public methods" warning
Expand Down Expand Up @@ -85,7 +89,5 @@ upload:
$(ACTIVATE) && git-cl upload

serve: prepare-serve install
$(ACTIVATE) && python manage.py syncdb
$(ACTIVATE) && python manage.py runserver

.PHONY : lint upload deploy serve clean config prepare-serve