HerokuでLaravel

  • 11
    いいね
  • 1
    コメント

HerokuにLaravel5.1をデプロイのメモ。

ComposerでLaravel5をGet!

% composer create-project laravel/laravel --prefer-dist heroku-laravel5
Installing laravel/laravel (v5.1.11)
  - Installing laravel/laravel (v5.1.11)
    Loading from cache
    省略...

直下にApacheなProcfileを作る!

% cd heroku-laravel5
% ls
app     bootstrap   composer.lock   database    package.json    phpunit.xml readme.md   server.php  tests
artisan     composer.json   config      gulpfile.js phpspec.yml public      resources   storage     vendor
% touch Procfile
% echo 'web: vendor/bin/heroku-php-apache2 public' >> Procfile

Gitの初期化

% git init
Initialized empty Git repository in /Users/tetsuya/Project/heroku-laravel5/.git/
% git add .
% git commit -m 'init laravel5'

Herokuアプリを作成(ビルドパックはPHP)

% heroku create heroku-laravel5 --buildpack https://github.com/heroku/heroku-buildpack-php
Creating heroku-laravel5... done, stack is cedar-14
Buildpack set. Next release on heroku-laravel5 will use https://github.com/heroku/heroku-buildpack-php.
https://heroku-laravel5.herokuapp.com/ | https://git.heroku.com/heroku-laravel5.git
Git remote heroku added

Herokuへpushしてブラウザで見る!

% git push heroku master
% heroku open
  • エラー画面の出現!

ビルドパックの確認!

% heroku buildpacks
=== heroku-laravel5 Buildpack URL
https://github.com/heroku/heroku-buildpack-php

nodeの方のビルドパックも追加してやる!

% heroku buildpacks:add heroku/nodejs
Buildpack added. Next release on heroku-laravel5 will use:
  1. https://github.com/heroku/heroku-buildpack-php
  2. heroku/nodejs
Run git push heroku master to create a new release using these buildpacks.

Herokuへpushしてブラウザで見る2!

% git push heroku master
% heroku open
  • エラー画面の出現2!

APP_KEYを設定!

heroku config:set APP_KEY=$(php artisan key:generate --show)

Herokuへpushしてブラウザで見る3!

% git push heroku master
% heroku open
  • 見れましたー