2015年7月1日 星期三

node.js 套件 關於 pm2.5

pm2.5 


Production process manager for Node.JS applications with a built-in load balancer.

PM2 is a production process manager for Node.js applications with a built-in load balancer. It allows you to keep applications alive forever, to reload them without downtime and to facilitate common system admin tasks.
PM2 is constantly assailed by more than 400 tests.
Compatible with io.js and Node.js. Compatible with CoffeeScript. Works on Linux (stable) & MacOSx (stable) & Windows (stable).

$ npm install pm2 -g
npm is a builtin CLI when you install Node.js - Installing Node.js or io.js with NVM
$ pm2 start app.js
Once apps are started you can list and manage them easily:
Listing all running processes:
$ pm2 list
Managing your processes is straightforward:
$ pm2 stop     <app_name|id|all>
$ pm2 restart  <app_name|id|all>
$ pm2 delete   <app_name|id|all>
To have more details on a specific process:
$ pm2 describe 0
Monitoring all processes launched:
$ pm2 monit
Displaying logs of a specified process or all processes, in real time:
$ pm2 logs
$ pm2 logs big-api
$ pm2 flush          # Clear all the logs
When an app is started with the -i option, the cluster mode is enabled.
Warning: It's still a beta feature. If you want to use the embed cluster module or reload with 0s downtime, we recommend the use of node#0.12.0+ node#0.11.16+ or io.js#1.0.2+. We do not support node#0.10.* cluster module anymore!
With the cluster mode, PM2 enables load balancing between each worker. Each HTTP/TCP/UDP request will be forwarded to one specific process at a time.
$ pm2 start app.js -i max  # Enable load-balancer and cluster features
 
$ pm2 reload all           # Reload all apps in 0s manner
PM2 can generate and configure a startup script to keep PM2 and your processes alive at every server restart.
$ pm2 startup
# auto-detect platform
$ pm2 startup [platform]
# render startup-script for a specific platform, the [platform] could be one of:
#   ubuntu|centos|redhat|gentoo|systemd|darwin|amazon
To save a process list just do:
$ pm2 save
If you manage your NodeJS app with PM2, Keymetrics makes it easy to monitor and manage apps accross servers. Feel fry to try it:
Thanks in advance and we hope that you like PM2!

2014年12月2日 星期二

Sail 檔案架構

最近在著手使用Sails.js的framework,官網Document 有非常多的介紹,因此將筆記記錄下來,方便之後使用,Sails這個架構包含了很多自動化的設定 (grunt) 與web app初期所會用的func.,都有清楚的規劃整個檔案結構!


2014年11月20日 星期四

Sail.js 教學/影片/tutorial/Video (4)

sailsCast (4)

Learning about sails.js one screencast at a time. It is a clear tutorial for sails.js.


16. Building a Sails Application: EP13 - Sign-in Page, Session Controller, New Action, and Sessions.



17. Building a Sails Application: Ep14 - User Authentication and Restricting Access Through Policies.


18. Building a Sails Application: Ep15 - Improving User Authenticated Navigation.


19. Building a Sails Application: Ep16 - Fixing and Issue With Policies From Episode 14.


20. Building a Sails Application: Ep17 - Creating a Distinction Between Admin and Regular Users


Sail.js 教學/影片/tutorial/Video (3)

sailsCast (3)

Learning about sails.js one screencast at a time. It is a clear tutorial for sails.js.


▼ 11a. Building a Sails Application: Ep7 - Adding a Show Action


▼ 11b. Building a Sails Application: Ep8 - Building an Admin Page.



▼ 12. Building a Sails Application: Ep9 - Deleting a User Account.


▼ 13. Building a Sails Application: Ep10 - Changing Databases to mongoDB With Sails Adapters.


▼ 14. Building a Sails Application: Ep11 - Encrypting Passwords With Bcrypt.


▼ 15. Building a Sails Application: Ep12 - Starting a Project in the Middle Using Git Clone.


Edited by irl nathan

Sail.js 教學/影片/tutorial/Video (2)

sailsCast (2)

Learning about sails.js one screencast at a time. It is a clear tutorial for sails.js.






▼ 6. Building a Sails Application: Ep3 - Creating a User Model and Controller




▼ 7. Building a Sails Application: Ep3[Updated] - Creating a User Model and Controller




▼ 8. Building a Sails Application: Ep4 - Creating a User Account



▼ 9. Building a Sails Application: Ep5 - Handling Validation Errors With a Flash Message




▼ 10. Building a Sails Application: Ep6 - Creating a Policy and Adding Client-side Validation



Referenced by sailsCast

Sail.js 教學/影片/tutorial/Video (1)

sailsCast (1)

Learning about sails.js one screencast at a time. It is a clear tutorial for sails.js.





這是目前看到sail.js寫得最詳細的blog,如果對於sails.js完全陌生,而又想要往full stack發展,相信這是最快的捷徑,開啟你的電腦照著底下去操作,將會很快就掌握sails的架構用法,快速開發出自己的web app。


▼ 1. Creating a Restful Json Api in Less Than 15 Seconds Using sails.js



▼ 2. What the Heck Is activityOverlord and Why Should I Care?



▼ 3. Building a Sails Application: Ep1 - Installing Sails and Create Initial Project




▼ 4. Building a Sails Application: Ep2 - Creating a Sign-up Page, 'First-look' at Routes, and Adding Twitter Bootstrap.



▼ 5. Building a Sails Application: Ep2a - Stuff I Forgot to Mention in Episode two...because I'm Old.




Edited by irl nathan

2014年7月31日 星期四

Mac教學 - 如何自動加入電影到你的Mac Media Server

Mac教學 - 如何自動加入電影到你的Mac media server



















教學:如何讓你家中的MAC 當作是多媒體機器,首先您先需要建立一個快捷的捷徑在桌面,幫助您可以快速的將電影或是音樂直接放入。

方法步驟:
1. 您先必須找到您的iTunes Media這個資料夾,可以利用快捷徑 ctrl + space ,打入 iTunes Media做搜尋。


2. 這時候要建立itunes自動加入多媒體的捷徑,您可以對著Automatically Add to iTunes資料夾,同時按著command+option然後拉到桌面。


3. 此時可以將你想新增的多媒體檔案拉到此捷徑,不管是音樂或是影片直接拉到此捷徑。


4. 當你開啟itunes,他就會自動將多媒體的影音檔案自動加入。