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.gitNavigate into the project directory:
cd miner-dashboardInstall the necessary dependencies by running:
npm installif you are using yarn:
yarn installor if you are using pnpm:
pnpm installIf 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.89This 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 .envUpdate the .env file
VITE_MINER_URL=your-miner-url-hereReplace 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 devif you are using yarn:
yarn devor if you are using pnpm:
pnpm devThis 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 buildif you are using yarn:
yarn buildor if you are using pnpm:
pnpm build