-
Notifications
You must be signed in to change notification settings - Fork 52
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
Various setup.sh fixes #74
base: master
Are you sure you want to change the base?
Changes from all commits
982b16d
05d5d11
2f4d5fc
0245e7a
7c9b2b5
739f525
2a08f55
54f6b2f
aacadb3
631b1fd
6f18ac7
f865d2a
f143156
f199a08
7175409
4cd7f6d
3c4e230
548d0d5
4976c47
e5a4c36
d3a806a
92ccbde
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
README.md |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
This script is used to register a flumotion encoder server onto the timvideos frontend system. | ||
This should be ran on the encoder machines. | ||
|
||
Usage (run as root in a screen/tmux session): | ||
|
||
```python register_wrapper.py -m user:password@encoder-server -g group -s sharedsecret``` | ||
|
||
(where: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't need a "(" here... |
||
* user:password equal flumotion manager username/password, | ||
* group equals group/room in config.private.json on timvideos frontend, | ||
* sharedsecret is secret in config.private.json on timvideos frontend | ||
|
||
fake_register.py can be used to test room registration (see parent README.md) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/bash -ex | ||
# | ||
# Copyright 2014 Next Day Video P/L. All Rights Reserved. | ||
# Author: [email protected] (Ryan Verner) | ||
# | ||
# Installs required python packages | ||
# | ||
|
||
sudo apt-get install python-pip | ||
sudo pip install termcolor | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,7 @@ sudo apt-get install --assume-yes build-essential autoconf autopoint libtool lib | |
# build and install | ||
( | ||
cd | ||
rm -fr gst-plugins-dvswitch | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This line will fail if gst-plugins-dvswitch doesn't already exist. |
||
git clone https://github.com/timvideos/gst-plugins-dvswitch.git | ||
cd gst-plugins-dvswitch | ||
git clean -f -x | ||
|
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
README.md |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
This script is used to watch and restart flumotion components. | ||
This should be ran on the collector + encoder machines. | ||
|
||
Usage (run as root in a screen/tmux session): | ||
|
||
```python watchdog_wrapper.sh -m user:[email protected]``` | ||
|
||
(where user:password equal flumotion manager username/password) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,17 +39,19 @@ sudo pip install virtualenv | |
Running a test server | ||
===================== | ||
|
||
Run ``make serve``; this will configure a virtualenv, download and install | ||
Run ``make testserve``; this will configure a virtualenv, download and install | ||
dependencies (inside the virtualenv; your system will not be touched); and a | ||
test server will be started. | ||
|
||
If this is your first time running ``make serve`` you'll be prompted to provide | ||
If you recieve a "bin/activate" error, try ```make distclean``` and try again. | ||
|
||
If this is your first time running ``make testserve`` you'll be prompted to provide | ||
a username and password for an admin account. | ||
|
||
This test server should not be used in production (see relevant section below). | ||
|
||
Requests are served at http://127.0.0.1:8000 by default. If you need to change | ||
the listening IP or port, try ```ARGS="192.168.1.1:8000" make serve``` where ARGS | ||
the listening IP or port, try ```ARGS="192.168.1.1:8000" make testserve``` where ARGS | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. wrapping? |
||
represents your desired listening IP and port. | ||
|
||
This test server **should NOT be used in production** (see relevant section below). | ||
|
@@ -82,7 +84,7 @@ This keeps on going. | |
|
||
Open http://127.0.0.1:8000/example to view the page | ||
|
||
Note: DO NOT run ``make serve`` as root. If you do, virtualenv folders won't | ||
Note: DO NOT run ``make testserve`` as root. If you do, virtualenv folders won't | ||
have write permissions, so the tracker won't be able to write to sqlite | ||
database. | ||
|
||
|
@@ -138,22 +140,51 @@ Production Deployment | |
be persisted across deployments, you may have to take care of this in your | ||
deploy script. | ||
|
||
* To do the deployment, I use the ``setup.sh`` script in conf directory. It | ||
takes a copy of the current code in ``~website/timvideos`` and puts it in | ||
``~website/$VERSION-$DATE-$TIME`` directory and then links | ||
``~website/current`` to that. | ||
* **To deploy on an Ubuntu 12.04 LTS system**, run the ``setup.sh`` script in the conf/ | ||
directory. If an existing deploy doesn't exist, it will create the relevant | ||
groups, users, install the correct packages, copy in some configuration files for | ||
relevant daemons (nginx, etc) and git pull the project into ~website/timvideos. | ||
**Please look at the script first if deploying on a system already used for other | ||
things as this assumes a fairly fresh install.**. | ||
|
||
If already deployed into ~website/timvideos, it will update from git. | ||
|
||
The script will then copy installation over into ~website/timvideos-$VERSION-DATE-TIME and | ||
then links ~website/current to that. | ||
|
||
This makes it relatively easy to revert to an earlier version of the code. | ||
|
||
The script may work on other distros, but has only been tested on Ubuntu 12.04 LTS. | ||
|
||
* The script will ask for a production settings.py to be created using | ||
non-sqlite details. Populate this with a real DB, such as PostgreSQL. | ||
|
||
* On a new installation, you will need to initialise the database (this is | ||
not done by setup.sh as it can be used for upgrades, too). You can do this | ||
by running ```make initdb```. | ||
|
||
* On an existing installation you may need to migrate any schema changes. | ||
You can do this by running ```bin/python manage.py migrate```. | ||
|
||
* The app runs inside [Green Unicorn][], and is started by | ||
[upstart][]. Take a look at conf/init.conf | ||
|
||
* The app uses [nginx][] as a frontend, and to serve static files. Only a few | ||
changes from the default config are needed to accomplish this. | ||
|
||
Take a look at conf/nginx.conf | ||
Take a look at conf/nginx.conf (this needs to be modified). | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What about it needs to be modified? |
||
|
||
[deploy key]: http://help.github.com/deploy-keys/ | ||
[Green Unicorn]: http://gunicorn.org/ | ||
[upstart]: http://upstart.ubuntu.com/ | ||
[nginx]: http://nginx.org/en/ "nginx" | ||
|
||
|
||
|
||
|
||
Important information | ||
===================== | ||
|
||
```config.private.json``` is referenced by many parts of the Tim Videos system. | ||
It contains passwords, rooms/stream metadata, and other important information. | ||
Please ensure this is populated early (base it from ```config.json.example```. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,9 @@ fi | |
set -x | ||
set -e | ||
|
||
# Remove old /tmp/timvideos-static | ||
rm -rf /tmp/timvideos-static | ||
|
||
# Add the groups required | ||
addgroup --system website | ||
addgroup --system website-run | ||
|
@@ -29,8 +32,9 @@ adduser $USER website-run | |
# Get python dependencies | ||
apt-get -y install python-pip python-setuptools python-virtualenv | ||
|
||
# Set up the website directory | ||
# Set up the website directory and set current directory test deployment is running in | ||
BASEDIR=/home/website | ||
CURDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | ||
|
||
# Set up upstart config file | ||
ln -sf $BASEDIR/current/website/conf/init.conf /etc/init/website.conf | ||
|
@@ -69,8 +73,16 @@ export VERSION=$(date +%Y%m%d-%H%M%S)-$(git describe --tags --long --always) | |
cd .. | ||
|
||
if [ ! -f $BASEDIR/timvideos/website/private/settings.py ]; then | ||
echo "Please create a settings.py file in $BASEDIR/timvideos/website/private/settings.py" | ||
exit 1 | ||
if [ -f $CURDIR/../private/settings.py ]; then | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You don't want to use your private settings from development? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is what the next lines do (if this doesn't already exist - i.e. existing production deployment - check if this was configured in the directory the script is being ran from - which will be the dev/test directory - and copy these over). Unless I'm misunderstanding the purpose of this... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @mithro as far as I'm aware (I've tested the script on new deployments, against a test deployment, against an existing prod environment) it still covers your original use case and should be OK |
||
echo "Copying settings.py from $CURDIR to $BASEDIR..." | ||
cp $CURDIR/../private/settings.py $BASEDIR/timvideos/website/private/settings.py | ||
else | ||
echo "No settings.py file found in either test or production directories." | ||
echo "Please create a settings.py file in $BASEDIR/timvideos/website/private/settings.py" | ||
echo "This should contain production db settings (not sqlite!)." | ||
echo "Once this is done, run this script again." | ||
exit 1 | ||
fi | ||
fi | ||
|
||
VERSIONDIR=$BASEDIR/timvideos-$VERSION | ||
|
@@ -85,8 +97,15 @@ cp -R /tmp/timvideos-static $VERSIONDIR/website/static | |
as_website rm current || true | ||
as_website ln -s timvideos-$VERSION current | ||
|
||
# Need to get config-private.json | ||
# Need to get settings-private.py | ||
# Copy over config.private.json from previous installation | ||
if [ ! -f $BASEDIR/timvideos/config.private.json ]; then | ||
if [ -f $CURDIR/../../config.private.json ]; then | ||
echo "Copying config.private.json from $CURDIR to $BASEDIR..." | ||
cp $CURDIR/../../config.private.json $BASEDIR/timvideos/config.private.json | ||
else | ||
echo "No config.private.json file found!" | ||
fi | ||
fi | ||
|
||
# Make upstart/gunicorn reload config file | ||
chmod 644 $VERSIONDIR/website/conf/init.conf | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is in the correct location.
Maybe move it under the
# Parts
section and make it a subheading.