20220427_github_setting

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

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:3005

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

Test enviroment

port 3003

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 
pwdx [pid]
forever stop [order or pid]
lsof -i:3003
kill [pid]

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 killed 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

Update the database file on github

git add .
git commit -m "Database files updates"
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 
pwdx [pid]
forever stop [order or pid]
lsof -i:3004
kill [pid]

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:3004, and after killed it, forever start can go smoothly.



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. これでデプロイ完了。

  • 20220427_github_setting.1652248641.txt.gz
  • 最終更新: 2022/05/11 05:57
  • by 133.11.144.12