Skip to content

Add mac complete script #1

Merged
merged 14 commits into from Jun 25, 2012

5 participants

@xymostech
Khan Academy member

This script should install most everything a new mac needs to develop at Khan.
It might be missing a few things here and there, but it should at least provide
a much better start for new people.

I've been running this multiple times throughout the day, and it shouldn't break anything,
nor should it break if something is already installed (although it might give a few warnings).
It's sorta hard to test to ensure that this works, but each individual part should be pretty obvious.

Please point out any better ways to do anything, they would be most appreciated.

@divad12

@xymostech xymostech Add mac complete setup script
This script should install most everything a new mac needs to develop at Khan.
It might be missing a few things here and there, but it should at least provide
a much better start for new people.
baa547f
@divad12 divad12 and 2 others commented on an outdated diff Jun 19, 2012
+#!/usr/bin/env sh
+
+echo "Running Khan Installation Script 1.0"
+echo "Warning: This is only tested on Mac OS 10.7 (Lion)"
+echo " After each statement, either something will open for you to"
+echo " interact with, or a script will run for you to use"
+echo " Press enter when a download/install is completed to go to"
+echo " the next step (including this one)"
+
+read
+
+# get user's name/email
+read -p "Enter your KA email for use in git/hg: " email
+read -p "Enter your full name for use on git/hg: " name
+
+echo "Downloading Command Line Tools (log in to start the download)"
@divad12
Khan Academy member
divad12 added a note Jun 19, 2012

How about make this optional for those Mac users who already have it set up?

@xymostech
Khan Academy member
xymostech added a note Jun 19, 2012

I was thinking about this. What do you think a good way to make something optional would be? Ask if they've set it up already?

@divad12
Khan Academy member
divad12 added a note Jun 19, 2012

Yeah, just prompt for a yes/no from them I guess.

@spicyj
Khan Academy member
spicyj added a note Jun 19, 2012

Or which gcc?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@divad12 divad12 commented on the diff Jun 19, 2012
mac-setup.sh
+hdiutil attach ~/Downloads/command_line_tools_for_xcode_june_2012.dmg > /dev/null
+echo "Type your password to install:"
+# install the command line tools
+sudo installer -package /Volumes/Command\ Line\ Tools/Command\ Line\ Tools.mpkg -target /
+# detach the disk image
+hdiutil detach /Volumes/Command\ Line\ Tools/ > /dev/null
+
+echo "Opening Hipchat website (log in and click download to install)"
+# open the hipchat page
+open "http://www.hipchat.com/"
+
+read
+
+echo "Installing Homebrew"
+# if homebrew is already installed, don't do it again
+if [ ! -d /usr/local/.git ]
@divad12
Khan Academy member
divad12 added a note Jun 19, 2012

FYI: In shell scripts I usually like to put the then on the same line as the if to conserve vertical space, as in

if [ ... ]; then
@xymostech
Khan Academy member
xymostech added a note Jun 19, 2012

Ah, that does seem better.

@jlfwong
Khan Academy member
jlfwong added a note Jun 20, 2012

Is there a good reason to check if /usr/local/.git exists instead of just using which brew?

@xymostech
Khan Academy member
xymostech added a note Jun 20, 2012

In case they don't have /usr/local/bin in their $PATH? I don't know. That would probably work fine. The reason I did this is because that seems to be what the brew installer checks (i.e. if you have a /usr/local/.git, the brew install fails)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@divad12 divad12 and 1 other commented on an outdated diff Jun 19, 2012
+ /usr/bin/ruby -e "$(/usr/bin/curl -fsSL https://raw.github.com/mxcl/homebrew/master/Library/Contributions/install_homebrew.rb)"
+fi
+# update brew
+brew update > /dev/null
+
+# make the cellar
+mkdir -p /usr/local/Cellar
+# export some useful directories
+export PATH=/usr/local/bin:/usr/local/sbin:$PATH
+# put these in .bash_profile too
+echo "export PATH=/usr/local/sbin:/usr/local/bin:$$PATH" >> ~/.bash_profile
+
+# brew doctor
+brew doctor
+
+# if no email or name was provided, get it from git
@divad12
Khan Academy member
divad12 added a note Jun 19, 2012

This feels a little iffy to me... if no email or name was provided, how about just don't continue with the rest of the script? Also, my GitHub email is not the same as my Kiln/mercurial email, since most of us have personal GitHub accounts using our personal emails. Could probably separately ask for GitHub email and username (if the user doesn't already have this setup).

@xymostech
Khan Academy member
xymostech added a note Jun 19, 2012

Ah, I will ask for separate emails.

@xymostech
Khan Academy member
xymostech added a note Jun 19, 2012

I had it retrieve from git because then if you re-ran it, you wouldn't have to type everything again. On second thought, it probably makes more sense for them just to type again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@divad12 divad12 and 1 other commented on an outdated diff Jun 19, 2012
+# install mercurial
+sudo pip -q install Mercurial
+echo "Installing mercurial in virtualenv"
+virtenv
+# install mercurial in virtualenv
+pip -q install Mercurial
+deactivate
+
+echo "Making khan directory"
+# start building our directory
+mkdir -p ~/khan/
+cd ~/khan/
+
+echo "Cloning stable"
+# get the stable branch
+rm -f ~/.hgrc
@divad12
Khan Academy member
divad12 added a note Jun 19, 2012

Um... how about back up the old ~/.hgrc if one exists (as .hgrc.orig or something)?

@xymostech
Khan Academy member
xymostech added a note Jun 19, 2012

Fiiine. Protect users' settings, see how I care.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@divad12 divad12 commented on the diff Jun 19, 2012
mac-setup.sh
+# start building our directory
+mkdir -p ~/khan/
+cd ~/khan/
+
+echo "Cloning stable"
+# get the stable branch
+rm -f ~/.hgrc
+hg clone -q https://khanacademy.kilnhg.com/Code/Website/Group/stable stable 2>/dev/null || (cd stable; hg pull -q -u)
+
+echo "Setting up your .hgrc"
+# make the dummy certificate
+yes "" | openssl req -new -x509 -extensions v3_ca -keyout /dev/null -out dummycert.pem -days 3650 -passout pass:pass 2> /dev/null
+sudo cp dummycert.pem /etc/hg-dummy-cert.pem
+rm dummycert.pem
+# setup the .hgrc
+echo "[ui]
@divad12
Khan Academy member
divad12 added a note Jun 19, 2012

I haven't looked into this, but is there an equivalent to git-config in Mercurial? It would be nice to not to echo out our own .hgrc since there's already a more complete one in this repo! All we really need is to fill in ui.username... could just remind the user to fill that in at the end or something.

@xymostech
Khan Academy member
xymostech added a note Jun 19, 2012

I didn't look into this either. This was basically just the minimal one that would work/included everything that forge said. Is there a way to add the username and not anything else?

@spicyj
Khan Academy member
spicyj added a note Jun 19, 2012

perhaps sed -i -e s/stuff/things/ .hgrc

@divad12
Khan Academy member
divad12 added a note Jun 19, 2012

Hm, I googled for about 2 mins and didn't find anything relevant for accessing environment variables (like $HOME) in nginx config file... I guess we'll have to settle with sed then.

@spicyj
Khan Academy member
spicyj added a note Jun 19, 2012

That wouldn't work because nginx runs as root anyway probably?

@jlfwong
Khan Academy member
jlfwong added a note Jun 20, 2012

Another option is using the %include feature of hgrc. From hg help config:

    A line of the form "%include file" will include "file" into the current
    configuration file. The inclusion is recursive, which means that included
    files can include other files. Filenames are relative to the configuration
    file in which the "%include" directive is found. Environment variables and
    "~user" constructs are expanded in "file". This lets you do something
    like:

      %include ~/.hgrc.d/$HOST.rc

    to include a different configuration file on each computer you use.
@xymostech
Khan Academy member
xymostech added a note Jun 20, 2012

Oohh. That actually looks like the best route.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@divad12 divad12 commented on the diff Jun 19, 2012
mac-setup.sh
+
+[auth]
+kiln.prefix = https://khanacademy.kilnhg.com
+
+[web]
+cacerts = /etc/hg-dummy-cert.pem" > ~/.hgrc
+
+echo "Installing requirements"
+virtenv
+# install requirements into the virtualenv
+pip -q install -r stable/requirements.txt
+deactivate
+
+echo "Setting up ssh keys"
+
+# if there is no ssh key, make one
@divad12
Khan Academy member
divad12 added a note Jun 19, 2012

Default SSH keys can also be named id_dsa{,.pub}.... (Mine is.)

@xymostech
Khan Academy member
xymostech added a note Jun 19, 2012

Woah. I have never seen that before! Okay, I'll add that too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@divad12 divad12 and 2 others commented on an outdated diff Jun 19, 2012
+if [ ! -e ~/.ssh/id_rsa ]
+then
+ ssh-keygen -t rsa -C "$email" -f ~/.ssh/id_rsa
+fi
+
+# copy the public key
+cat ~/.ssh/id_rsa.pub | pbcopy
+
+echo "Opening github ssh keys"
+echo "Click 'Add SSH Key', paste into the box, and hit 'Add key'"
+# go to the github ssh keys site
+open "https://github.com/settings/ssh"
+
+read
+
+echo "Cloning exercises (you will probably have to type your ssh key password)"
@divad12
Khan Academy member
divad12 added a note Jun 19, 2012

This can probably be skipped... khan-exercises is already a subrepo of the main website mercurial repo (cloned as stable).

@xymostech
Khan Academy member
xymostech added a note Jun 19, 2012

is it cloned as the ssh version, though, or the http version? (i.e. we can write to the ssh version, but not the http version) if the subrepo uses the ssh version then we can just use that. Or we could modify the .ssh/config in the subrepo or something...

@divad12
Khan Academy member
divad12 added a note Jun 19, 2012

I checked and it's the ssh version... I usually edit files in khan-exercises by editing in the subrepo, committing in git, doing a substate commit in the mercurial repo, and then pushing in mercurial (which also pushes the git subrepo to GitHub (but prompts for username and password)). That is, if I want the change to go live.

@xymostech
Khan Academy member
xymostech added a note Jun 19, 2012

Ah, okay. Then I will delete this.

@spicyj
Khan Academy member
spicyj added a note Jun 19, 2012

@divad12 pretty sure all people who seriously work on exercises have a separate clone of it.

@xymostech
Khan Academy member
xymostech added a note Jun 19, 2012

@spicyj I don't think eater does, he does it all within stable or something.

@divad12
Khan Academy member
divad12 added a note Jun 19, 2012

@spicyj I believe you, that's probably a good idea for those who work on exercises. Everybody should have a local app engine server running but currently not everybody is on the exercises team....

@spicyj
Khan Academy member
spicyj added a note Jun 19, 2012

(Actually, exercises people don't need the website repo…)

@xymostech
Khan Academy member
xymostech added a note Jun 19, 2012

That's not true. What if we need to test out how exercises look on the real site? Or with the scratchpad or something?

@spicyj
Khan Academy member
spicyj added a note Jun 19, 2012

Once upon a time, khan-exercises actually looked like the real site.

@divad12
Khan Academy member
divad12 added a note Jun 19, 2012

Your call Emily, this is bikeshed to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@divad12 divad12 and 1 other commented on an outdated diff Jun 19, 2012
+cat ~/.ssh/id_rsa.pub | pbcopy
+
+echo "Opening github ssh keys"
+echo "Click 'Add SSH Key', paste into the box, and hit 'Add key'"
+# go to the github ssh keys site
+open "https://github.com/settings/ssh"
+
+read
+
+echo "Cloning exercises (you will probably have to type your ssh key password)"
+# clone exercises
+git clone -q git@github.com:Khan/khan-exercises.git 2>/dev/null || (cd khan-exercises; git pull -q)
+
+echo "Getting development tools"
+# download a bunch of developer tools
+mkdir -p devtools
@divad12
Khan Academy member
divad12 added a note Jun 19, 2012

Should we cd into the ~/khan directory before doing this?

@xymostech
Khan Academy member
xymostech added a note Jun 19, 2012

We do, on line 100

@divad12
Khan Academy member
divad12 added a note Jun 19, 2012

Ah, cool, sorry I missed that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@divad12 divad12 and 1 other commented on an outdated diff Jun 19, 2012
+git clone -q https://github.com/Khan/kiln-review 2>/dev/null || (cd kiln-review; git pull -q)
+hg clone -q https://bitbucket.org/brendan/mercurial-extensions-rdiff 2>/dev/null || (cd mercurial-extensions-rdiff; hg -q pull -u)
+git clone -q https://github.com/Khan/khan-linter 2>/dev/null || (cd khan-linter; git pull -q)
+git clone -q https://github.com/Khan/arcanist 2>/dev/null || (cd arcanist; git pull -q)
+git clone -q https://github.com/Khan/libphutil.git 2>/dev/null || (cd libphutil; git pull -q)
+curl -s https://khanacademy.kilnhg.com/Tools/Downloads/Extensions > /tmp/extensions.zip && unzip -qo /tmp/extensions.zip kiln_extensions/kilnauth.py
+
+cd ~/khan
+
+echo "Installing nginx"
+# install nginx
+brew install nginx
+
+echo "Setting up nginx"
+# setup the nginx configuration file
+echo "worker_processes 1;
@divad12
Khan Academy member
divad12 added a note Jun 19, 2012

Instead of echoing this out, why don't we put this file in the dotfiles repo here, clone this repo, and symlink it? Would also be helpful to emit a bit more documentation as we go (eg. link to http://desmondbrand.com 's blog post).

@xymostech
Khan Academy member
xymostech added a note Jun 19, 2012

I guess the real problem is that both of the servers use $USER in the root line, which automatically gets replaced here. If there's a better way to do this, then I'd definitely go for symlinking.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@divad12 divad12 commented on the diff Jun 19, 2012
mac-setup.sh
+ echo "# KA local servers
+127.0.0.1 exercises.ka.local
+::1 exercises.ka.local
+127.0.0.1 stable.ka.local
+::1 stable.ka.local" | sudo tee -a /etc/hosts >/dev/null
+fi
+
+# copy the launch plist
+sudo cp /usr/local/Cellar/nginx/*/homebrew.mxcl.nginx.plist /Library/LaunchDaemons
+# delete the username key so it is run as root
+sudo /usr/libexec/PlistBuddy -c "Delete :UserName" /Library/LaunchDaemons/homebrew.mxcl.nginx.plist 2>/dev/null
+# load it
+sudo launchctl load -w /Library/LaunchDaemons/homebrew.mxcl.nginx.plist
+
+echo "Setting up App Engine Launcher"
+curl -s http://googleappengine.googlecode.com/files/GoogleAppEngineLauncher-1.6.6.dmg > ~/Downloads/GoogleAppEngineLauncher-1.6.6.dmg
@divad12
Khan Academy member
divad12 added a note Jun 19, 2012

Is there a URL for the latest version?

@xymostech
Khan Academy member
xymostech added a note Jun 19, 2012

I don't think so. We can just update the script when we need to.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@divad12 divad12 and 1 other commented on an outdated diff Jun 19, 2012
+echo "Running Khan Installation Script 1.0"
+echo "Warning: This is only tested on Mac OS 10.7 (Lion)"
+echo " After each statement, either something will open for you to"
+echo " interact with, or a script will run for you to use"
+echo " Press enter when a download/install is completed to go to"
+echo " the next step (including this one)"
+
+read
+
+# get user's name/email
+read -p "Enter your KA email for use in git/hg: " email
+read -p "Enter your full name for use on git/hg: " name
+
+echo "Downloading Command Line Tools (log in to start the download)"
+# download the command line tools
+open "https://developer.apple.com/downloads/download.action?path=Developer_Tools/command_line_tools_for_xcode__june_2012/command_line_tools_for_xcode_june_2012.dmg"
@divad12
Khan Academy member
divad12 added a note Jun 19, 2012

nit: (feel free to put this off) Is there a URL for latest version?

@xymostech
Khan Academy member
xymostech added a note Jun 19, 2012

I don't think there is one for this either. However, this one is probably better left alone, in case apple does something crazy with the command line tools and breaks stuff in much later versions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
xymostech added some commits Jun 19, 2012
@xymostech xymostech Put 'then's on same line, to save space 91fea82
@xymostech xymostech Make names/emails more definite
Don't get from git, and seperate into github and mercurial emails
be75c26
@divad12
Khan Academy member
divad12 commented Jun 19, 2012

Sweet, thanks for doing this! I'm sure many people while setting up their dev environments have said, one day, I will write a script to automate EVERYTHING! I know I certainly did. I think @tomyedwab has a TODO comment about this on our Forge. Except... you actually did it!

Also, probably a Makefile could work too since dividing up the work into recipes naturally modularizes the stuff to be done and lets end users pick what they want. I'm fine with this though for now.

Also, feel free to take all my comments as suggestions... what you have is great for devs who've done this setup process before and want to set up another machine, but for new employees or those who may already have a partially set up machine, we probably want to be a bit more cautious and not delete forever the ~/.hgrc and some of my other review comments like that.

@tomyedwab @phleet more review?

@divad12 divad12 and 2 others commented on an outdated diff Jun 19, 2012
+
+ location / { try_files $$uri @proxy; }
+ location @proxy { proxy_pass http://127.0.0.1:8080; }
+ }
+
+ server {
+ listen 127.0.0.1:80;
+ server_name exercises.ka.local;
+ root /Users/$USER/khan/khan-exercises;
+
+ location / {
+ autoindex on;
+ expires epoch;
+ }
+ }
+}" | sudo tee /usr/local/etc/nginx/nginx.conf >/dev/null
@divad12
Khan Academy member
divad12 added a note Jun 19, 2012

Could we append to this file or backup the old one?

@jlfwong
Khan Academy member
jlfwong added a note Jun 20, 2012

Why use sudo tee instead of just sudo echo "..." > /usr/local/etc/nginx/nginx.conf?

Also, IMO, it'd be better to have this thing in a file and template this with sed. If that turns out to be a pain, then this is fine.

@xymostech
Khan Academy member
xymostech added a note Jun 20, 2012

Because you can't sudo echo >, because then echo gets run as root but > doesn't. See: http://stackoverflow.com/questions/82256/how-do-i-use-sudo-to-redirect-output-to-a-location-i-dont-have-permission-to-wr

@xymostech
Khan Academy member
xymostech added a note Jun 20, 2012

For the templating, should I still overwrite the file with a templated version, or should change the copy in the repository and link it to the right spot?

@jlfwong
Khan Academy member
jlfwong added a note Jun 20, 2012

I would modify the version of the repo, then have this script do an in place sed.

Also, thanks for the explanation about sudo echo - TIL!

@xymostech
Khan Academy member
xymostech added a note Jun 20, 2012

I mean, should we end up with this script changing files in here with user-specific changes? The problem I see is that then, when someone who's working on it runs the script, then this file is marked as modified and might be pushed. Would a non-in-place sed work well too?

@jlfwong
Khan Academy member
jlfwong added a note Jun 20, 2012

That's a good point - it would mean undoing changes every time you want to test.

Non-in-place sounds good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@osnr
osnr commented Jun 19, 2012

I don't think it checks out the khan-exercises repo?

@spicyj
Khan Academy member
spicyj commented Jun 19, 2012

Indeed, that was just removed because David thought it was unhelpful. (You could work inside stable/khan-exercises.)

@osnr osnr and 1 other commented on an outdated diff Jun 19, 2012
+ sendfile on;
+ keepalive_timeout 65;
+
+ server {
+ listen 127.0.0.1:80;
+ server_name stable.ka.local;
+ root /Users/$USER/khan/stable;
+
+ location / { try_files $$uri @proxy; }
+ location @proxy { proxy_pass http://127.0.0.1:8080; }
+ }
+
+ server {
+ listen 127.0.0.1:80;
+ server_name exercises.ka.local;
+ root /Users/$USER/khan/khan-exercises;
@osnr
osnr added a note Jun 19, 2012

Okay, was just expecting it to clone to this path.

@spicyj
Khan Academy member
spicyj added a note Jun 19, 2012

Oh, hey.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@jlfwong jlfwong and 1 other commented on an outdated diff Jun 20, 2012
+echo " Press enter when a download/install is completed to go to"
+echo " the next step (including this one)"
+
+read
+
+# get user's name/email
+read -p "Enter your full name: " name
+read -p "Enter your github email: " gh_email
+read -p "Enter your kiln email: " hg_email
+
+if [ -z "$name" -o -z "$gh_email" -o -z "$hg_email" ]; then
+ echo "You must enter names and emails"
+ exit 1
+fi
+
+read -p "Have you installed the command line tools? y/n [n] " clt_installed
@jlfwong
Khan Academy member
jlfwong added a note Jun 20, 2012

This is really vague to me - I have xcode command line utilities, but I wouldn't have known what to answer to this. It should probably at least say "the Xcode command line tools" and maybe "includes gcc".

You could even do a which gcc or some other feature detection to see if they have them, then not even prompt them if they do.

@xymostech
Khan Academy member
xymostech added a note Jun 20, 2012

If someone has gcc, can we be sure that everything is set up correctly? If so, then this would definitely be the better route. I will change the wording for now, though.

@jlfwong
Khan Academy member
jlfwong added a note Jun 20, 2012

I'm not confident that having gcc means you have xcode command line tools, so yeah - sticking with wording changes sounds good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@jlfwong jlfwong commented on the diff Jun 20, 2012
mac-setup.sh
+echo "Opening Hipchat website (log in and click download to install)"
+# open the hipchat page
+open "http://www.hipchat.com/"
+
+read
+
+echo "Installing Homebrew"
+# if homebrew is already installed, don't do it again
+if [ ! -d /usr/local/.git ]; then
+ /usr/bin/ruby -e "$(/usr/bin/curl -fsSL https://raw.github.com/mxcl/homebrew/master/Library/Contributions/install_homebrew.rb)"
+fi
+# update brew
+brew update > /dev/null
+
+# make the cellar
+mkdir -p /usr/local/Cellar
@jlfwong
Khan Academy member
jlfwong added a note Jun 20, 2012

I don't remember having to do this when I installed homebrew - does it do it for you?

@xymostech
Khan Academy member
xymostech added a note Jun 20, 2012

I actually checked this a bunch, and apparently this is now needed. It might be a bug in brew though.

Edit: this actually just causes brew doctor to fail, but it doesn't do any of the other checks if this isn't there so it is important.

@jlfwong
Khan Academy member
jlfwong added a note Jun 20, 2012

Ah - I'm guessing the first brew install creates that directory if it doesn't exist.

If you have the time - you should file a bug against homebrew for that. brew doctor failing if run immediately after homebrew is installed is silly.

@xymostech
Khan Academy member
xymostech added a note Jun 20, 2012

Yes, it is created as soon as something is installed. It's referenced in this bug: Homebrew/legacy-homebrew#12870 which says that you should just install something...

@jlfwong
Khan Academy member
jlfwong added a note Jun 20, 2012

That's really stupid. It should at least say something like "Have you installed anything yet?".

Anyway - manually making the directory is fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@jlfwong jlfwong and 1 other commented on an outdated diff Jun 20, 2012
+sudo pip install virtualenv -q
+
+echo "Setting up virtualenv"
+
+# make a virtualenv
+virtualenv -q --python=/usr/bin/python2.7 ~/.virtualenv/khan27
+echo "source ~/.virtualenv/khan27/bin/activate" >> ~/.bash_profile
+
+# our function to activate virtualenv
+virtenv() {
+ source ~/.virtualenv/khan27/bin/activate
+}
+
+echo "Installing mercurial"
+# install mercurial
+sudo pip -q install Mercurial
@jlfwong
Khan Academy member
jlfwong added a note Jun 20, 2012

Why do we need a copy of mercurial outside of the virtualenv?

@xymostech
Khan Academy member
xymostech added a note Jun 20, 2012

We probably don't?

@jlfwong
Khan Academy member
jlfwong added a note Jun 20, 2012

I think this is probably going to cause more problems than it's worth - especially if the system python happens to be 2.5.

@xymostech
Khan Academy member
xymostech added a note Jun 20, 2012

Ha. Good point.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@jlfwong jlfwong and 1 other commented on an outdated diff Jun 20, 2012
+echo "Making khan directory"
+# start building our directory
+mkdir -p ~/khan/
+cd ~/khan/
+
+echo "Cloning stable"
+# get the stable branch
+if [ -e ~/.hgrc ]; then
+ echo "Moving old .hgrc to .hgrc.old"
+ mv ~/.hgrc ~/.hgrc.old
+fi
+hg clone -q https://khanacademy.kilnhg.com/Code/Website/Group/stable stable 2>/dev/null || (cd stable; hg pull -q -u)
+
+echo "Setting up your .hgrc"
+# make the dummy certificate
+yes "" | openssl req -new -x509 -extensions v3_ca -keyout /dev/null -out dummycert.pem -days 3650 -passout pass:pass 2> /dev/null
@jlfwong
Khan Academy member
jlfwong added a note Jun 20, 2012

This is probably right, but I don't have this - what is this?

@xymostech
Khan Academy member
xymostech added a note Jun 20, 2012

This gets rid of the weird problems in mercurial pulls/pushes about unverified certificates. You'll see the relevant line in the .hgrc under web.cacerts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@jlfwong
Khan Academy member
jlfwong commented Jun 20, 2012

This is awesome!

Having fast setup makes engineering onboarding so nice.

@divad12
Khan Academy member
divad12 commented Jun 20, 2012

Whoops, I still have to merge this in! I'll do so before games night tonight, or whenever you're ready @xymostech!

Also, one of us will need to update http://khanacademy.org/r/forge docs and the Makefile.

@xymostech
Khan Academy member

I think @phleet and I are still working out a few bugs, but we should be done before tonight.

@divad12
Khan Academy member
divad12 commented Jun 20, 2012

Sweet. No pressure intended, take your time.

@jlfwong
Khan Academy member
jlfwong commented Jun 20, 2012

Assuming everything works (I don't have an easy way of testing this), lgtm!

How have you been testing this anyway?

Another thing that would make this process even smoother is just having a shell script checked in so we could do curl http://raw.github.com/...... | sh to setup. It could just git clone this repo then run this script. That doesn't need to be in this pull request though.

@xymostech
Khan Academy member

Bleh. I was checking it the first day because I had a new computer, but since then I haven't been. I'll make a VM and test this.

@xymostech
Khan Academy member

I just realized, we probably shouldn't be putting nginx.conf in a seperate file that someone needs git to download, when they might not have git before running this....

@xymostech
Khan Academy member

Or I could do that zipfile thing! That sounds good.

@divad12
Khan Academy member
divad12 commented Jun 22, 2012

Thanks for all these improvements @xymostech! Tell me when you're ready to have this merged.

@divad12 divad12 merged commit f28db65 into Khan:master Jun 25, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.