ãããã¤ãã¼ã«Altaxããã¼ã¸ã§ã³2ã«æ´æ°ãã¾ãã
CapistranoçãªPHP製ãããã¤ãã¼ã«Altaxããã¼ã¸ã§ã³1â2ã¨ãã¦ã¢ãããã¼ããã¾ããã
https://github.com/kohkimakimoto/altax
ãã®ã½ããã¦ã§ã¢ã¯PHPã§è¨è¿°ããã¿ã¹ã¯ããè¤æ°ã®ãªã¢ã¼ããµã¼ãã«å¯¾ãã¦å®è¡ãã¾ãã ãµã¼ãæ¥ç¶ã«ã¯éµèªè¨¼ã®SSHã使ç¨ãã並åã«å®è¡ãã¾ãã åä½ã«å¿ è¦ãªãã¡ã¤ã«ã¯1ã¤ã ãã§ãPHPã®å®è¡ç°å¢ãããã°ç°¡åã«å°å ¥ã§ãã¾ãã
Version1ããã®å¤æ´ç¹
- å®è£ ãSymfony Componentsã使ã£ã¦å¤§å¹ ã«å¤æ´ãåæ§æã
- pharã«ããå®è¡ãã¡ã¤ã«å½¢å¼ã®é å¸ããµãã¼ãã
- ããã©ã«ãã®èªã¿è¾¼ã¿è¨å®ãã¡ã¤ã«ã®ãã¹ãå¤æ´ã
- ã¯ã©ã¹ãã¼ã¹ã®ã¿ã¹ã¯å®ç¾©ããµãã¼ãã
- ãã°åºåæ©è½ã追å ã
- SSHæ¥ç¶ã®å®è£ é¨åãsshã³ãã³ãããphpseclibã«å¤æ´ã
ã¤ã³ã¹ãã¼ã«
ããã¥ã¡ã³ãã¯ã¾ã æ´æ°ãã¦ãªãã®ã§ããã£ããæåã®ä½¿ãæ¹ã ãè¨è¿°ãã¦ããã¾ããå®è¡ã«ã¯PHP5.3以ä¸ãå¿ è¦ã§ããã¾ãWindowsã§ã¯å¤ååãã¾ããã
ã¤ã³ã¹ãã¼ã«ã¯ä»¥ä¸ã®ã³ãã³ããå®è¡ããã ãã§ãã
$ curl https://raw.github.com/kohkimakimoto/altax/master/installer.sh | sudo bash -s system v2
/usr/local/bin/altax
ã«å®è¡ãã¡ã¤ã«ãã¤ã³ã¹ãã¼ã«ããã¾ãã
æåã§å¥½ããªå ´æã«ã¤ã³ã¹ãã¼ã«ãããå ´åã¯ã以ä¸ã®ããã«ç´æ¥altax.phar
ãæã£ã¦ãã¦é
ç½®ããã°ããã§ãããã
$ wget https://github.com/kohkimakimoto/altax/raw/master/altax.phar
$ chmod 755 altax.phar
$ mv altax.phar /path/to/install_dir/altax
ã¨ããããå®è¡ãã
ãªã«ãä»ããã«ã³ãã³ããå©ãã¨ããã¼ã¸ã§ã³æ å ±ããµãã³ãã³ãä¸è¦§ã表示ããã¾ã
$ altax
è¨å®ãã¡ã¤ã«ãä½æãã
$ altax init
initã³ãã³ããå®è¡ããã¨ã«ã¬ã³ããã£ã¬ã¯ããªã«ä»¥ä¸ã®ãããªæ§é ã®.altax
ãã£ã¬ã¯ããªãä½æãã¾ãã
.altax/
config.php # ã¡ã¤ã³ã®è¨å®ãã¡ã¤ã«ã
hosts.php # æ¥ç¶å
ãã¹ããè¨è¿°ããç¨ã®ãã¡ã¤ã«
tasks/ # ã¿ã¹ã¯å®ç¾©ãç½®ããã£ã¬ã¯ããª
hellow.php.sample # ãµã³ãã«ã®ã¿ã¹ã¯å®ç¾©ã
å¿
é ãªã®ã¯config.php
ã ãã§ããã®ä»ã®ãã¡ã¤ã«ã¯å¿
è¦ã«å¿ãã¦config.php
ããèªã¿è¾¼ãã§ä½¿ç¨ãã¾ã(ä»åã¯ä½¿ãã¾ãã)ã
config.phpã¯ã³ã¡ã³ãã¢ã¦ãããã¦ããã¨ãããé¤ãã¨ä»¥ä¸ã®ããã«ãªã£ã¦ãã¾ãã
host('127.0.0.1', array('web', 'localhost'));
desc('This is a sample task.');
task('sample',array('roles' => 'web'), function($host, $args){
run('echo Hellow World!');
});
hosté¢æ°ã§æ¥ç¶å ãã¹ãã®è¨å®ãtaskã§å®è¡ã¿ã¹ã¯ãå®ç¾©ãã¦ãã¾ãããã®ãµã³ãã«ã§ã¯ãã¼ã«ã«ãã¹ãã«æ¥ç¶ãã«ããã¾ãã æ¥ç¶å ãã¹ãã¯ãã¹ã¯ã¼ããªãã®éµèªè¨¼ã§SSHã§ããããã«ãã¦ããå¿ è¦ãããã¾ãã
åã³altax
ã³ãã³ãããµãã³ãã³ããªãã§å®è¡ãã¾ãã
$ altax
Available commands:
config Show configurations
help Displays help for a command
init Create default configuration directory in the current directory
list Lists commands
sample This is a sample task.
Available commandsã«sampleã¿ã¹ã¯ã表示ããã¾ããå®è¡ãã¦ã¿ã¾ãããã
$ altax sample
Altax version 2.1.0
Starting altax process
- Starting task sample
Found 1 target hosts: 127.0.0.1
- Running sample at 127.0.0.1
Hellow World!
Completed task sample
以ä¸ã®ããã«Hellow World!ãechoã³ãã³ãã§å®è¡ããã¾ãã
詳細ãªä½¿ãæ¹ã«ã¤ãã¦
ä»åã¯ããã¾ã§ã§ãã詳細ã¯å¾æ¥ãããã¥ã¡ã³ããããã°ã«ã¾ã¨ãããã¨æã£ã¦ãã¾ãã
ã¡ã¢) Symfony Componentsãæ¿ãã便å©ãªä»¶
ä»åã³ãã³ãã©ã¤ã³ã®ããã°ã©ã ãæ¸ãç´ããããã§ããããã®éã«å©ç¨ããSymfony Componentsãæ¿ãã便å©ã§ããã
ãããã使ã£ãããã§ããã ä»ã¾ã§ã³ãã³ãã©ã¤ã³ãªãã·ã§ã³ããã¼ã¹ããå¦çãgetopté¢æ°ä½¿ã£ã¦ã·ã³ã·ã³æ¸ãã¦ãããããã®ããããããç°¡åã«æ¸ããããã«ãªãã¾ãã åºåã¡ãã»ã¼ã¸ã«è²ã¤ãããããã£ã¬ã¯ããªãããã¡ã¤ã«ä¸è¦§ãæã£ã¦ãããã¨ãããããã楽ã
ã¿ããªã使ã£ãã»ããããã§ãã½(^o^)丿ã
ã¡ã¢) ã ããç¥ã£ã¦ããæãã¦
SSHã§ã³ãã³ãå®è¡ãæ£å¸¸ã«ã§ãããã¨ã®ãã¹ããtravis-ciã§ããã®ã£ã¦ã©ãããã ã¨ã ãããããã¨ããããããã®ãã¨Capistranoã®ãã¹ãã³ã¼ãè¦ã«è¡ã£ã¦ãã¾ãããã¨ã