0

私は最近パペットについて知ったばかりで、vagrant のプロビジョニング中に laravel をインストールしようとしています。しかし、行き詰まり、正常に実行されましたが、vagrant sshを実行した後、laravelコマンドが使用できません。

php5、php5-cli など。composer およびその他の依存関係は、コードのこの部分の前に既にインストールされています。

class laravel {

    Exec {
        path => "/bin:/sbin:/usr/bin:/usr/sbin",
    }

    exec { "install-laravel" :
        command     => "/usr/local/bin/composer global require 'laravel/installer'",
        require     => [Package["php5-cli", "php5-dev"], Exec["install-composer", "set-composer-as-global"]],
        cwd         => "/home/vagrant/",
        environment => ["COMPOSER_HOME=/home/vagrant"],
        user        => root, 
        group       => root,
    }

    exec { "add-laravel-command" :
        command     => "mkdir /usr/local/bin/laravel",
        environment => ["LARAVEL_HOME=/home/vagrant"],
        onlyif      => "test -d /usr/local/bin/composer",
        require     => Exec["install-laravel"],
        user        => root, 
    }

    exec { "set-laravel-as-globall" :
        command     => "mv /home/vagrant/.composer/vendor/bin /usr/local/bin/laravel",
        onlyif      => "test -d /.composer/vendor/bin",
        require     => Exec["add-laravel-command"],
        user        => root, 
    }
}

出力

==> default: Notice: /Stage[main]/Laravel/Exec[install-laravel]/returns: executed successfully
==> default: Debug: /Stage[main]/Laravel/Exec[install-laravel]: The container Class[Laravel] will propagate my refresh event
==> default: Debug: Exec[add-laravel-command](provider=posix): Executing check 'test -d /usr/local/bin/composer'
==> default: Debug: Executing 'test -d /usr/local/bin/composer'
==> default: Debug: Exec[set-laravel-as-globall](provider=posix): Executing check 'test -d /.composer/vendor/bin'
==> default: Debug: Executing 'test -d /.composer/vendor/bin'
==> default: Debug: Class[Laravel]: The container Stage[main] will propagate my refresh event

どんな助けでも大歓迎です。ありがとう

4

1 に答える 1

0

下にファイルを作成し、次の内容でpuppet/modules/laravel/files名前を付けますcomposer.json

{                                            
    "require": {                             
        "laravel/installer": "^1.3"          
    }                                        
}

Laravel init.pp ファイル

class laravel {

    Exec {
        path => "/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin",
        user => root,
        group => root,
    }

    file { "/usr/local/bin/laravel-devtools" :
        ensure  => directory,
        owner   => root,
        group   => root,
    }

    file { "/usr/local/bin/laravel-devtools/composer.json" :
        source  => "puppet:///modules/laravel/composer.json",
        require => File["/usr/local/bin/laravel-devtools"],
        owner   => root,
        group   => root,
    }

    exec { "install-laravel" :
        command     => "sudo composer require 'laravel/installer'",
        onlyif      => "test -f /usr/local/bin/composer",
        require     => [
            Package["nginx","php5-cli", "php5-dev", "php5-mysql"], 
            File["/usr/local/bin/laravel-devtools", "/usr/local/bin/laravel-devtools"],
        ],
        environment => ["COMPOSER_HOME=/home/vagrant"],
        cwd         => "/usr/local/bin/laravel-devtools", 
        user        => root, 
        group       => root,
    }

    exec { "set-laravel-as-global" :
        command => "sudo ln -s /usr/local/bin/laravel-devtools/vendor/laravel/installer/laravel /usr/local/bin/laravel",
        require => [
            File["/usr/local/bin/laravel-devtools", "/usr/local/bin/laravel-devtools/composer.json"],
            Exec["install-laravel"],
        ],
    }

}

composerプロビジョニング中に最初にインストールされていることを確認してください。

于 2016-08-23T00:05:17.630 に答える