Nginxでmrubyのめも

install

nginxにngx_mrubyをインストールする - Qiita

ngx_mrubyをnginx-buildのビルドに組み込む - Qiita

ubuntu 16.04でbuild

  • apt install make git gcc software-properties-common libperl-dev libpcre3-dev bison libssl-dev rake -y
  • todo

その他

ansible-galaxyめも

いっつも忘れるので

  • foo-roleってディレクトリつくって、そこにansible-glaxy initする
    • cd foo-role
    • export ROLE_PATH=$(echo $(pwd) |awk 'BEGIN {FS="/";OFS="/"} {$NF="";print $0}');ansible-galaxy init foo-role e -f -p "$ROLE_PATH"
  • requirements.ymlに記述されているroleを手元のroleディレクトリに取ってきてinstall
    • ansible-galaxy install -f -r requirements.yml --roles-path=./roles

AWS CLIとYAMLでEC2インスタンスをつくるメモ

foo.yaml

AWSTemplateFormatVersion: "2010-09-09"
Description: "Foo Server Template"

Parameters:
  UserDefinedHostName:
    Type: String

Resources:
  MyEC2Instance: #An inline comment
    Type: "AWS::EC2::Instance"
    Properties:
      ImageId: "ami-8422ebe2" # Ubuntu xenial hvm:ebs-ssd
      InstanceType: t2.micro
      BlockDeviceMappings:
        - DeviceName: /dev/sdm
          Ebs:
            VolumeType: gp2
            Iops: 200
            DeleteOnTermination: True
            VolumeSize: 8
      SubnetId: "subnet-xxx"
      KeyName: "xxx"
      SecurityGroupIds:
        - "sg-xxx"
        - "sg-xxx"
      Tags:
        - Key: "Name"
          Value: !Ref UserDefinedHostName
      UserData: !Base64 |
      #!/bin/bash
      apt update
      apt install ansible -y

AWS CLI

aws cloudformation create-stack --stack-name foo-server --template-body file://foo.yml --parameters ParameterKey="UserDefinedHostName",ParameterValue="foo-server"

unicorn.logをlogrotate.dでローテするメモ

基本的にはUSR1シグナルを送れば良い

sample

/var/log/foo/bar/unicorn.log {
  daily #毎日
  missingok # ログファイルがなくても処理をつづける
  rotate 7 #世代
  dateext #ファイルを日付形式に
  compress #圧縮する
  delaycompress #圧縮は次のローテまで遅らせる

  lastaction
    pid=/foo/bar/unicorn.pid
    test -s $pid && kill -USR1 "$(cat $pid)"
  endscript
}

参考