Posts Tagged ‘WebFaction’

Autostart script for TurboGears2

九月 20th, 2009

When I complete a TurboGears2 application, I got a problem, how to keep my tg2 application always running on Webfaction? You know, there is scheduled downtime of virtul host. Therefore, if you just run "paster serve –daemon production.ini", once the machine down, your application is down, too. So you have to find a way to keep your tg2 application up. I can use crontab to check tg2 application every 5 minutes, but during the just-start-up 5 minutes, your application is not working, so it is not a good idea. I notice Webfaction use a autostart CGI script for TurboGears1 application. So I decide to use that autostart CGI script to run my tg2 application. You might ask, what is autostart and how it works? Autostart script is a simple script to keep your web application up. It is executed when mod_rewrite of apache can’t connect to your server. By using autostart script, the application runs on-demand! If there are no users browse your application, it’s no need to run your application, that saves your memory usage.

However, the autostart Webfaction provided is for tg1, so I modify it for tg2, here is the modified version of autostart:

<![CDATA[
#!/bin/env python2.4
import os
 
# Test if the process is already running
running = False
# read status of tg2 application
lines = os.popen(
    'source /home/victorlin/webapps/tiange/tg2env/bin/activate;'
    'cd /home/victorlin/webapps/tiange/tiange/tiange;'
    'paster serve  status production.ini').readlines()
line = lines[0]
if line.startswith('Server running in PID'):
    running = True
 
print "Content-type: text/html\r\n"
if running:
    print """<head><META HTTP-EQUIV="Refresh" CONTENT="2; URL=."></head><body>
    Site is starting ...<a href="." mce_href=".">click here<a></body>"""
else:
    print """<head><META HTTP-EQUIV="Refresh" CONTENT="2; URL=."></head><body>
    Restarting site ...<a href="." mce_href=".">click here<a></body>"""
    os.system(
        'source /home/victorlin/webapps/tiange/tg2env/bin/activate;'
        'cd /home/victorlin/webapps/tiange/tiange/tiange;'
        'paster serve  daemon production.ini')
]]>


By the way, you can also use this script for Pylons applications. I hope this simple autostart script would be helpful :D

My review of Webfaction

九月 17th, 2009

One year has past since I bought Webfaction‘s virtual hosting service. Today, I want to share my experience.

Webfaction’s virtual hosting is more than virtual hosting

What does it mean "virtual hosting is more than virtual hosting"? Well, normaly, people think virtual hostings are all like that, upload your application by ftp, there is only few types of web application you can run, might be php, asp or some out-of-date web stuff. And you configure your site with control panel like cPanel or whatever, and that’s all what you can do with your host, pretty little isn’t it? You buy the service, but they limit what you can do.

Webfaction, they give you full access to your SSH account, you can do almost everything you like with that. You can install whatever you like in your home directory, but indeed, they already installed most of popular tools for you.

遠端登入WebFaction帳號

login to WebFaction's SSH account

For example, you can compile and install software you like in your home directory, You can even compile a server wrote in c language and run it on Webfaction! I wrote an article to demonstrate how. You can read the article here: WebFaction能不能跑自己的C/C++語言Server? (it is in traditional chinese)

custom_app

Create a custom application by Webfaction's panel

custom_port

compile_app

Compile and run the c-server

connect

That's it!

Another example, as I said, it is more than virtual hosting, actually, that also means it is more than web hosting. What if you want to run a non-http server? You have to buy a VPS, right? No! You can use Webfaction virtual hosting to run your non-http server! I wrote a little chat room server for my Andriod chat room client, and it runs well on Webfaction! (It is not running now, because I have no time to maintain, and there is lots of problem in my client, it consume lots of cpu even it is running in background, I did’t handle the life cycle event well, so I just stop running it, until I got time to update)

Dragon

