**文書の過去の版を表示しています。**
Windows PC Local Environment Configuration from Github repository
download git and node.js
Unzip The private key file and put it into C:\Users\your user name\ .ssh
Generating a new SSH key
ssh-keygen -t ed25519 -C "suikoucalender@gmail.com"
Adding the SSH public key to the ssh-agent on GitHub suikou account setting page
For the first time setting, clone the repository from github to your PC
git clone git@github.com:suikoucalender/mitosearch.git
check if the website work functionally
npm install
npm install ejs
npm install i18n
npm install –save express-session
npm start localhost:3004
After changes occur, push
git add . git commit -m "your message" (when you do this step, it may ask "please tell me who you are", use this↓ first) git config --global user.email "suikoucalender@gmail.com" git config --global user.name "suikoucalender" git push origin main
Get the latest version remotely and merge to local
git pull</del>
Test enviroment
port 3003
Get the latest version remotely
git pull
start program Record the running logs, and monitor all file changes in the folder
forever start -l forever.log -a -o out.log -e err.log --workingDir /home/yoshitake/mitosearch_dev/Mitosearch -c "npm start" --watchDirectory ./ ./
Stop program
forever list # check the running forever program # pwdx [pid] # check the program's name # forever stop[order or pid] #stop the program # lsof -i:3003 # Detect port-occupying processes # kill [pid] # kill port-occupying processes #
After running forever stop
, the reason why forever start
does not run functionally is that even if the forever project is stopped, the port is still occupied, you can see the pid of the occupied project by using lsof -i:3003
, and after kill
ed it, forever start
can go smoothly.
Production enviroment
I move the old production environment to mitosearch.old(on m50v251n3.s)
Then cloned the repository from GitHub
To update the database files on github
git add . git commit -m "Database files update" git push origin main
To update the production environment
git pull
port 3004
start program Record the running logs, and monitor all file changes in the folder
forever start -l forever.log -a -o out.log -e err.log --workingDir /home/yoshitake/mitosearch_dev/mitosearch/Mitosearch -c "npm start" --watchDirectory ./ ./
Stop program
forever list # check the running forever program # pwdx [pid] # check the program's name # forever stop[order or pid] #stop the program # lsof -i:3004 # Detect port-occupying processes # kill [pid] # kill port-occupying processes #
2. また、既に実行されているMitoSearchDBを停止させておく。
forever list
で出てくるのはMetaSearchDBやMitoSearchがあるので、どれがMitoSearchDBかを調べるため、pidの数字に対してpwdx <pid>
とpwdxを使って実行ディレクトリを調べて、/home/yoshitake/mitosearch/mitosearch
で実行されているプロセスのuid前の数字(0,1,2,…程度の値)を割り出す。それからforever stop <uid前の数字>
で停止できる。停止まで数分程度かかる様子。
1. 本番環境に移動する。cd /home/yoshitake/mitosearch/
2. リモートリポジトリ(/home/yoshitake/mitosearch_repo)から、最新版をPull。git pull
(初回構築時はgit pull origin master
の必要あり)
2. もし新規に構築した場合、configファイル /home/yoshitake/mitosearch/Mitosearch/config/config.json
とinputFileのシンボリックリンクの配置をln -s ~/mitosearchdb/dbfish/ ~/mitosearch/Mitosearch/db_fish
で行う。
3. git pull
が上手くできない場合(基本的にデプロイ後スクリプトの修正が入るとpullできない)、git fetch origin master
でリモートの最新の状態を取り込んだ後、git reset --hard origin/master
でリセットをおこなう。
※前回デプロイ時、Mitosearch/data/fish/lat-long-date.txtがローカル環境・本番環境両方から消失した。次回git pull時にはバックアップを取っておくよう注意!!!
4. アプリケーションのあるディレクトリに移動。cd /home/yoshitake/mitosearch/mitosearch
その後、依存関係を解消する。npm install
npm install i18n
npm install –save express-session
5. forever start --workingDir /home/yoshitake/mitosearch/mitosearch -c "npm start" ./
で再起動。
※startが上手くいかない時は取り敢えずPCをrebootした方が楽sudo reboot。foreverを再起動してもすぐ停止してしまうことがある(forever stopしてもポートが占有されている?)
6. これでデプロイ完了。