LoginSignup
12
13

More than 5 years have passed since last update.

HerokuへFuelPHPプロジェクトをデプロイ

Last updated at Posted at 2015-04-15

OSXで、HerokuへFuelPHPプロジェクトをデプロイする手順

設定項目

項目 設定値
herokuアプリ名 fuel-app-test
Fuelプロジェクトpath /path/to/project
FuelプロジェクトでHerokuにデプロイするブランチ master
herokuのWebServer heroku-php-apache2 (for PHP & Apache2) ※

https://devcenter.heroku.com/articles/custom-php-settings

前提条件

  1. herokuコマンドがインストールされていること
  2. FuelPHPプロジェクトを作成していること
  3. $ heroku login に成功していること

Heroku設定ファイルの作成

/path/to/project/ 以下に Procfile を作成する。

内容は以下のとおり

web: vendor/bin/heroku-php-apache2 public/

composer.json 設定

/path/to/project/composer.json で、configbin-dirの設定を追加

(略)
   "config": {
         "bin-dir": "vendor/bin",
         "vendor-dir": "fuel/vendor"
     },
(略)

gitの設定変更

Procfile をファイル管理に追加

$ cd /path/to/project
$ git add Procfile

composer.json の変更を追加

$ cd /path/to/project/
$ git add composer.json

composer.lock をファイル管理に追加

/path/to/project/.gitignore/composer.lock をコメントアウトしてadd

(略)
 # the composer package lock file and install directory
# /composer.lock
 /fuel/vendor
(略)
$ cd /path/to/project
$ git add composer.lock
$ git add .gitignore

変更をコミット

$ cd /path/to/project
$ git commit

herokuアプリケーションの作成

$ cd /path/to/project
$ heroku create fuel-app-test 
Creating fuel-app-test... done, stack is cedar-14
https://fuel-app-test.herokuapp.com/ | https://git.heroku.com/fuel-app-test.git
Git remote heroku added

デプロイ

$ cd /path/to/project
$ git push heroku master

※ master以外のブランチ、例えばhogeブランチをデプロイしたい場合は

git push heroku hoge:master

とする。

ブラウザで確認

$ cd /path/to/project
$ heroku open

アプリの削除

$ heroku apps:destroy fuel-app-test
 !    WARNING: Potentially Destructive Action
 !    This command will destroy fuel-app-test (including all add-ons).
 !    To proceed, type "fuel-app-test" or re-run this command with --confirm fuel-app-test

> fuel-app-test
Destroying fuel-app-test (including all add-ons)... done
12
13
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
12
13