LoginSignup
19
16

More than 5 years have passed since last update.

Elastic Beanstalkの.ebextensions集

Last updated at Posted at 2018-01-11

timezoneをJapanにする

timezone.config
commands:
    timezone:
        command: cp -p /usr/share/zoneinfo/Japan /etc/localtime
files:
    "/etc/sysconfig/clock":
        mode: "000644"
        owner: root
        group: root
        content: |
            ZONE="Japan"
            UTC=true

swapを有効にする

swapのサイズは、ddの引数を適宜変更してください。以下の例だと、4GBになります。
(Linuxディストリビューションによっては、/var/run がRAMディスク等の大きいファイルが作れないファイルシステムに割り当てられているので、その場合は /var/swap 等、ディレクトリを変更するようにしてください)

swapon.config
commands:
  create_swap:
    test: test ! -f /var/run/swap/0
    command: test ! -f /var/run/swap/0 && mkdir -p /var/run/swap && dd if=/dev/zero of=/var/run/swap/0 bs=1M count=4096 && chmod 600 /var/run/swap/0 && /sbin/mkswap /var/run/swap/0 && /sbin/swapon /var/run/swap/0

sysctlでチューニングする

内容は各自秘伝のタレを入れてください。

sysctl.config
files:
    "/etc/sysctl.d/90-beanstalk.conf":
        mode: "000644"
        owner: root
        group: root
        content: |
            vm.swappiness = 40
            net.core.somaxconn = 2048
            net.ipv4.tcp_fin_timeout = 15
            net.ipv4.tcp_slow_start_after_idle = 0
            net.ipv4.ip_local_port_range = 2048 65535
            net.core.rmem_max = 16777216
            net.core.wmem_max = 16777216
            net.ipv4.tcp_rmem = 4096 1048576 16777216
            net.ipv4.tcp_wmem = 4096 1048576 16777216

commands:
    sysctl:
        command: sysctl -p /etc/sysctl.d/90-beanstalk.conf

mecabを入れる

全文検索エンジンGroongaプロジェクトの配布されているyumリポジトリを利用します。(感謝!)

01-groonga.config
packages:
    rpm:
        groonga: https://packages.groonga.org/centos/groonga-release-1.3.0-1.noarch.rpm

commands:
    groonga:
        command: perl -pi -e "s;/centos/.releasever/;/centos/7Server/;g" /etc/yum.repos.d/groonga.repo
02-mecab.config
packages:
    yum:
        mecab: []
        mecab-ipadic: []
        mecab-devel: []
        gcc-c++: []

prestissimoを入れてcomposerを高速化する

PHPでcomposerを使ってパッケージを入れる前に、prestissimoを入れておいてデプロイを高速化します。

install-prestissimo.config
commands:
    install:
        env:
            COMPOSER_HOME: /root
        command: composer.phar --no-ansi --no-interaction global require hirak/prestissimo

その他参考

19
16
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
19
16