Carreau / nbviewer

An Heroku app that allows to view ipynb urls and gists as static html
Other
0 stars 1 forks source link

Have both github/heroku as remote. #3

Open Carreau opened 11 years ago

Carreau commented 11 years ago

This is an issue to explain how to get both github and heroku as remote. and beeing able to push on each of them.

Warning, some step might require you to have a 'validated' heroku account (that might means credit card number). As the time of writing, all the addons used here remains free in their 'basic' usage.

step -1 , create an heroku account

step 0 create an heroku app

$ heroku create foobarviewer
Creating foobarviewer... done, stack is cedar
http://foobarviewer.herokuapp.com/ | git@heroku.com:foobarviewer.git

step 1, cloning nbviewer :

$ git clone https://github.com/ipython/nbviewer.git
Cloning into 'nbviewer'...
remote: Counting objects: 381, done.
remote: Compressing objects: 100% (304/304), done.
remote: Total 381 (delta 85), reused 352 (delta 62)
Receiving objects: 100% (381/381), 648.28 KiB | 32 KiB/s, done.
Resolving deltas: 100% (85/85), done.

step 3, cd into nbviewer directory

step 4 add heroku as remote :

mac% heroku git:remote -a foobarviewer 
Git remote heroku added

step 5, check the remotes.

$ git remote -v
heroku  git@heroku.com:foobarviewer.git (fetch)
heroku  git@heroku.com:foobarviewer.git (push)
origin  https://github.com/ipython/nbviewer.git (fetch)
origin  https://github.com/ipython/nbviewer.git (push)

You also potentially want to add your own remote, I have my .ssh/config in a way so that I just have to do :

$ git remote add github ssh://github/Carreau/nbviewer.git
$ git remote -v                                          
github  ssh://github/Carreau/nbviewer.git (fetch)
github  ssh://github/Carreau/nbviewer.git (push)
heroku  git@heroku.com:foobarviewer.git (fetch)
heroku  git@heroku.com:foobarviewer.git (push)
origin  https://github.com/ipython/nbviewer.git (fetch)
origin  https://github.com/ipython/nbviewer.git (push)

step 6 push on heroku :

$ git push heroku master:master
Counting objects: 381, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (281/281), done.
Writing objects: 100% (381/381), 648.28 KiB | 110 KiB/s, done.
Total 381 (delta 85), reused 381 (delta 85)

-----> Heroku receiving push
-----> Python app detected
-----> Preparing Python interpreter (2.7.2)
-----> Creating Virtualenv version 1.7.2
       New python executable in .heroku/venv/bin/python2.7
       Also creating executable in .heroku/venv/bin/python
       Installing distribute..........................

Now you should be able to push/pull from/to heroku/github. The res of the config depend on the app and what you want to do.

Carreau commented 11 years ago

@v923z , you might want to fetch my branch named zoltan hard reset it, I applied your work nbviewer (look nice ! )

$ git checkout master
Already on 'master'

$ git remote add carreau https://github.com/Carreau/nbviewer.git

$ git fetch carreau
remote: Counting objects: 390, done.
remote: Compressing objects: 100% (152/152), done.
remote: Total 366 (delta 220), reused 360 (delta 214)
Receiving objects: 100% (366/366), 2.36 MiB | 41 KiB/s, done.
Resolving deltas: 100% (220/220), completed with 19 local objects.
From https://github.com/Carreau/nbviewer
 * [new branch]      master     -> carreau/master
...
 * [new branch]      zoltan     -> carreau/zoltan

$ git reset --hard carreau/zoltan
HEAD is now at ff541c5 Template and image work by zoltàn

Force push on heroku :

$ git push heroku -f master:master
Counting objects: 388, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (145/145), done.
Writing objects: 100% (364/364), 2.36 MiB | 102 KiB/s, done.
Total 364 (delta 219), reused 364 (delta 219)

-----> Heroku receiving push
-----> Python app detected
-----> Preparing Python in
....
To git@heroku.com:foobarviewer.git
 + 6f36257...ff541c5 master -> master (forced update)

foobarviewer.herokuapp.com should be you brand new nbviewer !

You might need to setup a database, (postgres addon) , and memcached (memcached addon) before it coreclty run.

v923z commented 11 years ago

I'll do that! Thanks a lot!

Carreau commented 11 years ago

a few more step that might be required :

$ heroku addons:add memcache
Adding memcache on foobarviewer... done, vX (free)
Use `heroku addons:docs memcache` to view documentation.
Carreau commented 11 years ago

add postgres db :

Note the COLOR which for me is COBALT you'll need it in the step after

$ heroku addons:add heroku-postgresql:dev
Adding heroku-postgresql:dev on foobarviewer... done, v9 (free)
Attached as HEROKU_POSTGRESQL_COBALT_URL
Database has been created and is available
 ! This database is empty. If upgrading, you can transfer
 ! data from another database with pgbackups:restore.
.
Use `heroku addons:docs heroku-postgresql:dev` to view documentation.
Carreau commented 11 years ago

set the previous db as primary :

$ heroku pg:promote HEROKU_POSTGRESQL_COBALT_URL
Promoting HEROKU_POSTGRESQL_COBALT_URL to DATABASE_URL... done
Carreau commented 11 years ago
$ heroku open
Opening foobarviewer... done

(... -> open application in browser.)

Enjoy.

(if needed restart the app)

$ heroku restart
Restarting processes... done
Carreau commented 11 years ago

Hi @v923z did you achieved to run it on heroku ?

v923z commented 11 years ago

I am going to be a bit busy in the next couple of days, but I will drop you a line, once I am up an running again.

Carreau commented 11 years ago

Hi Zoltàn, I pushed you work on nbviewer and added your name in the footer. Looks really good ! Huge Thanks !

damianavila commented 11 years ago

@Carreau I will test this to get a dev branch for reveal. I have a question: which branch I used to push my changes production? master? I am thinking in a future PR, so what do you think/prefer

Damián.

Carreau commented 11 years ago

hum, I've forgotten to push on github, I'll try to update that tomorow. You can still try to run any of those branch on heroku, the most difficult is the configuration.

damianavila commented 11 years ago

El 26/12/12 21:12, Bussonnier Matthias escribió:

hum, I've forgotten to push on github, I'll try to update that tomorow. You can still try to run any of those branch on heroku, the most difficult is the configuration.

— Reply to this email directly or view it on GitHub https://github.com/Carreau/nbviewer/issues/3#issuecomment-11697339.

OK, i will play with it the next days...

Thanks.

Damián.

Carreau commented 11 years ago

master branch should be fully up to date with currently deployed version.

damianavila commented 11 years ago

El 27/12/12 08:50, Bussonnier Matthias escribió:

master branch should be fully up to date with currently deployed version.

— Reply to this email directly or view it on GitHub https://github.com/Carreau/nbviewer/issues/3#issuecomment-11706388.

Thanks!