Also, full access to SSH brings much more convenience to deal with your web applications. For example, it is a big trouble to deploy your web application by uploading all stuff by FTP. You have to remeber what pages are changed, and upload them manually, it is killing me. With Webfaction, I use SVN to deploy my web application. I do develop web application on my machine, then, I check out my web application on Webfaction, and everything is there! If you just modified some pages of you site, you can commit them and run "svn update" on your application directory, and that’s it! Well, if you don’t like svn, you have your choice! You can install git, or if you like mercurial more than git, you can install them, too.

在WebFaction主機遠端執行svn update

run svn update in my application's folder

Easy to use panel, install most popular web applications in few minutes

What if you don’t know anything about linux commands, SSH or those geek’s stuff? Well, actually, Webfaction give you extra right by allowing you accessing SSH. But if you don’t know how to use SSH, that’s okay, you can use their powerful and easy-to-use control panel to install most of poplular web application without typing any lines of command, just fill the form, and click, then everything is there.

webfaction_panel

There is so many popular applications that you can install with their control panel, e.g. wordpress, django, turbogears, trac, joomla, ruby on rails, subversion… and etc. They use a simple but powerful architecture to let you configure your websites.

webfaction_architecture

As you can see in this figure, you mount domain names to application, that is, a website. It is pretty easy to use once you knows how it works.

Friendly customer support

Webfaction provide the best customer supporting I have never seen. When I encounter problems, they always give me good answers, they are willing to help you out. That makes me feel happy, they do care about how customers feel. Also, they know much about techniques, although they provide so many cool new stuff, they still know technical details about those stuff, and they can help you out with their sophisticated experience. Their nice customer supporting never let me feel regret to recommand.

It’s balance between convenience, freedom and price

You might ask, why I don’t just buy a VPS? Well, that’s obvious. First, I have not time to manage a VPS, it is not a happy job to upgrade your server, monitor it all the time. It is annoying to receive a database down warning message when you are sleeping. All I want is to run my sites, why I have to take care about so much details? Second, as you see, I got some new stuff to run, like TurboGears2, I also got some non-http servers to run, why I have to buy a VPS just because some new stuff or non-http server? Finally, the price is the matter, it’s not cheap to buy a good VPS. So the conclusion is, Webfaction is the balance between convenience, freedom and price. That’s why I choice it.

webfaction_conclusion

Finally

Finally, if you’re interested in WebFaction‘s hosting service, you can just try it, they do provide 60-days money back guarantee, so you can get the money back if you don’t like it for any reason. And when you’re filling the signup form, you can fill my account "victorlin" in the "Promo code or referrer" field. I will be appreciate.

WebFaction能不能跑自己的C/C++語言Server?

WebFaction能不能跑自己的C/C++語言Server?

七月 30th, 2009

我之前寫了這篇WebFaction不止是虛擬主機的介紹,介紹關於WebFaction雖然是虛擬主機,但是他能做得比虛擬主機多太多了,價格實惠,功能強大,有人問WebFaction能不能跑自己的C/C++語言寫的Server,答案是當然可以,這點有明確地列在他們開出來的規格裡,為了示範如何做以及證明的確可以,我把我之前修網路程式設計寫的無聊Server丟上去編譯並執行給大家看

» Read more: WebFaction能不能跑自己的C/C++語言Server?

WebFaction價目表中文版,再一次推薦WebFaction

七月 19th, 2009

最近因為要向客戶報價,使用的空間當然也要讓客戶知道,客戶原本案主要用的空間是貴到暴炸的國內空間,每年要價一萬多元,流量和空間更是小得可憐,拿國內和國外比當然是不能比,為了讓客戶瞭解差別在哪裡,所以就翻譯了一份WebFaction的Plans

下列資訊以原網頁內容為主,價錢單位為美金

» Read more: WebFaction價目表中文版,再一次推薦WebFaction

用SVN來開發網站的經驗

十一月 3rd, 2008

慘痛的經驗

