Closed gibbs-shih closed 2 months ago
This guide will walk you through the steps to set up the BAIFA web crawler on a remote server.
Here are the main steps to set up the compilation environment and run the crawler:
Set up the environment
Clone the repository and configure files
Install dependencies and set up the database
Run the crawler using PM2
ssh [user_name]@[IP_address]
/workspace
directory:
sudo mkdir /workspace
/workspace
to ${user}/workspace
to the current user:
sudo chown -R ${user} /workspace
/workspace
directory:
cd /workspace
git clone https://github.com/CAFECA-IO/BAIFA-web-crawling.git
BAIFA-web-crawling
directory:
cd BAIFA-web-crawling
ls -al
.env.sample
file to .env
:
cp .env.sample .env
.env
file:
vi .env
i
to enter edit mode
DATABASE_URL="postgresql://[name]:[password]@[host]:5432/[database_name]"
Esc
to exit edit mode:wq
and press Enter
to save and exitsrc/constants
directory:
cd src/constants
chain_info.ts
file:
vi chain_info.ts
i
to enter the edit mode
export const CHAIN_INFO = {
chain_id: number,
chain_name: string,
symbol: string,
decimals: number,
rpc: string url,
};
Esc
to exit the edit mode:wq
and press Enter
to save the changes and exit the filenpm install
npx prisma db push --schema=./prisma/schema.prisma
npm install pm2 -g
pm2 start npm --name BAIFA-CRAWLER -- start
pm2 ls
pm2 kill
pm2 log 0
Ctrl + C
to exit log observationtake 1 hr
修改 readme 架構