Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
04842087
Commit
04842087
authored
May 31, 2013
by
Slater-Victoroff
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #25 from edx/slater/new_mac_dev_script
Slater/new mac dev script
parents
4a997842
57e43770
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
173 additions
and
60 deletions
+173
-60
AUTHORS
+1
-0
README.md
+2
-2
requirements/system/ubuntu/apt-packages.txt
+12
-1
scripts/create-dev-env.sh
+142
-49
scripts/install-system-req.sh
+16
-8
No files found.
AUTHORS
View file @
04842087
...
...
@@ -72,3 +72,4 @@ Giulio Gratta <giulio@giuliogratta.com>
David Baumgold <david@davidbaumgold.com>
Jason Bau <jbau@stanford.edu>
Frances Botsford <frances@edx.org>
Slater Victoroff <slater.r.victoroff@gmail.com>
README.md
View file @
04842087
...
...
@@ -8,8 +8,8 @@ Installation
The installation process is a bit messy at the moment. Here's a high-level
overview of what you should do to get started.
**TLDR:**
There is a
`scripts/create-dev-env.sh`
script that will attempt to set all
of this up for you.
If you're in a hurry, run that script. Otherwise, I suggest
**TLDR:**
There is a
`scripts/create-dev-env.sh`
that will attempt to set all of this up for you.
If you're in a hurry, run that script. Otherwise, I suggest
that you understand what the script is doing, and why, by reading this document.
Directory Hierarchy
...
...
requirements/system/ubuntu/apt-packages.txt
View file @
04842087
python-software-properties
pkg-config
gfortran
libatlas-dev
libblas-dev
liblapack-dev
liblapack3gf
curl
git
python-virtualenv
python-scipy
python-numpy
build-essential
python-dev
gfortran
liblapack-dev
libfreetype6-dev
libpng12-dev
libjpeg-dev
...
...
@@ -14,6 +20,7 @@ libxml2-dev
libxslt-dev
yui-compressor
graphviz
libgraphviz-dev
graphviz-dev
mysql-server
libmysqlclient-dev
...
...
@@ -23,3 +30,7 @@ libreadline6-dev
mongodb
nodejs
coffeescript
mysql
libmysqlclient-dev
virtualenvwrapper
libgeos-ruby1.8
scripts/create-dev-env.sh
View file @
04842087
#!/usr/bin/env bash
#Exit if any commands return a non-zero status
set
-e
# posix compliant sanity check
...
...
@@ -27,10 +29,17 @@ EOL
}
#Setting error color to red before reset
error
()
{
printf
'\E[31m'
;
echo
"
$@
"
;
printf
'\E[0m'
}
#Setting warning color to magenta before reset
warning
()
{
printf
'\E[35m'
;
echo
"
$@
"
;
printf
'\E[0m'
}
#Setting output color to cyan before reset
output
()
{
printf
'\E[36m'
;
echo
"
$@
"
;
printf
'\E[0m'
}
...
...
@@ -51,7 +60,7 @@ EO
info
()
{
cat
<<
EO
MITx
base dir :
$BASE
edX
base dir :
$BASE
Python virtualenv dir :
$PYTHON_DIR
Ruby RVM dir :
$RUBY_DIR
Ruby ver :
$RUBY_VER
...
...
@@ -59,36 +68,31 @@ info() {
EO
}
change_git_push_defaults
()
{
#Set git push defaults to upstream rather than master
output
"Changing git defaults"
git config
--global
push.default upstream
}
clone_repos
()
{
cd
"
$BASE
"
if
[[
-d
"
$BASE
/mitx/.git"
]]
;
then
output
"Pulling mitx"
cd
"
$BASE
/mitx"
git pull
else
output
"Cloning mitx"
if
[[
-d
"
$BASE
/mitx"
]]
;
then
mv
"
$BASE
/mitx"
"
${
BASE
}
/mitx.bak.
$$
"
fi
git clone git@github.com:MITx/mitx.git
fi
change_git_push_defaults
# By default, dev environments start with a copy of 6.002x
cd
"
$BASE
"
mkdir
-p
"
$BASE
/data"
REPO
=
"content-mit-6002x"
if
[[
-d
"
$BASE
/data/
$REPO
/.git"
]]
;
then
output
"Pulling
$REPO
"
cd
"
$BASE
/data/
$REPO
"
if
[[
-d
"
$BASE
/edx-platform/.git"
]]
;
then
output
"Pulling edx platform"
cd
"
$BASE
/edx-platform"
git pull
else
output
"Cloning
$REPO
"
if
[[
-d
"
$BASE
/data/
$REPO
"
]]
;
then
mv
"
$BASE
/data/
$REPO
"
"
${
BASE
}
/data/
$REPO
.bak.
$$
"
output
"Cloning edx platform"
if
[[
-d
"
$BASE
/edx-platform"
]]
;
then
output
"Creating backup for existing edx platform"
mv
"
$BASE
/edx-platform"
"
${
BASE
}
/edx-platform.bak.
$$
"
fi
cd
"
$BASE
/data"
git clone git@github.com:MITx/
$REPO
git clone https://github.com/edx/edx-platform.git
fi
}
...
...
@@ -98,7 +102,7 @@ clone_repos() {
PROG
=
${
0
##*/
}
# Adjust this to wherever you'd like to place the codebase
BASE
=
"
${
PROJECT_HOME
:-
$HOME
}
/
mit
x_all"
BASE
=
"
${
PROJECT_HOME
:-
$HOME
}
/
ed
x_all"
# Use a sensible default (~/.virtualenvs) for your Python virtualenvs
# unless you've already got one set up with virtualenvwrapper.
...
...
@@ -161,7 +165,7 @@ done
cat
<<
EO
This script will setup a local
MITx
environment, this
This script will setup a local
edX
environment, this
includes
* Django
...
...
@@ -202,9 +206,31 @@ case `uname -s` in
distro
=
`
lsb_release
-cs
`
case
$distro
in
maya|lisa|natty|oneiric|precise|quantal
)
wheezy|jessie|maya|olivia|nadia|precise|quantal
)
warning
"Debian support is not fully debugged. Assuming you have standard
development packages already working like scipy rvm, the
installation should go fine, but this is still a work in progress.
Please report issues you have and let us know if you are able to figure
out any workarounds or solutions
Press return to continue or control-C to abort"
read
dummy
sudo
apt-get install git
;;
squeeze|lisa|katya|oneiric|natty|raring
)
warning
"It seems like you're using
$distro
which has been deprecated.
While we don't technically support this release, the install
script will probably still work.
Raring requires an install of rvm to work correctly as the raring
package manager does not yet include a package for rvm
Press return to continue or control-C to abort"
read
dummy
sudo
apt-get install git
;;
;;
*
)
error
"Unsupported distribution -
$distro
"
exit
1
...
...
@@ -241,7 +267,7 @@ EO
;;
*
)
error
"Unsupported platform"
error
"Unsupported platform
. Try switching to either Mac or a Debian-based linux distribution (Ubuntu, Debian, or Mint)
"
exit
1
;;
esac
...
...
@@ -251,11 +277,18 @@ esac
clone_repos
# Sanity check to make sure the repo layout hasn't changed
if
[[
-d
$BASE
/edx-platform/scripts
]]
;
then
output
"Installing system-level dependencies"
bash
$BASE
/edx-platform/scripts/install-system-req.sh
else
error
"It appears that our directory structure has changed and somebody failed to update this script.
raise an issue on Github and someone should fix it."
exit
1
fi
# Install system-level dependencies
bash
$BASE
/mitx/install-system-req.sh
output
"Installing RVM, Ruby, and required gems"
# If we're not installing RVM in the default location, then we'll do some
...
...
@@ -271,7 +304,22 @@ if [ "$HOME/.rvm" != $RUBY_DIR ]; then
fi
fi
curl
-sL
get.rvm.io | bash
-s
--
--version
1.15.7
# rvm has issues in debian family, this is taken from stack overflow
case
`
uname
-s
`
in
Darwin
)
curl
-sL
get.rvm.io | bash
-s
--
--version
1.15.7
;;
squeeze|wheezy|jessie|maya|lisa|olivia|nadia|natty|oneiric|precise|quantal|raring
)
warning
"Setting up rvm on linux. This is a known pain point. If the script fails here
refer to the following stack overflow question:
http://stackoverflow.com/questions/9056008/installed-ruby-1-9-3-with-rvm-but-command-line-doesnt-show-ruby-v/9056395#9056395"
sudo
apt-get
--purge
remove ruby-rvm
sudo
rm
-rf
/usr/share/ruby-rvm /etc/rvmrc /etc/profile.d/rvm.sh
curl
-sL
https://get.rvm.io | bash
-s
stable
--ruby
--autolibs
=
enable
--autodotfiles
;;
esac
# Ensure we have RVM available as a shell function so that it can mess
# with the environment and set everything up properly. The RVM install
...
...
@@ -294,8 +342,8 @@ case `uname -s` in
esac
# Let the repo override the version of Ruby to install
if
[[
-r
$BASE
/
mitx
/.ruby-version
]]
;
then
RUBY_VER
=
`
cat
$BASE
/
mitx
/.ruby-version
`
if
[[
-r
$BASE
/
edx-platform
/.ruby-version
]]
;
then
RUBY_VER
=
`
cat
$BASE
/
edx-platform
/.ruby-version
`
fi
# Current stable version of RVM (1.19.0) requires the following to build Ruby:
...
...
@@ -311,14 +359,15 @@ fi
# any required libs are missing.
LESS
=
"-E"
rvm install
$RUBY_VER
--with-readline
# Create the "mitx" gemset
rvm use
"
$RUBY_VER
@mitx"
--create
# Create the "edx" gemset
rvm use
"
$RUBY_VER
@edx-platform"
--create
rvm rubygems latest
output
"Installing gem bundler"
gem install bundler
output
"Installing ruby packages"
bundle install
--gemfile
$BASE
/
mitx
/Gemfile
bundle install
--gemfile
$BASE
/
edx-platform
/Gemfile
# Install Python virtualenv
...
...
@@ -338,20 +387,33 @@ export WORKON_HOME=$PYTHON_DIR
# Load in the mkvirtualenv function if needed
if
[[
`
type
-t
mkvirtualenv
`
!=
"function"
]]
;
then
source
`
which virtualenvwrapper.sh
`
case
`
uname
-s
`
in
Darwin
)
source
`
which virtualenvwrapper.sh
`
;;
squeeze|wheezy|jessie|maya|lisa|olivia|nadia|natty|oneiric|precise|quantal|raring
)
if
[[
-f
"/etc/bash_completion.d/virtualenvwrapper"
]]
;
then
source
/etc/bash_completion.d/virtualenvwrapper
else
error
"Could not find virtualenvwrapper"
exit
1
fi
;;
esac
fi
# Create
MITx
virtualenv and link it to repo
# Create
edX
virtualenv and link it to repo
# virtualenvwrapper automatically sources the activation script
if
[[
$systempkgs
]]
;
then
mkvirtualenv
-a
"
$
BASE
/mitx"
--system-site-packages
mitx
||
{
mkvirtualenv
-a
"
$
HOME
/.virtualenvs"
--system-site-packages
edx-platform
||
{
error
"mkvirtualenv exited with a non-zero error"
return
1
}
else
# default behavior for virtualenv>1.7 is
# --no-site-packages
mkvirtualenv
-a
"
$
BASE
/mitx"
mitx
||
{
mkvirtualenv
-a
"
$
HOME
/.virtualenvs"
edx-platform
||
{
error
"mkvirtualenv exited with a non-zero error"
return
1
}
...
...
@@ -380,10 +442,30 @@ if [[ -n $compile ]]; then
rm
-rf
numpy-
${
NUMPY_VER
}
scipy-
${
SCIPY_VER
}
fi
# building correct version of distribute from source
DISTRIBUTE_VER
=
"0.6.28"
output
"Building Distribute"
SITE_PACKAGES
=
"
$HOME
/.virtualenvs/edx-platform/lib/python2.7/site-packages"
cd
"
$SITE_PACKAGES
"
curl
-O
http://pypi.python.org/packages/source/d/distribute/distribute-
${
DISTRIBUTE_VER
}
.tar.gz
tar
-xzvf
distribute-
${
DISTRIBUTE_VER
}
.tar.gz
cd
distribute-
${
DISTRIBUTE_VER
}
python setup.py install
cd
..
rm distribute-
${
DISTRIBUTE_VER
}
.tar.gz
DISTRIBUTE_VERSION
=
`
pip freeze |
grep
distribute
`
if
[[
"
$DISTRIBUTE_VERSION
"
==
"distribute==0.6.28"
]]
;
then
output
"Distribute successfully installed"
else
error
"Distribute failed to build correctly. This script requires a working version of Distribute 0.6.28 in your virtualenv's python installation"
exit
1
fi
case
`
uname
-s
`
in
Darwin
)
# on mac os x get the latest distribute and pip
curl http://python-distribute.org/distribute_setup.py | python
pip install
-U
pip
# need latest pytz before compiling numpy and scipy
pip install
-U
pytz
...
...
@@ -395,18 +477,29 @@ case `uname -s` in
;;
esac
output
"Installing
MITx
pre-requirements"
pip install
-r
$BASE
/
mitx/pre-requirements
.txt
output
"Installing
edX
pre-requirements"
pip install
-r
$BASE
/
edx-platform/requirements/edx/pre
.txt
output
"Installing MITx requirements"
# Need to be in the mitx dir to get the paths to local modules right
cd
$BASE
/mitx
pip install
-r
requirements.txt
output
"Installing edX requirements"
# Install prereqs
cd
$BASE
/edx-platform
rvm use
$RUBY_VER
rake install_prereqs
# Final dependecy
output
"Finishing Touches"
cd
$BASE
pip install argcomplete
cd
$BASE
/edx-platform
bundle install
mkdir
"
$BASE
/log"
||
true
mkdir
"
$BASE
/db"
||
true
mkdir
"
$BASE
/data"
||
true
rake django-admin[syncdb]
rake django-admin[migrate]
rake django-admin[update-templates]
# Configure Git
output
"Fixing your git default settings"
...
...
scripts/install-system-req.sh
View file @
04842087
...
...
@@ -16,10 +16,11 @@ output() {
### START
DIR
=
"
$(
cd
"
$(
dirname
"
${
BASH_SOURCE
[0]
}
"
)
"
&&
pwd
)
"
BREW_FILE
=
$DIR
/
"brew-formulas.txt"
APT_REPOS_FILE
=
$DIR
/
"apt-repos.txt"
APT_PKGS_FILE
=
$DIR
/
"apt-packages.txt"
SELF_DIR
=
"
$(
cd
"
$(
dirname
"
${
BASH_SOURCE
[0]
}
"
)
"
&&
pwd
)
"
REQUIREMENTS_DIR
=
"
$SELF_DIR
/../requirements/system"
BREW_FILE
=
$REQUIREMENTS_DIR
/
"mac_os_x/brew-formulas.txt"
APT_REPOS_FILE
=
$REQUIREMENTS_DIR
/
"ubuntu/apt-repos.txt"
APT_PKGS_FILE
=
$REQUIREMENTS_DIR
/
"ubuntu/apt-packages.txt"
case
`
uname
-s
`
in
[
Ll]inux
)
...
...
@@ -30,8 +31,9 @@ case `uname -s` in
distro
=
`
lsb_release
-cs
`
case
$distro
in
maya|lisa|natty|oneiric|precise|quantal
)
output
"Installing Ubuntu requirements"
#Tries to install the same
squeeze|wheezy|jessie|maya|lisa|olivia|nadia|natty|oneiric|precise|quantal|raring
)
output
"Installing Debian family requirements"
# DEBIAN_FRONTEND=noninteractive is required for silent mysql-server installation
export
DEBIAN_FRONTEND
=
noninteractive
...
...
@@ -39,7 +41,10 @@ case `uname -s` in
# add repositories
cat
$APT_REPOS_FILE
| xargs
-n
1
sudo
add-apt-repository
-y
sudo
apt-get
-y
update
sudo
apt-get
-y
install gfortran
sudo
apt-get
-y
install graphviz libgraphviz-dev graphviz-dev
sudo
apt-get
-y
install libatlas-dev libblas-dev
sudo
apt-get
-y
install ruby-rvm
# install packages listed in APT_PKGS_FILE
cat
$APT_PKGS_FILE
| xargs
sudo
apt-get
-y
install
;;
...
...
@@ -70,10 +75,13 @@ EO
output
"Installing OSX requirements"
if
[[
!
-r
$BREW_FILE
]]
;
then
error
"
$BREW_FILE
does not exist,
needed to install brew
"
error
"
$BREW_FILE
does not exist,
please include the brew formulas file in the requirements/system/mac_os_x directory
"
exit
1
fi
# for some reason openssl likes to be installed by itself first
brew install openssl
# brew errors if the package is already installed
for
pkg
in
$(
cat
$BREW_FILE
)
;
do
grep
$pkg
<
(
brew list
)
&>/dev/null
||
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment