Skip to content

Commit

Permalink
Add development tools
Browse files Browse the repository at this point in the history
  • Loading branch information
AustinRochford committed Apr 3, 2015
1 parent 528c225 commit 48638e4
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*.pyc
.vagrant/
ipython/
credentials
24 changes: 24 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
SSH=vagrant ssh

CONFIG_FILE=ipython/profile_s3nb/ipython_notebook_config.py
IPYTHON_DIR=/vagrant/ipython

.PHONY=clean configure creds run

clean:
rm -rf ipython/ credentials

configure:
${SSH} -c "ipython profile create --ipython-dir=${IPYTHON_DIR} s3nb"
mv ${CONFIG_FILE} ${CONFIG_FILE}.orig
echo "c = get_config()" >> ${CONFIG_FILE}
echo "c.NotebookApp.log_level = 'DEBUG'" >> ${CONFIG_FILE}
echo "c.NotebookApp.contents_manager_class = 's3nb.S3ContentsManager'" >> ${CONFIG_FILE}
echo "c.S3ContentsManager.s3_base_uri = '${S3_BASE_URI}'" >> ${CONFIG_FILE}

creds:
grep -A2 ${AWS_USER} ~/.aws/credentials | sed 's/${AWS_USER}/default/g' > credentials
${SSH} -c "mkdir -p ~/.aws && ln -sf /vagrant/credentials ~/.aws/credentials"

run:
${SSH} -c "tmux new-session -d -n run -s server 'PYTHONPATH=/vagrant ipython notebook --ipython-dir=${IPYTHON_DIR} --profile=s3nb --ip=0.0.0.0 --no-browser'"
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,10 @@
``` bash
ipython notebook --profile=s3nbserver
```
## Development
1. Provision a virtual machine with `vagrant up`
2. Create an IPython profile with `make configure -e S3_BASE_URI=YOUR_BUCKET`
3. Share you AWS credentials with the virtual machine with `make configure -e AWS_USER=YOUR_USER`
4. Run the notebook server with `make run`
9 changes: 9 additions & 0 deletions Vagrantfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Vagrant.configure(2) do |config|
config.vm.provider "virtualbox" do |v|
v.memory = 1024
end

config.vm.box = "ubuntu/trusty64"
config.vm.network :forwarded_port, host: 8888, guest: 8888
config.vm.provision :shell, path: "provision.sh"
end
9 changes: 9 additions & 0 deletions provision.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

apt-get update

# Install IPython
apt-get install -y python-pip python2.7-dev libzmq-dev

pip install boto
pip install "ipython[notebook]"

0 comments on commit 48638e4

Please sign in to comment.