PHPFogã§CakePHPã¢ããªãåããã¦ã¿ã
PHPFog(https://phpfog.com/)ã¯ãRuby on Railsã®PaaS Herokuã®PHPçã§ãã
PHPFogãHerokuåæ§ã«EC2ä¸ã§æä¾ããããµã¼ãã¹ã§ããä¾¡æ ¼ã¯ãEC2ããã®ã¾ã¾ä½¿ãããã¯å²é«ã§ãããéç¨ã®æéãèããã¨ãã©ãããã©ã¼ã ã®ã²ã¨ã¤ã¨ãã¦æ¤è¨ãããã¨ããã§ãã
以ä¸ãåããã¦ã¿ãã¨ãã®ã¡ã¢ã§ãã
ãµã¤ã³ã¢ãã
å³ä¸ã®[SIGN UP]ãã¯ãªãã¯ãã¦ãµã¤ã³ã¢ããéå§ãã¯ã¬ã¸ããã«ã¼ããç»é²ããªãã¦ãã¨ããããã¢ã«ã¦ã³ãã¯ä½æã§ãã¾ãã
ã¢ããªã±ã¼ã·ã§ã³ãä½æãã
ãµã¤ã³ãããå¾ãå¼ãç¶ãã¢ããªã±ã¼ã·ã§ã³ä½æã®ã¦ã£ã¶ã¼ãã表示ããã¾ãã
ä»åã¯CakePHPã®ã¢ããªã±ã¼ã·ã§ã³ãé¸æãã¾ããã
次ã®ç»é¢ã§ã¤ã³ã¹ã¿ã³ã¹ã®ãã©ã³ãé¸æãã¾ãã
Silverã§Microã¤ã³ã¹ã¿ã³ã¹ç¸å½29$ãç´ ã§Microã¤ã³ã¹ã¿ã³ã¹ä½¿ã£ãå ´åus-eastã§ã15$å¼±ã¯ããã®ã§ååå®ãæ°ãããã
ã¨ããããFreeãé¸æãã¾ããã
次ã®ç»é¢ã§ã¯ãCakePHPã®ã¦ã¼ã¶ID/ãã¹ã¯ã¼ãã¨ãã¡ã¤ã³ã®è¨å®ããã¾ãã
ããã§æå®ããã¦ã¼ã¶IDã¨ãã¹ã¯ã¼ãã¯ãã¼ã¿ãã¼ã¹ã®ã¦ã¼ã¶IDã¨ãã¹ã¯ã¼ãã«ãªãã¾ã(ã¦ã¼ã¶IDã¯ãã<æå®ããã¦ã¼ã¶ID>-<èªåã«å²ãæ¯ãããæ°å¤>ãã«ãªãã¾ã)ã
ãã¡ã¤ã³ãåå¾ãã¦ããªãå ´åã¯[or, use a phpfogapp.com domain name]ãã¯ãªãã¯ããã¨phpfogã®ãµããã¡ã¤ã³ã§åä½ããããã«è¨å®ããã¾ãã
ã¢ããªã±ã¼ã·ã§ã³ã®ä½æãçµãã£ã¦ãindexãã¼ã¸ã«ã¢ã¯ã»ã¹ããã¨ãªã¼ã«ã°ãªã¼ã³ã§ãã楽ã ã
ã¢ããªã±ã¼ã·ã§ã³ã®ãããã¤æ¹æ³
PHPFogã«ä½æããã¢ããªã±ã¼ã·ã§ã³ãæ´æ°ããã«ã¯gitã®ã³ãã³ããå©ç¨ãã¾ãã
ï¼ä»¥éã®ã¢ããªã±ã¼ã·ã§ã³è¨å®ã®ã¹ã¯ãªã¼ã³ã·ã§ããã¯å¤ããªã£ã¦ãã¾ããï¼
SSHãã¼ãçæãç»é²ããã
以ä¸ã®ãã¼ã¸ã®èª¬æã«ãããã£ã¦SSHãã¼ãçæãã¾ãã
http://docs.phpfog.com/index.php/features/article/generating_a_ssh_key
$ cd ~/.ssh
ããã®ãããªãã¡ã¤ã«ããã£ã¬ã¯ããªã¯ããã¾ãããã¨è¨ãããããã£ã¬ã¯ããªãä½ãã¾ãã
$ mkdir ~/.ssh $ cd ~/.ssh
.sshãã£ã¬ã¯ããªã®ä¸èº«ã表示ãã¦ãid_rsaããã³is_rsa.pubãã¡ã¤ã«ããã£ããããã¯ã¢ãããã¦åé¤ãã¾ãã
$ ls id_rsa id_rsa.pub known_hosts $ mkdir key_backup $ cp id_rsa* key_backup $rm id_rsa*
ãã¼ãçæãã¾ãããã¡ã¤ã«åã¯ããã©ã«ãããã¹ã¯ã¼ãç¡ãã ã¨ä»¥ä¸ã®ããã«ã³ã³ã½ã¼ã«ã«è¡¨ç¤ºããã¾ãã
$ ssh-keygen -t rsa Generating public/private rsa key pair. Enter file in which to save the key (/home/hrendoh/.ssh/id_rsa): Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /home/hrendoh/.ssh/id_rsa. Your public key has been saved in /home/hrendoh/.ssh/id_rsa.pub. The key fingerprint is: a1:28:72:04:87:5c:9f:2c:a8:93:67:db:ed:8a:16:f9 hrendoh@hrendoh-PC The key's randomart image is: +--[ RSA 2048]----+ |o.o. | |.+. o . | | ... + . | |.o .. . . | |= =.. . S | | *o+ . | | .o. . | | ..E. | | .. ... | +-----------------+
[MyAccounts]ã®[SSH Keys]ã¿ããéã[Add another SSH Key]ãã¯ãªãã¯ããçæããã.ssh/id_rsa.pubãã¡ã¤ã«ãããã¹ãã¨ãã£ã¿ã§è¡¨ç¤ºãå
¨ä½ãã³ãã¼ãã¦ã[SSH Public Key]ããã¹ãã¨ãªã¢ã«è²¼ãä»ãä¿åãã¾ãã
Gitãªãã¸ããªãä½æ
AppConsoleã®[Source code]ã¿ããéãã¨ä½æããã¢ããªã±ã¼ã·ã§ã³ã®ãªãã¸ããªã確èªã§ãã¾ãã
gitãå
¥ã£ã¦ããªãå ´åã¯
$ sudo apt-get install git
$ git clone [email protected]:cakephp.phpfogapp.com
cakephp.phpfogapp.comãã£ã¬ã¯ããªä»¥ä¸ã«CakePHPã®ããã¸ã§ã¯ããã§ããã
ãã¼ã¿ãã¼ã¹ã®è¨å®ã¾ã§çµãã£ã¦å±
ãã®ã§è¶
ç°¡åã
git cloneã§ä»¥ä¸ã®ã¨ã©ã¼ãåºãå ´åã¯
Agent admitted failure to sign using the key. Permission denied (publickey). fatal: The remote end hung up unexpectedly
ssh-addãã¦ã¿ã¦ãã ããã
$ ssh-add ~/.ssh/id_rsa
ãã¼ã¿ãã¼ã¹ã«ãã¼ãã«å®ç¾©
PHPMyAdminã使ãã¾ãã
PHPMyAdminã¸ã®ãªã³ã¯ã¯AppConsoleã®[Source code]ã¿ããéãã¨ããã¾ãã
phpmyadminã®ãã¹ã¯ã¼ãã¯ãCakePHPã®å ´åã¯app/config/database.phpã§ã確èªã§ãã¾ãããã¢ããªã±ã¼ã·ã§ã³ä½æã®Step 3ã§æå®ãããã¹ã¯ã¼ããè¨å®ããã¦ãã¾ãã
PHPFogã®ç¹å¾´
ä»å試ãã¦ã¿ã¦ãæ°ã¥ããç¹ãããã¤ã
.htaccessãini_setãå©ç¨å¯è½
PaaSã§ãããçµæ§æè»ãªè¨å®ãå¯è½ã§ãã
http://docs.phpfog.com/index.php/features/article/set_php.ini_values_using_.htaccess_and_set_ini
å¤é¨ã©ã¤ãã©ãªã®å©ç¨ã«ã¤ãã¦
PHPFogã¯ãinclude_pathãã¢ããªã±ã¼ã·ã§ã³ã§è¨å®ãããã¨ã¯ã§ããªãããã«è¨å®ããã¦ããããã§ãã
http://help.phpfog.com/discussions/problems/729-open_basedir-restriction
CakePHPã®vendorsã¯ããã©ã«ãã§ãã¹ãéãã¨ããã¦æ¬²ããæ°ããã¾ãããinclude_pathãåºåãã¦ã¿ãã¨ä»¥ä¸ã®ãã¹ãéã£ã¦ãããã¨ãåããã¾ãã
.:/usr/share/php:/usr/share/pear:/usr/share/php/libzend-framework-php:/var/fog/apps/app5868/tmp:/var/fog/apps/<ã¢ããªã±ã¼ã·ã§ã³ID>/<ã¢ããªã±ã¼ã·ã§ã³å>.phpfogapp.com
PEARã¨ZENDã®ã©ã¤ãã©ãªã¨ã¢ããªã±ã¼ã·ã§ã³ã®ã«ã¼ããã£ã¬ã¯ããªã«ãã¹ãéã£ã¦è¦ãã®ã§ãããã§ããããããå¿ è¦ãããããã§ãã
ã¡ã¼ã«ãéä¿¡ã§ãã
ã¡ã¼ã«ã®éä¿¡ãè¡ãã¾ãã
http://docs.phpfog.com/index.php/features/article/sending_email
å®éã«ãmb_send_mailã§ã¡ã¼ã«éä¿¡ããã¢ããªã±ã¼ã·ã§ã³ãåããã¦è¦ã¾ããããæ¥æ¬èªãåããã«éä¿¡ã§ãã¾ããã
35é/ç§ãããã®éã§ããã°å¯è½ã ãä¿¡é ¼æ§ã®ããæ¹æ³ã§ã¯ç¡ãã¨æ¸ãã¦ããã
ã¢ããªã±ã¼ã·ã§ã³ãã°ãè¦ããªã
ãããç¡ãã¨ã¾ã éç¨ã¯ç¡çã
試使ç¨ã®å¶éã¯ãããã
ã¢ã«ã¦ã³ããã¨ã«ã6ã¶æé1ã¢ããªã±ã¼ã·ã§ã³ã ãç¡æã§ä½¿ãã¾ãã
以ä¸ãã¾ã Rubyã®Herokuã»ã©ã®æ©è½ã¯ããããããä»å¾ã«æå¾ ã§ããã