Pow ãã¤ã³ã¹ãã¼ã«ããã¨ã·ã¹ãã ã«ä½ããããã®ã確èªãã
Pow 㯠37signals 謹製㮠Rack ãµã¼ãã§ããRails éçºã§æç¨ãã¦ãã人ãå¤ãã®ã§ã¯ãªãã§ãããããPow ãã¤ã³ã¹ãã¼ã«ããã¨ã
- (1) http://my_app_name.dev/ ã«ã¢ã¯ã»ã¹ããã¨
- (2) Pow ã Rack ã¢ããªã±ã¼ã·ã§ã³ãèªåçã«èµ·åãã¦
- (3) ~/.pow/my_app_name ã«ãã Rack ã¢ããªã±ã¼ã·ã§ã³ãå©ç¨ã§ãã
ã®ã§ã¨ã¦ã便å©ã§ããããããPow ã®ã¤ã³ã¹ãã¼ã«ã¯
$ curl get.pow.cx | sh
ã ãã§å®çµããã®ã§ç°¡åã§ããããããéæ³ã®ãã㪠(1)-(3) ãè¦ã¦ããã¨ãã·ã¹ãã ã«ä½ãè¤éãªæä½ããã¦ããã®ã§ã¯ãªããã¨ä¸å®ã«ãªãã¾ããããã§ãã¤ã³ã¹ãã¼ã«ã¹ã¯ãªãããé ã«è¿½ã£ã¦ãPow ãã¤ã³ã¹ãã¼ã«ããã¨ã·ã¹ãã ã«ä½ããããã®ã確èªãããã¨ã«ãã¾ãããã®è¨äºãæ¸ãã¦ããæç¹ã®ã¤ã³ã¹ãã¼ã«ã¹ã¯ãªããã get.pow.cx · GitHub ã«ä¿åãã¦ãã¾ãã以ä¸ããã®ã¤ã³ã¹ãã¼ã«ã¹ã¯ãªããã«æ²¿ã£ã¦è§£èª¬ããããã¦ããã¾ãã
ã¤ã³ã¹ãã¼ã«ã¹ã¯ãªããã¯ä½ãããã
ããã§ã¯ãé ã«è¦ã¦ãããã¨ã«ãã¾ãããã
1-37 è¡ç®
ã¾ããç®ã«ã¤ãã®ã Pow ã®ãã´ AA ã§ãï¼å³å³ï¼ããããã»ã¨ãã©ã®äººã«æ°ã¥ãããªãã®ã¯ãã£ãããªãã¨æãã¾ãããã®ãã´ãã·ã¹ãã ã«ä½ãããããã§ã¯ããã¾ãããããããããããè¦ããªãã¨ããã§é å¼µãã®ã¯ç§ã®å¥½ã¿ãªã®ã§ç´¹ä»ãã次第ã§ãã
41-59è¡ç®
Pow 㯠Max OS X 10.6 以éã§ãªãã¨åä½ããªãã®ã§ãå®è¡ç°å¢ã確èªãã¦ãã¾ããã¾ã ã·ã¹ãã ã«ã¯ä½ããã¦ãã¾ãããããã§ãPow ã®ã¤ã³ã¹ãã¼ã«å ãã£ã¬ã¯ããªã¨ Pow æ¬ä½ã®ãã¹ãå¤æ°ã«è¨å®ãã¦ãã¾ãã
- POW_ROOT="$HOME/Library/Application Support/Pow"
- POW_BIN="$POW_ROOT/Current/bin/pow"
64è¡ç®: ã¤ã³ã¹ãã¼ã«ãã£ã¬ã¯ããªã®ä½æ
mkdir -p "$POW_ROOT/Hosts" "$POW_ROOT/Versions"
ã¤ã³ã¹ãã¼ã«å ãã£ã¬ã¯ããªã¨ãã¦ã$POW_ROOT/Hosts 㨠$POW_ROOT/Versions ãä½æãã¦ãã¾ãã$POW_ROOT="$HOME/Library/Application Support/Pow" ã§ãããã¨ã¯å ã«èª¬æãã¾ããã
69-71è¡ç®: æ¢ã«ã¤ã³ã¹ãã¼ã«ãã¦ãã Pow ãåé¤
cd "$POW_ROOT/Versions" rm -rf "$POW_ROOT/Versions/$VERSION"
以éã®ä½æ¥ã¯ $POW_ROOT/Versions ã§è¡ããã¾ãã
75è¡ç®: Pow æ¬ä½ããã¦ã³ãã¼ã
curl -s http://get.pow.cx/versions/$VERSION.tar.gz | tar xzf -
$POW_ROOT/Versions ã«å±éããã¾ãã
80-82è¡ç®: ãã¦ã³ãã¼ããããã¼ã¸ã§ã³ã Current ã¨ãã¦ã·ã³ããªãã¯ãªã³ã¯ãä½æ
cd "$POW_ROOT" rm -f Current ln -s Versions/$VERSION Current
ææ°ã®ãã¼ã¸ã§ã³ã« Current ã¨ããååã«ã·ã³ããªãã¯ãªã³ã¯ãå¼µãã®ã¯ Mac OS X ã®æµåã§ãããã¨ãã£ã¦ããç§ã¯ãã®æµåãæ¸ããã¦ããããã¥ã¡ã³ããè¦ããã¨ãããã¾ãããããç¥ã£ã¦ãã人ãããã誰ãæãã¦ãã ããã
87-88è¡ç®: ãã¼ã ãã£ã¬ã¯ããªã« $POW_ROOT/Hosts ã¸ã®ã·ã³ããªãã¯ãªã³ã¯ã ~/.pow ã¨ãã¦ä½æ
cd "$HOME" [[ -a .pow ]] || ln -s "$POW_ROOT/Hosts" .pow
93è¡ç®: pow èµ·åã¹ã¯ãªããã®è¨å®
echo "*** Installing local configuration files..." "$POW_BIN" --install-local
pow --install-local ãå®è¡ãã¦ãpow èµ·åã¹ã¯ãªãããè¨å®ãã¦ãã¾ããpow --install-local ãä½ãããã㯠pow/command.js at master · basecamp/pow · GitHub ãã installer.coffee ã追ããããã¨åããã¾ããç°¡åã«è¨ãã¨ã/Users/passoingloop/Library/LaunchAgents/cx.pow.powd.plist *1 ãä½æãã¦ãã¦ã¼ã¶ã®ãã°ã¤ã³æã«
$SHELL --login -c "'/Users/passingloop/Library/Application Support/Pow/Versions/0.3.2/bin/pow'"
ãå®è¡ãããããã«ãã¦ããã ãã§ãã
99è¡ç®: root 権éãå¿ è¦ããã§ãã¯
"$POW_BIN" --install-system --dry-run >/dev/null && NEEDS_ROOT=0 || NEEDS_ROOT=1
root 権éãå¿ è¦ãªã NEEDS_ROOT=1, ä¸è¦ãªã NEEDS_ROOT=0 ãè¨å®ãã¾ããroot 権éãå¿ è¦ãã©ããããã§ãã¯ãããã®ãã¯ããã¯ã¯ãä»ã®ã¤ã³ã¹ãã¼ã©ãä½æããã¨ãã«ã使ãããã§ãã
104-108è¡ç®: ãã¼ããã©ã¯ã¼ãã£ã³ã°è¨å®
if [ $NEEDS_ROOT -eq 1 ]; then echo "*** Installing system configuration files as root..." sudo "$POW_BIN" --install-system sudo launchctl load -Fw /Library/LaunchDaemons/cx.pow.firewall.plist 2>/dev/null fi
ãå®è¡ãã¦ãèµ·åæã« 80 çªãã¼ãã¸ã®ã¢ã¯ã»ã¹ã 20559 çªã«è»¢éããããè¨å®ãã¾ããpow --install-system ãä½ããããã¯ã--install-local ã¨åãããã« pow/command.js at master · basecamp/pow · GitHub ãã installer.coffee ã追ããããã¨åããã¾ããç°¡åã«è¨ãã¨ã/etc/resolver/dev 㨠/Library/LaunchDaemons/cx.pow.firewall.plist ãä½æãã¦ãå¾è ã sudo launchctl load -Fw ãã¾ããsudo launchctl load -Fw ... ã¯èµ·åæã« PID=1 ã® launchd ãã cx.pow.firewall.plist ãå®è¡ããè¨å®ã§ããcx.pow.firewall.plist ã«ã¯å®éã« launchd ãå®è¡ããã³ãã³ãã
ipfw add fwd 127.0.0.1,20559 tcp from any to me dst-port 80 in && sysctl -w net.inet.ip.forwarding=1
ãæ¸ããã¦ãã¾ãã/etc/resolver/dev ã«ã¯ *.dev ã®åå解決ããã¼ã«ã«ãã¹ãã® 20560 çªãã¼ãã§åãã¦ãã DNS ãµã¼ãã§è§£æ±ºããè¨å®ãæ¸ããã¦ãã¾ãã
113-115è¡ç®: Pow ã®èµ·å
echo "*** Starting the Pow server..." launchctl unload "$HOME/Library/LaunchAgents/cx.pow.powd.plist" 2>/dev/null || true launchctl load -Fw "$HOME/Library/LaunchAgents/cx.pow.powd.plist" 2>/dev/null
ã¤ã³ã¹ãã¼ã«ãã Pow ãããããèµ·åãã¾ããæ¢ã«èµ·åãã¦ãã Pow ãããã°å ã«åæ¢ãã¾ãã
以é
Pow ãæ£ããèµ·åãããã©ããã®ç¢ºèªã§ãã
ã¤ã³ã¹ãã¼ã«ã¹ã¯ãªãããã·ã¹ãã ã«ä½ãããã
ããã¾ã§ç¢ºèªãããã¨ãã¾ã¨ããã¨ãã¤ã³ã¹ãã¼ã«ã¹ã¯ãªããã¯ã
- ã¤ã³ã¹ãã¼ã«ãã£ã¬ã¯ããªãä½æãã
- $HOME/Library/Application Support/Pow
- ã¤ã³ã¹ãã¼ã«ãã£ã¬ã¯ããªã« Pow æ¬ä½ããã¦ã³ãã¼ããã¦å±é
- ãã¼ã ãã£ã¬ã¯ããªã«ã·ã³ããªãã¯ãªã³ã¯ ~/.pow ãä½æ
- åç §å 㯠$HOME/Library/Application Support/Pow/Hosts
- /Users/passoingloop/Library/LaunchAgents/cx.pow.powd.plist ãä½æ
- ãã®ãã¡ã¤ã«ã¯ãã°ã¤ã³æã«èªã¿è¾¼ã¾ãå®è¡ããã â ãã°ã¤ã³æã« Pow ãèµ·å
- /etc/resolver/dev ãä½æ
- *.dev ãªãã¹ãåã¯ãã¼ã«ã«ãã¹ãã® 20560 çªãã¼ãã§è§£æ±º
- /Library/LaunchDaemon/cx.pow.firefall.plist ãä½æ
- launchctl ãå®è¡ã㦠â ããã¼ããèµ·åæã«å®è¡ãããããã«ãã
- èµ·åæã« 80 çªãã¼ãã¸ã®ã¢ã¯ã»ã¹ã 20559 çªãã¼ãã«è»¢éããè¨å®
- Pow ãèµ·å
ã¨ãªãã¾ãã
æ¸ãåºãã¦ã¿ãã¨ãPow ã®éæ³ã®ç§å¯ã«è¿ã¥ãããããªæ°ããã¾ããã¤ã¾ããPow 㯠20559 çªãã¼ã㧠HTTP ãµã¼ãã¨ãã¦ã20560 çªãã¼ã㧠DNS ãµã¼ãã¨ãã¦èµ·åãã¾ããmy_app_name.dev ã¨ãã ãã¹ãå㯠Pow DNS ãµã¼ã㧠127.0.0.1 ã«åå解決ããã¾ãããã¼ã«ã«ãã¹ãã® 80 çªãã¼ãã¸ã®ã¢ã¯ã»ã¹ã¯ãã¤ã³ã¹ãã¼ã«ã¹ã¯ãªãããè¨å®ãããã¼ããã©ã¯ã¼ãã£ã³ã°ã«ãã 20559 çªãã¼ãã¸ã¨è»¢éãããPow HTTP ãµã¼ãããªã¯ã¨ã¹ããåãåãã¾ãããã¨ã¯ããã¼ãã£ã«ãã¹ãã使ã£ã¦ Pow ãå Rack ã¢ããªã±ã¼ã·ã§ã³ã«ãªã¯ã¨ã¹ããæ¯ãåããã ãã§ãããã®ã¨ããRack ãµã¼ããèµ·åãã¦ããªããã°ãPow ãèµ·åãã¦ãããã¨ããããã§ãã
ãããã«
æ¬ã¨ã³ããªã§ã¯ãPow ãã¤ã³ã¹ãã¼ã«ããã¨ãã·ã¹ãã ã«ã©ã®ãããªå½±é¿ããããããã¤ã³ã¹ãã¼ã«ã¹ã¯ãªãããé ã«è¿½ã£ã¦ç¢ºèªãã¦ã¿ã¾ãããã¾ãã確èªãããã¨ã§ Pow ã®éæ³ã®ä¸ç«¯ãå£éè¦ããã¨ãã§ãã¾ãããPow ãã¤ã¹ãã¼ã«ãã¦ãã·ã¹ãã ã«å®³ã¯ç¡ããããªã®ã§ãã©ãã©ã curl get.pow.cx | sh ãã¾ãããã
ãã ããç§ã¯ä¸ç¹ã ãæ°ã«ãªãã¨ãããããã¾ãããããã¯ãã¼ããã©ã¯ã¼ãã£ã³ã°ã®ããå®è¡ãã ipfw ã³ãã³ãã§ãfrom any ã¨ãªã£ã¦ããç¹ã§ããFW ãé©åã«éç¨ãã¦ããç°å¢ã§ã¯åé¡ãªãã®ã§ãããããç§ã®å ´åãããããç°å¢ã°ããã¨ããããã«ã¯ãããæ°æã¡æªãã®ã§ãfrom any ã from me ã¨å¤æ´ããã¹ã¯ãªããã使ã£ã¦ãããã¨ãæå¾ã«ã¤ãå ãã¾ãã
*1:passingloop ã¯åèªã®ã¦ã¼ã¶åã§èªã¿æãã¦ãã ãã