相信很多人都有慘痛的經驗,當網站開發到了上線之後,就會發生很慘的事,每次更新完之後,就要挑出修改的檔案,送到虛擬主機上面,如果神經大條一點,剛才改了什麼忘記了,忘記上傳,你在線上的網站可能就因此漏掉什麼重要的東西,如果你傳了某個東西才發現這會出現一個嚴重的漏洞,想回復到先前的樣子,又東改西改,甚至直接修改伺服器上的版本,然而事後你卻忘記下載到你電腦上的版本,到最後所有東西都會一團糟,因為你有兩個版本要管理,一個是線上的版本,一個是你電腦中開發的版本,相信有開發網站經驗的人可能都碰過這樣的事情

閃開! 讓專業的來: SVN

» Read more: 用SVN來開發網站的經驗

購買WebFaction網頁主機服務指導

十月 25th, 2008

比較國內和國外

每次說到國內和國外的主機商,我都想說"XX比雞腿",真的是不能比,我們隨便找一家國內的知名主機商來和我這一系列ez2learn的網站所架在的主機商WebFaction比較看看

智邦生活館

WebFaction

智邦的年費要

1200 元新台幣

新台幣,我們來看WebFaction最低階的,五年約的主機,5.5美金每個月,一年就是66美金,以匯率以現在的33.3800654下去計算,一年是

2203 元台幣

重點在後面,我們來比比看同樣價格下有多少資源可以使用

智邦和WebFaction虛擬主機比較表
資源 智邦 WebFaction
最低價年費 1200 2203
硬碟空間 2GB 10GB
每月免費流量 10GB 600GB
價錢空間比 600 220.3
價錢流量比 120 3.67

很明顯地,怎麼算隨便一家國外的主機商都可以把國內的主機商打得死死的,怎麼比? 根本沒辦法比,而且除了這些可以數值化的價錢、資源可以比較,還有一些是沒辦法比較的,如同在我這個網站的主機商 : WebFaction中所提到的,他們有一個團隊的優秀客服,負責解決客戶在技術上遇到的問題,他們甚至建立了整個的知識庫來記錄這些問題,他們的客服都是很有經驗的,雖然我沒用過智邦,但另一家國內的主機商的客服來說,國內的主機商肯定辦不到找一群有經驗的客服來解決客戶遇到技術上的問題,這只是客服的部份,還有主機技術上的支援,不要說國內的主機,國外的主機都很少有支援Python、Ruby、TurboGears、Django等等國內較少見的網頁開發環境,國內有的就只有老掉牙的LAMP (Linux Apache MySQL PHP),會選擇WebFaction是因為他們支援TurboGears,因為WebFaction注重在於支援那些開發環境和客服,所以就流量和空間等等的資源上,已經算是比較沒有那麼強,有很多主機商如果只支援LAMP那樣的網頁環境的話,資源的差距那更是天差地遠,總合以上幾點的結論是,真的是"XX比雞腿",怎麼比? 沒辦法比,國外的主機商市場那麼大,國內這麼小,價格和服務當然沒辦法比

那PHP呢?

如果你要用WebFaction跑PHP也是可以,WebFaction上面寫的Memory限制,是針對Python等網頁程式,PHP目前是不在限制之類的,所以PHP的網站不用擔心記憶體使用超過限制的問題,

那好幾個網站呢?

那如果說,你想架好幾個網站呢? 對於WebFaction來說也沒問題,如你所見,我的ez2learn.com下面的所有網站

易記學程式設計教學

WebChuan 網頁抓取函式庫

易記學 程式設計討論區

和這個部落格,全是架在同樣一個虛擬主機下,它的控制版面讓架站相當輕鬆容易,你要架多少個網站他沒有限制,只要流量和空間不超過限制就可以,就我網站目前那丁點流量和空間使用率,要超過限制實在很有難度,而且PHP的網站也不限記憶體使用率,所以事實上如果你拿來架PHP的話,可以弄一堆網站都沒問題

唯一的問題 : 英文

