LoginSignup
2
0

More than 5 years have passed since last update.

NICT EXISTをUbuntuで動かす&アップデートする

Posted at

summary

基本的に、内部利用で適当にまずは作ってみたときのメモ。

  • NICTが公開した EXIST を、Ubuntu18.04LTSに入れる際に注意すべき点の記載
  • 面倒だから、systemdで使えるようにした
    • systemctl start exist
  • EXISTが更新された際に、追従する方法

インストール

@bule_or_red氏の記事 を参照

Ubuntuで入れる際には以下の差分を検討

  • Celeryの環境変数は、/etc/sysconfig/celery ではなく /etc/celery/celery 辺りで良さそう。
    • /etc/sysconfig/ が無いからね。
  • バイナリは /bin/celery ではなく、/usr/local/bin/celery に有る
    • CELERY_BIN="/usr/local/bin/celery"

注意点

再起動すると、/var/run/celery/ は消えている。その為、systemctl start celery.service が失敗して動かなくなる

  • 対策として、毎回ディレクトリ掘るか、後述のバッチファイルに組み込むか、別の場所(/tmpでも良いんでは?)にする。

起動スクリプト

二段階の作業が必要

  • 起動用のスクリプトを用意する
  • systemdの設定を書く

起動スクリプトを、適当に用意する。/opt/exist/ に入れているのであれば、/opt/exist/start-exist.sh とかでいい

#!/bin/sh
# mkdir /var/run/celery; chown root:root /var/run/celery ; <-- /tmpとかにしない場合は。
python3 /opt/exist/manage.py runserver 0.0.0.0:8000

以下を、/etc/systemd/system/exist.service として配置

[Unit]
Description=NICT EXIST daemon
Documentation=https://github.com/nict-csl/exist

[Service]
ExecStart = /opt/exist/start-exist.sh
ExecRestart = /bin/kill -WINCH ${MAINPID} ; /opt/exist/start-exiest.sh
ExecStop = /bin/kill -WINCH ${MAINPID}
Restart = no
Type = simple
User = root
Group = root

[Install]
WantedBy = multi-user.target

これでsystemdでコントロールできるはず。

  • systemctl [start|stop] exist

EXISTアップデート

各種ソースからの情報取得

/opt/exist に入れている場合は以下の調整が必要。

  • /opt/exist/scripts/insert2db/conf/insert2db.confの用意
  • アップデートの実行
    • scripts/insert2db/[exploit|reputation|threat|twitter]/insert2db.py
    • APIキー等を全く用意していない場合は、reputationとexploitだけは未設定で使える。

insert2db.confは以下だけでも行ける

[exist]
syspath = /opt/exist

アップデート

EXIST自体のアップデートを適用する。

  • /etc/exist/ で git clone する
  • python3 manage.py migrate しないとダメそう

git clone だけだと、WEB画面は出るが検索はできない(検索の応答がない)状態になる。

以上、メモでした。

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