Created
December 9, 2010 20:13
-
-
Save rmanalan/735260 to your computer and use it in GitHub Desktop.
Revisions
-
rmanalan revised this gist
Dec 9, 2010 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,11 +4,11 @@ I use this for static and simple [Sinatra][1] based sites -- great for prototypi If you don't know what this is, here's an example of how I deploy my website/app to a server: # create/update/delete files in my site git add . git commit -m "description of the changes I made" git push # rinse and repeat A lot of web designers or front-end'ers like to work with FTP to deploy their static sites. This is how I do it. -
rmanalan revised this gist
Dec 9, 2010 . 1 changed file with 11 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,6 +2,17 @@ I use this for static and simple [Sinatra][1] based sites -- great for prototyping simple apps. Credit goes to [http://toroid.org/ams/git-website-howto](http://toroid.org/ams/git-website-howto]) for the original idea. If you don't know what this is, here's an example of how I deploy my website/app to a server: *** create/update/delete files in my site git add . git commit -m "description of the changes I made" git push *** rinse and repeat A lot of web designers or front-end'ers like to work with FTP to deploy their static sites. This is how I do it. ## Remote repo ### Create a remote git repository: -
rmanalan revised this gist
Dec 9, 2010 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -43,7 +43,7 @@ If you don't have an existing git repo with your code in it, you can create one. After you've set up your local repository, the next step is to link up your local repository to your remote repository: git remote add origin [email protected]:[path to]myproject.git git push origin master -
rmanalan revised this gist
Dec 9, 2010 . 1 changed file with 15 additions and 15 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -6,16 +6,16 @@ I use this for static and simple [Sinatra][1] based sites -- great for prototypi ### Create a remote git repository: mkdir myproject.git && cd myproject.git git init --bare Then we define (and enable) a post-receive hook that checks out the latest tree into a directory where you'll serve your app from. I like to just create a ./www directory from within the bare git repo for simplicity: mkdir myproject.git/www cat > hooks/post-receive #!/bin/sh GIT_WORK_TREE=./myproject.git/www git checkout -f chmod +x hooks/post-receive ## Local repo @@ -24,27 +24,27 @@ If you don't have an existing git repo with your code in it, you can create one. ### Create a repo mkdir myproject && cd myproject git init echo 'Hola Mundo!' > index.html git add index.html git commit -m "The humble beginnings of my web site." ... or you can initialize a git repo in your existing code base: ### Initialize a git repo inside an existing directory git init . git add . git commit -m "initial commit" ## Link your local repo with your remote repo After you've set up your local repository, the next step is to link up your local repository to your remote repository: git remote add origin [email protected]:myproject.git git push origin master That last command `git push origin master` will "push" your local repo to the remote repo and also copy your code to myproject.git/www. -
rmanalan revised this gist
Dec 9, 2010 . 1 changed file with 8 additions and 10 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -8,14 +8,13 @@ I use this for static and simple [Sinatra][1] based sites -- great for prototypi $ mkdir myproject.git && cd myproject.git $ git init --bare Then we define (and enable) a post-receive hook that checks out the latest tree into a directory where you'll serve your app from. I like to just create a ./www directory from within the bare git repo for simplicity: $ mkdir myproject.git/www $ cat > hooks/post-receive #!/bin/sh GIT_WORK_TREE=./myproject.git/www git checkout -f $ chmod +x hooks/post-receive @@ -25,20 +24,19 @@ If you don't have an existing git repo with your code in it, you can create one. ### Create a repo $ mkdir myproject && cd myproject $ git init $ echo 'Hola Mundo!' > index.html $ git add index.html $ git commit -m "The humble beginnings of my web site." ... or you can initialize a git repo in your existing code base: ### Initialize a git repo inside an existing directory $ git init . $ git add . $ git commit -m "initial commit" ## Link your local repo with your remote repo @@ -49,7 +47,7 @@ After you've set up your local repository, the next step is to link up your loca $ git push origin master That last command `git push origin master` will "push" your local repo to the remote repo and also copy your code to myproject.git/www. ## Serving up your site -
rmanalan revised this gist
Dec 9, 2010 . 1 changed file with 6 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -63,7 +63,12 @@ This will launch a simple HTTP server on port 8000. The important thing is that ### Sinatra I use [Sinatra][1] for lots of my small projects and this workflow works well for most of them. The process for Sinatra is the same for static sites, but instead of using python to serve up the site, I like using [shotgun][3]. Shotgun is used primarily for development so it's not ideal for running production sites on it, but it works well for my purposes. So, to run your sinatra app, all you need to do is run `shotgun` inside a [screen][2] session: shotgun -o hostname-to-listen-on [-p port] The -o parameter is important to set since shotgun will only listen to 127.0.0.1 if you don't set it. [1]: http://www.sinatrarb.com [2]: http://www.gnu.org/software/screen/ [3]: https://github.com/rtomayko/shotgun -
rmanalan revised this gist
Dec 9, 2010 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -36,9 +36,9 @@ If you don't have an existing git repo with your code in it, you can create one. ### Initialize a git repo inside an existing directory $ git init . $ git add . (you may want to ignore some files by adding them to a .gitignore file) $ git commit "initial commit" ## Link your local repo with your remote repo -
rmanalan revised this gist
Dec 9, 2010 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -48,6 +48,7 @@ After you've set up your local repository, the next step is to link up your loca $ git remote add origin [email protected]:myproject.git $ git push origin master That last command `git push origin master` will "push" your local repo to the remote repo and also copy your code to /home/me/myproject.git/www. ## Serving up your site -
rmanalan revised this gist
Dec 9, 2010 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ # My Git Deploy Workflow I use this for static and simple [Sinatra][1] based sites -- great for prototyping simple apps. Credit goes to [http://toroid.org/ams/git-website-howto](http://toroid.org/ams/git-website-howto]) for the original idea. ## Remote repo -
rmanalan revised this gist
Dec 9, 2010 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ # My Git Deploy Workflow I use this for static and simple [Sinatra][1] based sites -- great for prototyping simple apps. Credit goes to [http://toroid.org/ams/git-website-howto][http://toroid.org/ams/git-website-howto]. ## Remote repo -
rmanalan revised this gist
Dec 9, 2010 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ # My Git Deploy Workflow I use this for static and simple [Sinatra][1] based sites -- great for prototyping simple apps. Credit goes to [http://toroid.org/ams/git-website-howto]. ## Remote repo @@ -58,11 +58,11 @@ I usually use this workflow when I'm prototyping or building out sites. I usual python -m SimpleHttpServer & This will launch a simple HTTP server on port 8000. The important thing is that you'll need to keep this running in the background somehow -- and it's not trivial to turn it into a daemon. My simple solution to problems like this is to run this inside a [screen][2] session ### Sinatra I use [Sinatra][1] for lots of my small projects [1]: http://www.sinatrarb.com [2]: http://www.gnu.org/software/screen/ -
rmanalan created this gist
Dec 9, 2010 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,68 @@ # My Git Deploy Workflow I use this for static and simple Sinatra based sites -- great for prototyping simple apps. Credit goes to http://toroid.org/ams/git-website-howto. ## Remote repo ### Create a remote git repository: $ mkdir myproject.git && cd myproject.git $ git init --bare Initialized empty Git repository in /home/me/myproject.git/ Then we define (and enable) a post-receive hook that checks out the latest tree into a directory where you'll serve your app from. I like to just create a ./www directory from within the bare git repo for simplicity: $ mkdir /home/me/myproject.git/www $ cat > hooks/post-receive #!/bin/sh GIT_WORK_TREE=/home/me/myproject.git/www git checkout -f $ chmod +x hooks/post-receive ## Local repo If you don't have an existing git repo with your code in it, you can create one... ### Create a repo $ mkdir webapp && cd webapp $ git init Initialized empty Git repository in /home/me/webapp/.git/ $ echo 'Hello, world!' > index.html $ git add index.html $ git commit -q -m "The humble beginnings of my web site." ... or you can initialize a git repo in your existing code base: ### Initialize a git repo inside an existing directory $ git init . $ git add . (you may want to ignore some files by adding them to a .gitignore file) $ git commit "initial commit" ## Link your local repo with your remote repo After you've set up your local repository, the next step is to link up your local repository to your remote repository: $ git remote add origin [email protected]:myproject.git $ git push origin master That last command `git push origin master` will "push" your local repo to the remote repo and also copy your code to /home/me/myproject.git/www. ## Serving up your site ### Static site I usually use this workflow when I'm prototyping or building out sites. I usually don't bother with apache or nginx since sometimes it's easier to just use python to serve up simple static sites: python -m SimpleHttpServer & This will launch a simple HTTP server on port 8000. The important thing is that you'll need to keep this running in the background somehow -- and it's not trivial to turn it into a daemon. My simple solution to problems like this is to run this inside a `[screen][2]` session ### Sinatra I use [Sinatra][1] for lots of my small projects [1]: http://www.sinatrarb.com [2]: http://www.gnu.org/software/screen/