Markdown Formatting in Readme

This commit is contained in:
Marco van Dijk 2022-03-06 14:33:08 +01:00 committed by GitHub
parent 0896ce9845
commit 157c6677ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,3 +1,4 @@
# What # What
This project shows a live feed of events happening on the Livepeer BondingManager smart contract. This way it is able to track: This project shows a live feed of events happening on the Livepeer BondingManager smart contract. This way it is able to track:
- (De)activations of Orchestrators on the Livepeer network - (De)activations of Orchestrators on the Livepeer network
@ -34,48 +35,53 @@ Orchestrators can be inspected by clicking on their address, showing all of thei
## Frontend ## Frontend
The frontend can be used on it's own as a basis for hosting your own Orchestrator website The frontend can be used on it's own as a basis for hosting your own Orchestrator website
By default the website will forward all API requests to http://localhost:42609
### Running Standalone
By default the website will forward all API requests to `http://localhost:42609`
Meaning, it will look for the backend at the same place where the website is running! Meaning, it will look for the backend at the same place where the website is running!
If you want to run this frontend without running your own backend, you have to configure it to always pull it's data from the existing API at https://nframe.nl/ If you want to run this frontend without running your own backend, you have to configure it to always pull it's data from the existing API at `https://nframe.nl/`
Modify package.json to do this Modify `package.json` to do this
- Edit the line containing "proxy": "http://localhost:42609" and replace "http://localhost:42609" with "http://localhost:42609" - Edit the line containing `"proxy": "http://localhost:42609"` and replace `"http://localhost:42609"` with `"https://nframe.nl/"`
## Dependencies ## Dependencies
nginx, certbot, certbot-nginx, npm nginx, certbot, certbot-nginx, npm
### HTTPS using nginx ### HTTPS using nginx
- replace /etc/nginx/nginx.conf with supplied one, certbot will upgrade it to HTTPS replace `/etc/nginx/nginx.conf` with supplied one, certbot will upgrade it to HTTPS
- systemctl enable --now nginx.service - `systemctl enable --now nginx.service`
- certbot --nginx - `certbot --nginx`
## Initial Config ## Initial Config
Download copy of repository and change directory to it Download copy of repository and change directory to it
- git clone https://github.com/stronk-dev/LivepeerEvents.git /var/www - `git clone https://github.com/stronk-dev/LivepeerEvents.git /var/www`
- cd /var/www - `cd /var/www`
Download all external dependencies we are using
- npm install
Edit default Orchestrator Address Download all external dependencies we are using
- `npm install`
### Edit default Orchestrator Address
If you are not running your own backend, by default the backend will return my Orchestrator If you are not running your own backend, by default the backend will return my Orchestrator
In order to show your own Orchestrator on the Grafana page, you need to edit src/util/livepeer.js In order to show your own Orchestrator on the Grafana page, you need to edit src/util/livepeer.js
Edit the line containing: Edit the line containing:
export const getCurrentOrchestratorInfo = () => (
export const getCurrentOrchestratorInfo = () => (
fetch("api/livepeer/getOrchestrator", { fetch("api/livepeer/getOrchestrator", {
method: "GET", method: "GET",
headers: { headers: {
"Content-Type": "application/json" "Content-Type": "application/json"
} }
}) })
); );
And change this to (replace with your own address): And change this to (replace with your own address):
export const getCurrentOrchestratorInfo = () => (
export const getCurrentOrchestratorInfo = () => (
fetch("api/livepeer/getOrchestrator/0x847791cbf03be716a7fe9dc8c9affe17bd49ae5e", { fetch("api/livepeer/getOrchestrator/0x847791cbf03be716a7fe9dc8c9affe17bd49ae5e", {
method: "GET", method: "GET",
headers: { headers: {
"Content-Type": "application/json" "Content-Type": "application/json"
} }
}) })
); );
All Grafana panels point towards where I am hosting my own Grafana dashboard. You need to edit this to pull the panels from your own Grafana instance All Grafana panels point towards where I am hosting my own Grafana dashboard. You need to edit this to pull the panels from your own Grafana instance
For each panel you want to replace: For each panel you want to replace:
@ -84,19 +90,21 @@ For each panel you want to replace:
- Open the Embed tab - Open the Embed tab
- Copy the entire Embed HTML bit - Copy the entire Embed HTML bit
- Edit src/grafana.js: - Edit src/grafana.js:
- Replace any <iframe/> block with the one you copied and edit the height to your liking. The width parameter can be left out so that they scale to the width of the parent element - Replace any `iframe` block with the one you copied and edit the height to your liking. The width parameter can be left out so that they scale to the width of the parent element
Note that you can specify the timerange and update frequency in the URL by using URL parameters, like Note that you can specify the timerange and update frequency in the URL by using URL parameters, like
- from=now-2d&to=now&refresh=5s - `from=now-2d&to=now&refresh=5s`
## Developing ## Developing
Open the directory of your frontend and run Open the directory of your frontend and run
- npm start - `npm start`
Your local environtment is available at http://localhost:3000/
Your local environtment is available at `http://localhost:3000/`
## Running or updating in Production ## Running or updating in Production
- cd /var/www - `cd /var/www`
- npm run build - `npm run build`
@ -109,41 +117,46 @@ nodejs, npm, pm2
## Initial Config ## Initial Config
Download copy of repository and change directory to it Download copy of repository and change directory to it
- git clone https://github.com/stronk-dev/LivepeerEvents.git /var/www - `git clone https://github.com/stronk-dev/LivepeerEvents.git /var/www`
- cd /var/www/backend - `cd /var/www/backend`
Download all external dependencies we are using Download all external dependencies we are using
- npm install - `npm install`
-
Set configuration variables Set configuration variables
- nano /var/www/backend/src/config.js - `nano /var/www/backend/src/config.js`
- PORT can be left as is, defines at what port the backend will accept API requests - `PORT` can be left as is, defines at what port the backend will accept API requests
- NODE_ENV can be left as is, defines the default way to connect to the database - `NODE_ENV` can be left as is, defines the default way to connect to the database
- MONGO_URI should be edited to the URL of your MongoDB instance. This is where the backend stores it's data when it is running in production mode - `MONGO_URI` should be edited to the URL of your MongoDB instance. This is where the backend stores it's data when it is running in production mode
- MONGO_URI_DEV should be edited to the URL of your MongoDB instance. This is where the backend stores it's data when it is running in development mode - `MONGO_URI_DEV` should be edited to the URL of your MongoDB instance. This is where the backend stores it's data when it is running in development mode
- MONGO_URI_LOCAL can be left as is, this is where the backend stores it's data when it is running in local mode - `MONGO_URI_LOCAL` can be left as is, this is where the backend stores it's data when it is running in local mode
- API_CMC should be edited to contain your own coinmarketcap api key - `API_CMC` should be edited to contain your own coinmarketcap api key
- API_L1_HTTP should be edited to the HTTP url of a L1 ethereum node - `API_L1_HTTP` should be edited to the HTTP url of a L1 ethereum node
- API_L2_HTTP should be edited to the HTTP url of a L2 ethereum node - `API_L2_HTTP` should be edited to the HTTP url of a L2 ethereum node
- API_L2_WS should be edited to the WS url of an Arbitrum mainnet Alchemy node - `API_L2_WS` should be edited to the WS url of an Arbitrum mainnet Alchemy node
- CONF_DEFAULT_ORCH should be edited to the public address of your own Orchestrator. This is the default Orchestrator the backend will return - `CONF_DEFAULT_ORCH` should be edited to the public address of your own Orchestrator. This is the default Orchestrator the backend will return
## Developing ## Developing
Open the directory of your backend and run Open the directory of your backend and run
- npm run dev - `npm run dev`
## Running in Production ## Running in Production
Open the directory of your backend and run the backend using pm2 Open the directory of your backend and run the backend using `pm2`
- cd /var/www/backend - `cd /var/www/backend`
- pm2 start ecosystem.config.js --env production - `pm2 start ecosystem.config.js --env production`
Save the current pm2 process list configuration Save the current pm2 process list configuration
- pm2 save - `pm2 save`
Automatically start the backend when the server reboots Automatically start the backend when the server reboots
- pm2 startup - `pm2 startup`
## Updating in Production ## Updating in Production
- pm2 restart backend - `pm2 restart backend`
## Other commands ## Other commands
View logs View logs
- pm2 log backend - `pm2 log backend`
Stop the entire thing Stop the entire thing
- pm2 stop backend - `pm2 stop backend`