為什麼差這麼多,還是有人會買國內的主機服務,我想了想,答案大概就在於語言吧,畢竟不是每個人都懂得如何看懂英文網頁,和寫信用英文和客服溝通,事實上英文不用太好,只要看得懂,和寫出來對方看得懂就夠了,像我英文這樣破爛的人,都可以做得到,證明不是什麼難事,如果因為英文不好而花大錢當冤大頭不是很嘔嗎? 而且現在的主機商都有幾天內無條件退費的優惠,WebFaction的無條件退費天數是60天,也就是說你購買了服務之後,60天以內後悔了、覺得服務很爛、看客服不爽,各種理由,都可以無條件退費,以下我們指導如何購買WebFaction的虛擬主機服務

如何購買WebFaction網頁主機服務

首先,來到WebFaction的申請頁面,填寫你的基本資料

WebFaction填寫基本資料

WebFaction填寫基本資料

填寫你的姓名、信箱、地址、國家等等,關於地址,如果你不知道你所住的地方英文地址是什麼,沒關係,我也不知道,因為有線上中文地址轉英文地址的服務可以使用,請注意範例中寫的地址不是我家的,是我看見下面中華郵政的地址就隨手寫進去轉成英文當示範用,其中還有公司和VAT欄位,如果沒有可以不要填

接下來是關於你的網站的資料

WebFaction填寫網站資料

WebFaction填寫網站資料

User name是你的使用者名稱,你以後登入WebFaction的管理版面或是SSH都是用這個名稱,不能更改

Domain是你的域名,如果暫時還沒有的話,可以留白,他會給你一個<使用者名稱>.webfactional.com的域名,當然,當之後你有域名以後就可以更改設定

Software是一開始他們要幫你安裝的軟體,當然,你可以自己用他們的控制面版安裝或修改,相當的簡單,照著他們教學影片做,我只能說簡單到不行

If other: 如果你也想安裝其它軟體,一樣也可以寫在這裡,它們在開通帳戶時一樣會幫你安裝

Promo code or referer: 這裡是填寫推薦人,這裡是填寫我的id victorlin,這樣我可以得到一些回饋金:P

申請WebFaction填寫Plan

申請WebFaction填寫Plan

接著是選擇你要使用哪一個Plan,也就是,什麼等級的虛擬主機,在這裡示範我們選擇Shared1,也就是最便宜的虛擬主機,當然,如果你有需要,可以選擇更高級的,甚至是專屬主機,有什麼主機類形可以看他們的網頁這裡有寫,專屬主機的話,則是寫在這裡,然後是付款方式,可以選擇使用信用卡、金融卡或Paypal付款,在這裡我們選擇使用信用卡,Payment period是指多久付一次款,一次合約越久就越便宜,可以參照他們網頁上所寫的

WebFaction申請接受條款

WebFaction申請接受條款

接著你可以在Comments or special instructions裡寫你想他們幫你做的要的額外工作,例如安裝某些套件等等,最後勾選TOS and AUP接受他們的條款,就可以Next step填寫信用卡資料,完成之後,需要等收到他們來信告知帳戶開通完成,不會等太久,當時幾小時我就收到信馬上可以使用了

給WebFaction的回信

十月 2nd, 2008

破爛英文

雖然我的英文很爛,但是七拼八湊讓對方聽懂應該還可以,只是每次對方聽懂了,感覺好像也就沒事了,但是其實有很多錯字、錯用和不通順在裡面,如果不管或許會一直錯用下去,如果我記錄下來,在寫完之後重新看過,找出錯誤來,或許才是進步的好方法

劇情提要 XD

這次WebFaction的系統發信來告知記憶體超出使用限制,所以回應解釋我的解決方案

» Read more: 給WebFaction的回信

這個網站的主機商 : WebFaction

九月 28th, 2008

主機商WebFaction

今天我要介紹我的網站所使用的主機商 : WebFaction

» Read more: 這個網站的主機商 : WebFaction