2021_12_09

Metasearch環境構築

HPからVisual Studio Communityをインストールする。

インストーラでは「Node.js 開発」ワークロードを指定。

Node.jsをインストールする。

https://git-scm.com/download/winからGitをダウンロード・インストール。(※Git Bashを使えるようにしておく)

metasearchは192.168.253.163上で実装する。

ここに簡易パスを通しておく。

C:\Users\Mizobata.ssh上に「config」というファイルを作成。メモ帳で開き、内容を

host main
  HostName 192.168.253.163
  User yoshitake
 

とする。すると、

ssh 192.168.253.163

とわざわざ打たなくても

ssh main

で入れるようになる。

Visual Studioにて、「リポジトリのクローン」。

「リポジトリの場所」にmain:/home/yoshitake/metasearch_repoを指定。

「パス」は「C:\Users\Mizobata\Source\Repos\適当な名前」を指定。

「Git」⇒「設定」⇒「Gitグローバル設定」。Githubアカウントでログインする。

「Git」⇒「プル」で最新のリポジトリを取得。

コードを編集。

「表示」⇒「Git変更」⇒「+(ステージング)」⇒何かメッセージを入力⇒「↑(プッシュ)」で編集情報をリポジトリに送信。

powershellやcommand promptを開く。

プルで更新を試みる(たいていエラーが出る)

ssh main
cd /home/yoshitake/metasearch/metasearch/gitpull

これがダメな場合、以下を行う。

git fetch origin master
git reset --hard origin/master

次の2つのスクリプトを更新する。

1 app.js

cat app.js

最後から5行目くらいのポート番号を変更する。(3000番:本番環境、3002番:テスト環境) ※いらないほうをコメントアウトする

app.set('port', process.env.PORT || 3002)
app.set('port', process.env.PORT || 3000)

2 metasearch_exec.sh

19行目~20行目で配信時に添付するURLを修正。19行目をコメントアウトし、20行目からコメントを外す。

/home/yoshitake/tool/singularity-3.5.2/bin/singularity run script/python3_env_mako_installed.sif python script/send_mail.py https://meta.fs.a.u-tokyo.ac.jp/metasearch/${hash}/ ${usr_email}
#/home/yoshitake/tool/singularity-3.5.2/bin/singularity run script/python3_env_mako_installed.sif python script/send_mail.py https://meta.fs.a.u-tokyo.ac.jp/metasearch_dev/${hash}/ ${usr_email}

npm install する

npm install

走っているプログラムのリストを取得し、停止・再スタートさせる。

forever list
  info:    Forever processes running
  data:        uid  command   script forever pid  id logfile                           
  uptime
  data:    [0] xYNe npm start        2291    2336    
  /home/yoshitake/.forever/xYNe.log 29:1:37:45.06999999983236
  
forever stop 2336

forever start --workingDir /home/yoshitake/metasearch/metasearch/ -c "npm start" ./

これでうまくいかなければ、リブートする。

reboot
  • 2021_12_09.1639118256.txt.gz
  • 最終更新: 2021/12/10 06:37
  • by 133.11.222.89