LoginSignup
4
4

More than 5 years have passed since last update.

Bolt CMS を heteml にインストールする手順

Last updated at Posted at 2015-01-24

Sqale.jpだとうまくいかなかったので、hetemlでやってみた。

自分は公式にあるgitcomposerによるインストールの方法でやりました。
Option 3: The developer way, using Git and Composer.

0. 下準備

下記を参考にheteml上にリモートリポジトリを作成し、ローカルと動機しておく。
Gitのhookで自動デプロイ(heteml編)

1. Boltを設置

git cloneしてcomposerでバンドルをインストールするだけ。ちゃんとパーミッションも変更しておきましょう。

$ cd public
$ git clone git://github.com/bolt/bolt.git bolt
$ cd bolt
$ curl -s http://getcomposer.org/installer | php
$ php composer.phar install
$ chmod -R 777 files/ app/database/ app/cache/ app/config/ theme/ extensions/

$ php composer.phar installで下記のようなエラーが出る場合、githubにaccess tokenを得る必要があります。こちらを参考に設定をします。
ComposerでGitHubのリポジトリをHTTPSで追加したときの認証設定

Could not fetch https://api.github.com/repos/silexphp/Silex/zipball/57c98ea0cb47664096094912920951fde1f4631a, enter your GitHub credentials to go over the API rate limit
The credentials will be swapped for an OAuth token stored in /home/sqale/.composer/auth.json, your password will not be stored
To revoke access to this token you can visit https://github.com/settings/applications
Username: 

/bolt配下をすべてドキュメントルートへ移動。(※本当はアプリ/bolt配下のママ、サイトの表示はルートにしたいができなかったのでしかたなくぶちまけてます.. たぶんこれでできると思うのだが試してない Keeping Code out of the Web Root

$ mv bolt/* ./
$ mv bolt/.??* ./
$ rm -r bolt

3.DBを設定

Boltの設定ファイルをコピーします。

$ cp app/config/config.yml.dist app/config/config.yml
$ vi app/config/config.yml

で、DB情報を書き換え。
Sqaleの場合ここから得られます。
https://sqale.jp/projects/YOUR_PROJECT/shared_database

config.yml
database:
  driver: mysql
  databasename: sqale_**********
  username: sqale_**********
  password: ********************
  host: mysql***.sqale.jp

※ちなみに、ローカルでは設定を変えたい場合、config_local.ymlに別途記入すれば項目が上書きされる。参考:Installing Bolt | Bolt documentation | Different configs per environment

たとえば、MAMPならばこう。

config_local.yml
database:
  driver: mysql
  databasename: YOUR_DB_NAME
  username: root
  password: root
  host: localhost
  port: 8889

4.日本語化

ついでに日本語化しておきます。
localeの行を下記に。

config.yml
locale: ja_JP
timezone: Asia/Tokyo

5.インストール

ローカルでブラウザからインストールを進めます。
以下MAMPの例。

はじめは下記に転送されるはずです。必要事項を入力します。
http://localhost:8888/bolt/users/edit/

http://localhost:8888/bolt/users/edit/

6.ログイン

続いて今登録したユーザー情報でログインするとダッシュボードがあらわれます。

http://localhost:8888/bolt/

にアクセスして、デフォルトテーマのブログが表示されれば成功です。

追記

アプリを/boltに配置して、サイトは/アクセスで表示されるように
したくていろいろやってみたがダメだった。なにかいい方法ないでしょうか。

やったこと

  • .htacessindex.phpをルートにコピーして中に記述してあるパスに/boltを追加(WordPressのように)→ 表示されたが、themeのパスが/bolt/themeとなるべきなのに/themeになってしまう。

7. hetemlにデプロイ

$ git add .
$ git commit -m 'installed Bolt'
$ git push origin master

すればOK!

…が、

下記のようなエラーが出た。おそらくcomposerまわり。

そもそもcomposer入ってない、curlも入ってないと言われる。

$ composer
-bash: composer: command not found
$ curl -s http://getcomposer.org/installer | php
-bash: curl: command not found

なので、仕方なくこうする。

$ php -r "readfile('https://getcomposer.org/installer');" | php
$ php composer.phar install

すると途中でgithubにアクセスできねーと言われる

Could not fetch https://api.github.com/repos/silexphp/Silex/zipball/57c98ea0cb47664096094912920951fde1f4631a, enter your GitHub credentials to go over the API rate limit
The credentials will be swapped for an OAuth token stored in /home/sites/heteml/users/Y/O/U/YOU/.composer/auth.json, your password will not be stored
To revoke access to this token you can visit https://github.com/settings/applications
Username: 

ので、ComposerでGitHubのリポジトリをHTTPSで追加したときの認証設定 の通り設定して

~/.composer/auth.json
{
    "github-oauth": {
        "github.com": "ACCESS_TOKEN"
    }   
}

再度トライ。

$ php composer.phar install 

うまくいったので、再度アクセス。

すると今度は、cacheフォルダが無いと怒られる。

ので作る。

$ mkdir -p app/cache

さらに、config.ymlファイルが.gitignoreされてるようなので無視しないようにする。

# app/config/*.yml
app/config/*_local.yml #_localとついたものは無視
# *config.yml

で、再度pushすると下記のようなエラーがでる。

remote: error: The following untracked working tree files would be overwritten by merge:
remote:         app/config/contenttypes.yml
remote:         app/config/menu.yml
remote:         app/config/permissions.yml
remote:         app/config/routing.yml
remote:         app/config/taxonomy.yml
remote: Please move or remove them before you can merge.

ので、仕方なく強制的にリポジトリの内容を同期する。
gitでリモートのブランチにローカルを強制一致させたい時

$ git fetch origin
$ git reset --hard origin/master

以上でBoltが動くはず。

4
4
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
4
4