import facebook "github.com/julianshen/FacebookGoSDK"這樣是import一個在github上的package, 當你使用"go run"或"go get"之類的來編譯執行程式時, Go自動會上github幫你把這些相關的package取回, 用這個Heroku buildpack做出的環境一樣適用
2012年10月31日 星期三
[Go筆記] Heroku, Facebook
2012年4月16日 星期一
[筆記] Deploy Mojito app to Heroku
First, you need to follow this doc (http://developer.yahoo.com/cocktails/mojito/docs/quickstart/) to install Mojito as a global node module. Why install it globally? Because you need the Mojito command line to create your first app.
Create application with command line:
mojito create app mymojito
Change working directory to "mymojito".
Create a "Procfile" whose content is:
web: mojito start $PORT
Use the following command to create an application on heroku and deploy codes to it.
- git init
- git add .
- git commit -am init
- heroku create mymojitotest --stack cedar
- git push heroku master
After successfully commit codes to heroku, you could check running process with "heroku ps". However, you cannot find any running process. That is because there is one important step missed:
heroku ps:scale web=1
This command adds one dyno for web process. After that, you will find one web process when you check with "heroku ps". And the server is now started up. You can check your app with browser.
2011年9月28日 星期三
[筆記] Building social networking service with DIASPORA* on Heroku
Looks familiar? It's not Google+. It's DIASPORA. An open source project that implements a distributed social networking service. This project was announced on APRIL 24, 2010 (Just right after Facebook f8 2010 that is at APRIL 21). Alpha version was released at NOV 23, 2010 (two days before my birthday :P).
According to this, Mark Zuckerbug also donated to it just because it's a cool idea.
It's built on Ruby on rails. So it might be not so difficult to port it to Heroku platform which is a nice RoR host (althrough it still took me some time). It might be easier than build from scratch on a Linux.
I'm a newbie to these two (Heroku and DIASPORA). I'm also not familar with RoR. Here records steps I tried.
create an application on heroku
First, you need to create an application on Heroku. There are several platform stack on Heroku. Cedar stack might be the newest and most powerful one. It supports several languages and frameworks. And It also makes it very easy to deploy RoR applications.
You need to install heroku CLI before creating an application. And use "heroku login" to login to your heroku account.
Run the following command to create a new cedar application (assume application name is "mysocialy") --
heroku create --stack cedar mysocialy
After the application created, you'll have a url "http://mysocialy.herokuapp.com/" for your site. And a git repository: git@heroku.com:mysocialy.git
import source codes
Get DIASPORA* source codes from git hub:
git clone git://github.com/diaspora/diaspora.git
Get your source codes from Heroku git repository (you'll get an empty folder):
git clone git@heroku.com:mysocialy.git
If you have trouble to download from Heroku. Try to use "heroku keys:add" to add your ssh public key and try again.
Copy all files except ".git" folder from "diaspora" to "mysocialy".
Initial configuration
Make new configuration files from example.
cd config
mv application.yml.example application.yml
mv database.yml.example database.yml
Edit application.yml. Make "pod_url" to your host. In this case:
pod_url: "http://mysocialy.herokuapp.com/"
Deploy codes
Add and commit files:
git add .
git commit -am 'initial import'
Push them to Heroku
git push origin master
The coolest thing that Heroku does is that it makes deploy codes so easy. All you need to do is to push your codes to its git repository. And it could also install all related modules for you (that is configured in Gemfile). Super easy.
Ok, I must admit that I lie a little bit. There might be some problems. After I pushes all codes to Heroku, I found there is an error that it couldn't find 'pg' (postgresSQL). Looks like it does not install into gem.
I found the answer that it might be problem with gem version. Need to run "bundle install" at local. This will generate a new Gemfile.lock. Push this new file to Heroku might solve this problem
Ok, that's all?
Not sure if I missed anything (I might). Anyway, what I did is alive at "http://mysocialy.herokuapp.com/".