Monday, September 22, 2014

What's needed for the future???

What features do we need by Dec??


  1. ability to Scale
  2. ability to provision new instance for a school
    1. decide on the approach
  3. aws vs heroku
  4. performance
  5. monitoring
  6. analytics
  7. error reporting
  8. db performance
  9. which db ???

Saturday, September 20, 2014

One Shot Dev Environment Setup using Vagrant


This env setup works with pretty much any OS and uses Vagrant.
Given below are the steps
Note: You will see some errors while running "vagrant up". no need to worry as long as you are able to do "vagrant ssh".
  1. Download Vagrant 1.5.4 here (https://www.vagrantup.com/downloads-archive.html)
  2. Download VirtualBox latest (https://www.virtualbox.org/wiki/Downloads)
  3. Make sure VirtualManage from program files/oracle/virtualbox dir is included in the path.
  4. Download the virtual box image of Django on Ubuntu from here. https://www.dropbox.com/s/aevgxvcwuozn1pj/django-base-v2.1.box?dl=0
  5. On Windows, Install  putty or Gitshell or some shell with ssh provision.
  6. once you have installed all three run the below commands in cygwin or gitshell
    1. vagrant box add django-base-v2 location-to-django-base-v2.box
    2. get the latest from github bolg repo to get the Vagrant file
    3. run "vagrant up" from bolg directory once you have the latest
    4. run "vagrant provision" once thats done
    5. run "vagrant ssh" to get into the vm.
    6. Once in the vm, run "export DJANGO_SETTINGS_MODULE=settings" and "export DJANGO_ENVIRONMENT=local"
    7. run "python manage.py runserver 0.0.0.0:8000" to start the server.
  7. Once the above is done, type "http://localhost:8000/" in your browser and you should see the app.
    1. this is happening because of port forwarding between VM and your machine.
  8. Now, since Django apps are loaded during runtime. you can use the editor of your choice and edit the files in the project and the app running in VM will pick up the changes.
    1. this is because of shared folders between your host machine and VM.
    2. now when you refresh the browser you see the changes made by you on host machine.
  9. Once you have the above run below commands to seed the db 
    1. python manage.py syncdb
    2. create admin user so that you can log into admin screen
    3. python manage.py migrate takeaway
    4. python manage.py migrate notifications
    5. go to this link localhost:8000/takeaway/initload to load data
    6. now login with ravi/abc123 or atluri/abc123 to enter the app
    7. have fun

Monday, September 1, 2014

Push code to Heroku

Checklist for developers to push code to Heroku

  1. Developer needs to be added as collaborator for the heroku app.
  2. Developer needs to add the right heroku git repo in his project.
    1. git remote add heroku git@heroku.com:<app-name>.git
  3. git push heroku master (to push code to heroku git repo)
  4. heroku logs (to check the log entries, verify if the app crashed or running)
  5. To run python commands shell or syncdb use heroku run.
    1. heroku run python manage.py shell
    2. heroku run python manage.py syncdb
  6. To run SQL on Heroku
    1. heroku pg:psql
    2. cat magic.sql | heroku pg:psql (to run the SQL statements from magic.sql file)
  7. To capture url of backed up database (https://devcenter.heroku.com/articles/pgbackups)
    1. heroku pgbackups:url  
    2. refer to the link above for import/export of data.
  8. heroku's documentation is very good and saves us lot of effort 
    1. https://devcenter.heroku.com/


Dreaded Git installation by RaviKiran

If you are on Ubuntu

1. $ sudo apt-get install git
  This step will install git on your machine

2. https://help.github.com/articles/set-up-git#setting-up-git

3. Use this page for ssh key generation. Blindly follow all steps
   https://help.github.com/articles/generating-ssh-keys

4. git clone git@github.com:ravikirandutta/BOLG.git   ( where you want to get the code)

This should be all the steps to get the codebase on to your system.