Welcome to your PTN Miner Dashboard. This is a React application that requires a URL to be added to a .env
file to
fetch data from your miner.
Follow these steps to install and run the application on your local machine.
- Your PTN Miner
- A package manager like npm, yarn, or pnpm,
Clone the repository to your local machine:
git clone https://github.com/taoshidev/miner-dashboard.git
Navigate into the project directory:
cd miner-dashboard
Install the necessary dependencies by running:
npm install
if you are using yarn:
yarn install
or if you are using pnpm:
pnpm install
If you are running your miner-dashboard on the same machine as your miner, continue to section 4 Configure Environment Variables below.
If you are running your miner-dashboard on a separate machine from your miner, you will need to add the address of the machine running the dashboard to the
allowed origins of the miner using the miner's --dashboard_origin
flag, and enable ssh tunneling from the machine running the miner-dashboard to the machine running the miner.
- Get the public IPv4 address of the machine running the miner-dashboard. ex:
1.1.1.1
- Restart the miner, adding
--dashboard_origin 1.1.1.1
- Note the miner URL on startup as shown in section 4. ex:
Uvicorn running on http://127.0.0.1:41511
- Open a SSH tunnel from the machine running the miner-dashboard
ssh -L [local_port]:localhost:[remote_port] [miner]@[address]
ex:
ssh -L 41511:localhost:41511 taoshi-miner@123.45.67.89
This maps port 41511 on your local machine running the miner-dashboard to port 41511 on the VM where the miner is running. You are now able to connect to the miner through the miner-dashboard.
Add your miner URL to the environment variables. You can find your miner URL in your miner logs. Note: if a port is occupied the miner will attempt to connect to the next available port, so confirm your port in the logs!
Copy the .env.example file to .env using the following command:
cp .env.example .env
Update the .env file
VITE_MINER_URL=your-miner-url-here
Replace your-miner-url-here with the actual URL of your miner's uvicorn server, e.g. http://127.0.0.1:41511
.
Note: If you opted to use a different local port than 41511
when opening a SSH tunnel above, be sure to use the local port you selected instead.
To start the development server, run:
npm run dev
if you are using yarn:
yarn dev
or if you are using pnpm:
pnpm dev
This will start the app on http://localhost:5173/ by default. Open your browser and navigate to this URL to view your miner dashboard.
To build a production ready Dashboard, run:
npm run build
if you are using yarn:
yarn build
or if you are using pnpm:
pnpm build