2014年5月11日 星期日

Appfog 要用 Ruby 1.9.3

昨天忙了一下午 Appfog 主機的程式上傳更新作業, 結果都功虧一簣, 總是出現如下錯誤 :

Checking for available resources: Error (JSON 503):
ng="u...


最後在這篇看到有人說 AWS EU 主機 (愛爾蘭) 某段時間會有此問題 :

"They had a problem 5-6am GMT in the AWS EU region, looks like a knock on effect. Assuming your apps are on this server then it's a problem with Appfog. https://console.appfog.com/ is also down."

想說乾脆砍掉 snowball 這個應用, 重新選擇美東主機 (維吉尼亞), 新建一個 mysnowball 應用, 結果還是無效.

今早在鄉下家裡重試, 因為之前有 Ghost, 所以 Ruby 須重新安裝, 下載 Ruby 之前, 我仔細看了 Appfog 的說明 :

# https://docs.appfog.com/roadmap

發現 Appfog 目前未支援 Ruby 2.0.0 (僅 planned), 最高只到 Ruby 1.9.3 版, 難怪之前用 2.0 版都會有 warning. 同時在 Ruby 的下載頁有這一段 :

"Which version to download?

If you don’t know what version to install and you’re getting started with Ruby, we recommend you use Ruby 1.9.3 installers. These provide a stable language and a extensive list of packages (gems) that are compatible and updated.

Ruby 2.0.0, specially the 64bits version, are relatively new on the Windows area and not all the packages have been updated to be compatible with it. To use this version you will require some knowledge about compilers and solving dependency issues, which might be too complicated if you just want to play with the language."

原來如此, 最新版不見得好, 應該下載適合且穩定運作的. 所以下了 1.9.3 版安裝, 果然就能順利上傳更新程式了 :


L:\stockbot>gem install af
Fetching: json_pure-1.6.8.gem (100%)
Fetching: rubyzip-0.9.9.gem (100%)
Fetching: mime-types-2.2.gem (100%)
Fetching: rest-client-1.6.7.gem (100%)
Fetching: terminal-table-1.4.5.gem (100%)
Fetching: interact-0.4.8.gem (100%)
Fetching: addressable-2.2.8.gem (100%)
Fetching: uuidtools-2.1.4.gem (100%)
Fetching: rb-readline-0.4.2.gem (100%)
Fetching: af-0.3.19.gem (100%)
Successfully installed json_pure-1.6.8
Successfully installed rubyzip-0.9.9
Successfully installed mime-types-2.2
Successfully installed rest-client-1.6.7
Successfully installed terminal-table-1.4.5
Successfully installed interact-0.4.8
Successfully installed addressable-2.2.8
Successfully installed uuidtools-2.1.4
Successfully installed rb-readline-0.4.2
Successfully installed af-0.3.19
10 gems installed
Installing ri documentation for json_pure-1.6.8...
Installing ri documentation for rubyzip-0.9.9...
Installing ri documentation for mime-types-2.2...
unable to convert U+00BD from UTF-8 to CP950 for lib/mime/types.rb, skipping
unable to convert "\xE2" to UTF-8 in conversion from ASCII-8BIT to UTF-8 to CP95
0 for Contributing.rdoc, skipping
unable to convert "\xE2" to UTF-8 in conversion from ASCII-8BIT to UTF-8 to CP95
0 for Licence.rdoc, skipping
Installing ri documentation for rest-client-1.6.7...
unable to convert "\xE2" to UTF-8 in conversion from ASCII-8BIT to UTF-8 to CP95
0 for README.rdoc, skipping
Installing ri documentation for terminal-table-1.4.5...
Installing ri documentation for interact-0.4.8...
Installing ri documentation for addressable-2.2.8...
unable to convert "\xC2" to UTF-8 in conversion from ASCII-8BIT to UTF-8 to CP95
0 for README.md, skipping
Installing ri documentation for uuidtools-2.1.4...
Installing ri documentation for rb-readline-0.4.2...
Installing ri documentation for af-0.3.19...
Installing RDoc documentation for json_pure-1.6.8...
Installing RDoc documentation for rubyzip-0.9.9...
Installing RDoc documentation for mime-types-2.2...
unable to convert U+00BD from UTF-8 to CP950 for lib/mime/types.rb, skipping
unable to convert "\xE2" to UTF-8 in conversion from ASCII-8BIT to UTF-8 to CP95
0 for Contributing.rdoc, skipping
unable to convert "\xE2" to UTF-8 in conversion from ASCII-8BIT to UTF-8 to CP95
0 for Licence.rdoc, skipping
Installing RDoc documentation for rest-client-1.6.7...
unable to convert "\xE2" to UTF-8 in conversion from ASCII-8BIT to UTF-8 to CP95
0 for README.rdoc, skipping
Installing RDoc documentation for terminal-table-1.4.5...
Installing RDoc documentation for interact-0.4.8...
Installing RDoc documentation for addressable-2.2.8...
unable to convert "\xC2" to UTF-8 in conversion from ASCII-8BIT to UTF-8 to CP95
0 for README.md, skipping
Installing RDoc documentation for uuidtools-2.1.4...
Installing RDoc documentation for rb-readline-0.4.2...
Installing RDoc documentation for af-0.3.19...

L:\stockbot>af update mysnowball
Uploading Application:
  Checking for available resources: OK
  Processing resources: OK
  Packing application: OK
  Uploading (74K): OK
Push Status: OK
Stopping Application 'mysnowball': OK

Staging Application 'mysnowball': OK

Starting Application 'mysnowball': OK

當然這是先在 Appfog 網站中新增 mysnowball 應用後, 才用 update 指令, 如果還沒有 App, 就要用 push 指令, 以 CLI 交談方式建立 App, 選擇部署主機等等.

這樣 PHP 應用程式就可以順利安裝了 :




OK, 這樣就好辦了, 因為 Appfog 即使限縮了 free user 的使用額度, 但還是最穩定的免費使用空間, 可惜已經不再接受 free user 申請了 (僅 30 天免費試用). 其付費方案最低每月 20 美金也真的比較貴, 但主機穩就好.

Cooper Maa 這一篇有一些 CLI 指令介紹 :

# http://coopermaa2nd.blogspot.tw/2013/01/appfog.html

我之前已經整理在 :

# Appfog 雲端虛擬主機

如果要備份 App 程式碼, 可下 af pull mysnowball :

L:\>md mysnowball
L:\>cd mysnowball
L:\mysnowball>af pull mysnowball
Pulling last pushed source code: OK

補充 :

下午改了一些 stock.php 程式碼, 修正設定表單欄位寬度問題, 再上傳時又出現 503 Error :

L:\stockbot>af update mysnowball
Uploading Application:
  Checking for available resources: OK
  Processing resources: OK
  Packing application: OK
  Uploading (16K): OK
Error (JSON 503):
可見, Ruby 1.9.3 版只是有較好之相容性, 不會出現 warning, 我猜可能某些時段會犧牲 free user 的頻寬吧 !  因為一開始 check resources 時就出現錯誤, 一個 OK 都沒看到 :

L:\stockbot>af update mysnowball
Uploading Application:
  Checking for available resources: Error (JSON 503): ng="u...

又註 :

今早 (2014-05-12) 約 10:30 再次上傳即成功, 因此可能跟時間有關.

F:\stockbot>af update mysnowball
Uploading Application:
  Checking for available resources: OK
  Processing resources: OK
  Packing application: OK
  Uploading (16K): OK
Push Status: OK
Stopping Application 'mysnowball': OK

Staging Application 'mysnowball': OK

Starting Application 'mysnowball': OK



沒有留言 :