Skip to content

Instantly share code, notes, and snippets.

class CreateTerms < ActiveGroonga::Migration
def up
create_table(:terms, :type => :patricia_trie, :key_type => "ShortText", :key_normalize => true, :default_tokenizer => "TokenMecab") do |table|
table.index("articles.body", :with_section => true, :with_weight => true, :with_position => true)
table.timestamps
end
end
def down
remove_table(:terms)
# coding: utf-8
require 'pp'
require 'pathname'
require 'open-uri'
require 'nokogiri'
require 'active_groonga'
require 'baby_erubis'
current_dir = Pathname(__dir__).expand_path
ORIGIN_URI = URI('http://sinap.jp')
# coding: utf-8
require 'pp'
require 'logger'
require 'pathname'
require 'open-uri'
require 'nokogiri'
require 'groonga'
current_dir = Pathname(__dir__).expand_path
ORIGIN_URI = URI('http://ji-sedai.jp')
@KitaitiMakoto
KitaitiMakoto / droonga-engine
Last active September 17, 2015 15:47
Droonga SysVinit scripts
#! /bin/sh
### BEGIN INIT INFO
# Provides: droonga-engine
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Droonga engine is a core component in Droonga system
### END INIT INFO
<!doctype html>
<style>
.keyword {
font-weight: bold;
color: red;
}
</style>
<h1></h1>
<div></div>
<script>
[Unit]
Description=Droonga HTTP Server
Wants=droonga-engine.service
[Service]
User=droonga-http-server
ExecStart=/usr/bin/droonga-http-server --cache-size=-1
ExecStop=/bin/kill -TERM $MAINPID
Restart=on-failure
WorkingDirectory=/home/droonga-http-server/droonga
# DigitalOcean CentOS 7
DROONGA_GID = 1000
execute "curl https://raw.githubusercontent.com/droonga/droonga-engine/master/install.sh | bash" do
not_if "type droonga-engine"
end
execute "curl https://raw.githubusercontent.com/droonga/droonga-http-server/master/install.sh | bash" do
not_if "type droonga-http-server"
end
vagrant@epub-searcher-demo:~$ sudo -udroonga-http-server bash -c 'cd /home/droonga-http-server/droonga && droonga-http-server --daemon --pid-file=/var/run/droonga-http-server/droonga-http-server.pid --system-log-level=trace --droonga-engine-port=10031'
@KitaitiMakoto
KitaitiMakoto / mt-for-aws-log-permission.txt
Last active September 3, 2015 15:24
MT for AWS Nginx HVMのログディレクトリーのパーミッション
作成したばかりのインスタンスにて。
Nginx worker(nobody)から再オープンできないように見える。
と言うか実際、sudo service nginx reopen_logsやったら(/etc/logrotate.d/nginxがやってる)、
access.logが空になった後ログが書き込まれない。
/data/conf/nginx.confではuser nobody;となっているけど、Amazon LinuxのリポジトリーかられたばかりのNginxバッケージではこの行はコメントアウトされている。
コメントインしたけどログディレクトリーやファイルのパーミッション調整がされていなかったということなのだろうか。
$ ll /var/log/
合計 196
package main
import (
"os"
"net/url"
"net/http"
"io/ioutil"
"encoding/json"
"fmt"
)