寒い日の夜は、膝関節が成長期。

朝散歩して、パン買って、少し内職して、ゆっくり過ごす日々

DockerでEC-CUBE2をあげてみた

  • Dockerをインストール
$ sudo su
# yum -y update
# yum install docker-io
# docker -v
▼グループに追加
# groupadd docker
▼一般ユーザ hoge をグループ docker に追加
# gpasswd -a hoge docker
▼daemon登録
# chkconfig docker on
▼起動
# service docker start
▼コマンド打てるか確認
ctrl + d
$ docker ps
▼動作確認
$ docker run --rm centos echo 'hello world'
~~ 省略 ~~
hello world
▼起動の確認
$ docker info

▼参考 https://qiita.com/gillax/items/6f864e7c21c6a3e4173b

# mkdir /var/docker/eccube-docker/
# docker pull matsubo/eccube
# docker run -it -p 10080:80 -p 10022:22 -v /var/docker/eccube-docker/ -d matsubo/eccube:latest
# docker ps
CONTAINER ID        IMAGE                   COMMAND             CREATED             STATUS              PORTS                                                              NAMES
8f594c423ecd        matsubo/eccube:latest   "supervisord -n"    21 minutes ago      Up 21 minutes       3306/tcp, 5432/tcp, 0.0.0.0:10022->22/tcp, 0.0.0.0:10080->80/tcp   naughty_colden
▼立ち上げたdockerへログイン
# docker exec -it 8f594c423ecd /bin/bash

** EC-CUBEのインストール ▼ディレクトリを整理

# cp -rp var/www/html/eccube-2.13.3 var/www/html/eccube-2.13.3.org
# mv var/www/html/eccube-2.13.3 var/www/html/hoge
# cd var/www/html/hoge/

Mysqlでユーザ・DB作成 ブラウザから「http://ip:10080/」開き、phpmyadminをクリックしてmyadminを開く Root/空

▼ユーザを作成する 同名DBを作成する DB名:hoge_db ユーザ名:hoge_user パスワード:hoge_password

▼EC-CUBE2をWEBインストール ブラウザで http://ip:10080/odougu/html/install/ [ECサイトの設定] 店名※:みんなのお道具箱 メールアドレス:abc@hoge.com ログインID:loginid パスワード:password [管理機能の設定] ディレクトリ※:admin 管理機能にアクセスする下記URLの [管理機能ディレクトリ] の部分です。 [管理機能ディレクトリ] http://ip:10080/ SSL制限:なし IP制限:なし [WEBサーバーの設定] URL(通常)※:http://ip:10080/ URL(セキュア)※http://ip:10080/ 共通:空欄 [メールサーバーの設定(オプション)] メーラーバックエンド: smtp SMTPホスト : smtp.hoge.net SMTPポート : 587 SMTPユーザー : abc@hoge.com SMTPパスワード: hogehoge [DB] DBの種類:MySQL サーバ:127.0.0.1 ポート:空欄 DB名:hoge_db ユーザ名:hoge_user パスワード:hoge_password

ブラウザで http://ip:10080/admin/ ログインID:loginid パスワード:password

/install/index.php は、インストール完了後にファイルを削除してください。 # rm -rf html/install/index.php

*** phpMyadminのSelect表示でERRORになる場合

# find / ! -regex '.*/\.svn/.*' -a -name 'config.inc.php'
# cp -rp /etc/phpmyadmin/config.inc.php /etc/phpmyadmin/config.inc.php.bk.`date +%Y%m%d`
# vim /etc/phpmyadmin/config.inc.php
下記のようにコメントアウト
/**
    $cfg['Servers'][$i]['pmadb'] = $dbname;
    $cfg['Servers'][$i]['bookmarktable'] = 'pma_bookmark';
    $cfg['Servers'][$i]['relation'] = 'pma_relation';
    $cfg['Servers'][$i]['table_info'] = 'pma_table_info';
    $cfg['Servers'][$i]['table_coords'] = 'pma_table_coords';
    $cfg['Servers'][$i]['pdf_pages'] = 'pma_pdf_pages';
    $cfg['Servers'][$i]['column_info'] = 'pma_column_info';
    $cfg['Servers'][$i]['history'] = 'pma_history';
    $cfg['Servers'][$i]['table_uiprefs'] = 'pma_table_uiprefs';
    $cfg['Servers'][$i]['designer_coords'] = 'pma_designer_coords';
    $cfg['Servers'][$i]['tracking'] = 'pma_tracking';
    $cfg['Servers'][$i]['userconfig'] = 'pma_userconfig';
    $cfg['Servers'][$i]['recent'] = 'pma_recent';
*/

** EC-CUBE設定 $ vim /var/www/html/hoge/data/config/config.php

** apache設定

# vi /etc/apache2/sites-available/000-default.conf

<VirtualHost *:80>
        # The ServerName directive sets the request scheme, hostname and port that
        # the server uses to identify itself. This is used when creating
        # redirection URLs. In the context of virtual hosts, the ServerName
        # specifies what hostname must appear in the request's Host: header to
        # match this virtual host. For the default virtual host (this file) this
        # value is not decisive as it is used as a last resort host regardless.
        # However, you must set it for any further virtual host explicitly.
        ServerName hogehoge.jp

        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/html/hoge/html
        <Directory "/var/www/html/hoge">
                Options FollowSymLinks
                AllowOverride All
                Order allow,deny
                Allow from all
        </Directory>

        # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
        # error, crit, alert, emerg.
        # It is also possible to configure the loglevel for particular
        # modules, e.g.
        #LogLevel info ssl:warn

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

        # For most configuration files from conf-available/, which are
        # enabled or disabled at a global level, it is possible to
        # include a line for only one particular virtual host. For example the
        # following line enables the CGI configuration for this host only
        # after it has been globally disabled with "a2disconf".
        #Include conf-available/serve-cgi-bin.conf
</VirtualHost>

** 他のファイルを削除

# rm -rf eccube-2.1*
# rm -rf README.html.org
# rm -rf download.sh```

** 再起動

exit

停止 $ docker stop 8f594c423ecd 起動 $ docker start naughty_colden```