LoginSignup
0
0

More than 5 years have passed since last update.

KUSANAGI for VMware から KUSANAGI for さくらのクラウドへ WordMove で push する

Posted at

手順

1. rbenv のインストール

rbenv を使って ruby をインストールする(CentOS編) - Qiita
上記を参考に、rbenvを入れる。ただ、readlineがないってエラーが出るので、予め、yumで入れておこう。ちなみに、gitははじめから入っていた。

[GUEST KUSANAGI]$ sudo yum install -y readline-devel
[GUEST KUSANAGI]$ git clone https://github.com/sstephenson/rbenv.git ~/.rbenv
[GUEST KUSANAGI]$ echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
[GUEST KUSANAGI]$ echo 'eval "$(rbenv init -)"' >> ~/.bashrc
[GUEST KUSANAGI]$ source .bashrc
[GUEST KUSANAGI]$ git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
[GUEST KUSANAGI]$ rbenv install 2.5.1
[GUEST KUSANAGI]$ rbenv rehash
[GUEST KUSANAGI]$ rbenv global 2.5.1

2. WordMoveをインストール

welaika/wordmove: Multi-stage command line deploy/mirroring and task runner for Wordpress
上記、WordMoveのgithubのReadMeを見ながら、wordmoveを入れる

[GUEST KUSANAGI]$ gem install wordmove
[GUEST KUSANAGI]$ rbenv rehash

3. movefile.ymlを作成

普段wordmoveコマンドを打ちそうなディレクトリに移動して、movefile.ymlを作る

[GUEST KUSANAGI]$ cd ~/project_name/
[GUEST KUSANAGI]$ wordmove init

4.movefile.yml を書き換える

movefile.yml自体の記述については、別の人の記事を参照いただくとして、KUSANAGI宛にテーマファイルをpushする際に気をつける設定をする

global:
  sql_adapter: wpcli

local:
  vhost: http://example.com
  wordpress_path: /your/wp/path

  database:
    name: wordpress_db_name
    user: wordpress_db_user
    password: "wordpress_db_pass"
    host: 127.0.0.1

staging:
  vhost: http://staging.example.com
  wordpress_path: /your/wp/path/at/remote

  database:
    name: remote_db_name
    user: remote_db_user
    password: remote_db_pass
    host: localhost

  exclude:
    - '.git/'
    - '.gitignore'
    - 'node_modules/'
    - 'bin/'
    - 'tmp/*'
    - 'Gemfile*'
    - 'Movefile'
    - 'movefile'
    - 'movefile.yml'
    - 'movefile.yaml'
    - 'wp-config.php'
    - 'wp-content/*.sql.gz'
    - '*.orig'
    - 'gulp/'

  ssh:
    host: ssh_host_name
    rsync_options: --verbose --itemize-changes --chmod=Da=rwx,Fu=rw,Fg=r,Fo=r # Add chmod param

追加するのは、 --chmod オプション。普通にpushすると、なぜかすべてのファイル/ディレクトリが770になり、ページが表示されなくなるので、--chmod=Da=rwx,Fu=rw,Fg=r,Fo=rを追加し、「ディレクトリは777に、ファイルは644に」なるようにしておく。

ただ、このコマンドはプラグインなどの転送にも利用されるので、もしかしたらファイルのパーミッションも777のほうがいいかもしれない

参考サイト

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