otto에 Symfony2를 구축했습니다.

6210 단어 PHPottoSymfony2
이 큰 웨이브를 탈 수밖에 없어서 해 봤어요.

otto 설정


적당한 디렉터리에 다운로드해서 해동하면 됩니다.
$ cd ~/bin
$ wget -qO- -O tmp.zip https://dl.bintray.com/mitchellh/otto/otto_0.1.1_darwin_amd64.zip && unzip tmp.zip && rm -rf tmp.zip

symfony2 설치


이번에는symfony 명령으로 설치합니다.
$ symfony new otto_symfony2

시험otto


otto를 사용할 때 Appfile이 필요할 것 같아서 설정하려면
$ cd otto_symfony2
$ vi Appfile
application {
  name = "otto-symfony2"
  type = "php"
}
그리고 complte 명령만 실행합니다
otto compile

==> Loading Appfile...
==> Fetching all Appfile dependencies...
==> Compiling...
    Application:    otto-symfony2 (php)
    Project:        otto_symfony2
    Infrastructure: aws (simple)

    Compiling infra...
    Compiling foundation: consul
==> Compiling main application...
==> Compilation success!
    This means that Otto is now ready to start a development environment,
    deploy this application, build the supporting infastructure, and
    more. See the help for more information.

    Supporting files to enable Otto to manage your application from
    development to deployment have been placed in the output directory.

개발 환경을 만들다


dev 지령만으로도 개발 환경을 만들 수 있다는 게 너무 좋아요!!!
$ otto dev

==> Creating local development environment with Vagrant if it doesn't exist...
    Raw Vagrant output will begin streaming in below. Otto does
    not create this output. It is mirrored directly from Vagrant
    while the development environment is being created.

Bringing machine 'default' up with 'virtualbox' provider...
==> default: Box 'hashicorp/precise64' could not be found. Attempting to find and install...
    default: Box Provider: virtualbox
    default: Box Version: >= 0
==> default: Loading metadata for box 'hashicorp/precise64'
.
.
.
(略)
==> Development environment successfully created!
    IP address: 172.16.1.35

    A development environment has been created for writing a PHP app.

    Edit files locally on your machine, the file changes will be synced
    to the development environment automatically.

    To run and view your application, run 'otto dev ssh' to enter the
    development environment. You'll be placed directly into the working
    directory where you can run "composer", "php", etc.

    You can access the environment from this machine using the IP address above.
    For example, if you start your app with 'php -S 0.0.0.0:5000', then you can
    access it using the above IP at port 5000.
그리고 내장 서버로 이동하고 ssh로 연결합니다.
$ otto dev ssh 
$ app/console server:start 0.0.0.0:8000
주소 확인
$ otto dev address
172.16.1.35
브라우저로 액세스

symfony2의 페이지를 잘 보여줍니다!
아주 간단하다

정지하다


dev 환경의vagrant를 멈추려면
$ otto dev vagrant halt
이렇게 써.otto dev vagrant에서 vagrant 명령을 사용할 수 있습니다.

삭제


삭제하려면 다음 명령을 실행하면 됩니다
$ otto dev destroy

버전 지정


customaization에서 지정한 버전이면 될 것 같은데 dev면 안 될 것 같아요...
이따가 알아볼게요.

mysql 사용하고 싶어요.


dependency로 지정하면 이동할 수 있습니다.
중간부품의 물건은 dependency로 해결할 수 있을 것 같습니다.
도커의 이미지를 사용할 수 있어 매우 편리합니다.

application {
  name = "otto-symfony2"
  type = "php"

  dependency {
      source = "github.com/polidog/otto-mysql-5.6"
  }
}
$ otto compile
symfonyg 측parameters.ymldb의 연결을 변경하면 사용할 수 있습니다.
parameters.yml
# This file is auto-generated during the composer install
parameters:
    database_host: dev
    database_port: null
    database_name: otto_symfony2
    database_user: root
    database_password: root

dev의 php 환경은 어떻게 구축되었습니까?


나는 약간의 의문이 있어서 조사해 보았다.
텔레비전을 보는 느낌은 마치 ubuntu-1.04인 것 같다.
php 포장은
  • php5-mcrypt
  • php5-mysql
  • php5-fpm
  • php5-gd
  • php5-readline
  • php5-pgsql
  • 닮았어.
    그나저나 otto dev ssh 연결하면 php-fpm가 시작된 것 같아요.
    $ otto dev ssh
    vagrant@precise64:/vagrant$ ps aux | grep php
    root      9563  0.0  4.4 334180 16816 ?        Ss   18:05   0:00 php-fpm: master process (/etc/php5/fpm/php-fpm.conf)
    
    이렇게 되면nginx를 원하게 된다.
    내장 서버를 별로 사용하고 싶지 않습니다.
    그나저나 빌딩에 apche가 있을까요?
    https://github.com/hashicorp/otto/blob/master/builtin/app/php/data/aws-simple/build/build-php.sh.tpl
    어쨌든 dev 주위는 더 많은 자유를 원하는 곳이다
    현재는chef,puppet,ansible 등 공급 도구를 사용하는 것이 좋을 수도 있다.

    프로그램 설계


    너무 귀찮아서 다음에 laravel 기사 보면 대충 알 것 같은데... w
    원하시면 보충해 드릴게요.

    최후


    실행 환경을 간단하게 준비할 수 있는 편리한 도구가 확실하다.
    하지만 세밀한 설정은 힘들 것 같아요.
    앞으로의 otto를 기대합니다!

    참고 문장

  • otto에 Laavel 구축

  • otto로 Full php 구축
  • otto의 Ruby &mysql 환경 구축
  • 좋은 웹페이지 즐겨찾기