Skip to content

Commit

Permalink
Merge branch 'main' into am-follow-artists-page
Browse files Browse the repository at this point in the history
  • Loading branch information
amendelsohn committed Nov 14, 2023
2 parents 407e3a3 + a5c1cf8 commit 820d60f
Show file tree
Hide file tree
Showing 81 changed files with 15,860 additions and 3,041 deletions.
2 changes: 1 addition & 1 deletion mediorum/.version.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"version": "0.5.15",
"version": "0.5.16",
"service": "content-node"
}
6 changes: 4 additions & 2 deletions mediorum/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -370,8 +370,10 @@ func New(config MediorumConfig) (*MediorumServer, error) {
}

func setResponseACAOHeaderFromRequest(req http.Request, resp echo.Response) {
resp.Header().Set(echo.HeaderAccessControlAllowOrigin,
req.Header.Get(echo.HeaderOrigin))
resp.Header().Set(
echo.HeaderAccessControlAllowOrigin,
req.Header.Get(echo.HeaderOrigin),
)
}

func ACAOHeaderOverwriteMiddleware(next echo.HandlerFunc) echo.HandlerFunc {
Expand Down
3 changes: 3 additions & 0 deletions monitoring/uptime/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Stage 1: Build the React app
FROM node:18-alpine as react-builder

# The bufferutil package needs python
RUN apk add --no-cache python3 make g++

ENV UPTIME_BASE_URL="/up/"
WORKDIR /app
COPY node-ui/package.json node-ui/package-lock.json ./node-ui/
Expand Down
154 changes: 149 additions & 5 deletions monitoring/uptime/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,41 @@ import (
)

type Config struct {
NodeType string
Env string
Self registrar.Peer
Peers []registrar.Peer
ListenPort string
Dir string

Env string
NodeType string
AudiusUrl string

EthNetworkId string
EthTokenAddress string
EthRegistryAddress string
EthProviderUrl string
EthOwnerWallet string

QueryProposalStartBlock string
GqlUri string
GqlBackupUri string

EntityManagerAddress string

IdentityServiceEndpoint string

WormholeContractAddress string
ClaimDistributionContractAddress string
SolanaClusterEndpoint string
WAudioMintAddress string
UsdcMintAddress string
SolanaTokenProgramAddress string
ClaimableTokenPda string
SolanaFeePayerAddress string
ClaimableTokenProgramAddress string
RewardsManagerProgramId string
RewardsManagerProgramPda string
RewardsManagerTokenPda string
}

func main() {
Expand Down Expand Up @@ -62,13 +91,99 @@ func main() {
}

func startStagingOrProd(isProd bool, nodeType, env string) {
// must have either a CN or DN endpoint configured
// must have either a CN or DN endpoint configured, along with other env vars
myEndpoint := ""
audiusUrl := ""

ethNetworkId := ""
ethTokenAddress := ""
ethRegistryAddress := ""
ethProviderUrl := ""
ethOwnerWallet := ""

queryProposalStartBlock := ""
gqlUri := ""
gqlBackupUri := ""

entityManagerAddress := ""

identityService := ""

wormholeContractAddress := ""
claimDistributionContractAddress := ""
solanaClusterEndpoint := ""
wAudioMintAddress := ""
usdcMintAddress := ""
solanaTokenProgramAddress := ""
claimableTokenPda := ""
solanaFeePayerAddress := ""
claimableTokenProgramAddress := ""
rewardsManagerProgramId := ""
rewardsManagerProgramPda := ""
rewardsManagerTokenPda := ""

if nodeType == "content" {
myEndpoint = mustGetenv("creatorNodeEndpoint")
audiusUrl = mustGetenv("audiusUrl")

ethNetworkId = mustGetenv("ethNetworkId")
ethTokenAddress = mustGetenv("ethTokenAddress")
ethRegistryAddress = mustGetenv("ethRegistryAddress")
ethProviderUrl = mustGetenv("ethProviderUrl")
ethOwnerWallet = os.Getenv("ethOwnerWallet")

queryProposalStartBlock = mustGetenv("queryProposalStartBlock")
gqlUri = mustGetenv("gqlUri")
gqlBackupUri = os.Getenv("gqlBackupUri")

entityManagerAddress = mustGetenv("entityManagerAddress")

identityService = mustGetenv("identityService")

wormholeContractAddress = mustGetenv("wormholeContractAddress")
claimDistributionContractAddress = mustGetenv("claimDistributionContractAddress")
solanaClusterEndpoint = mustGetenv("solanaClusterEndpoint")
wAudioMintAddress = mustGetenv("wAudioMintAddress")
usdcMintAddress = mustGetenv("usdcMintAddress")
solanaTokenProgramAddress = mustGetenv("solanaTokenProgramAddress")
claimableTokenPda = mustGetenv("claimableTokenPda")
solanaFeePayerAddress = mustGetenv("solanaFeePayerAddress")
claimableTokenProgramAddress = mustGetenv("claimableTokenProgramAddress")
rewardsManagerProgramId = mustGetenv("rewardsManagerProgramId")
rewardsManagerProgramPda = mustGetenv("rewardsManagerProgramPda")
rewardsManagerTokenPda = mustGetenv("rewardsManagerTokenPda")
} else if nodeType == "discovery" {
myEndpoint = mustGetenv("audius_discprov_url")
audiusUrl = mustGetenv("audius_url")

ethNetworkId = mustGetenv("audius_eth_network_id")
ethTokenAddress = mustGetenv("audius_eth_token_address")
ethRegistryAddress = mustGetenv("audius_eth_contracts_registry")
ethProviderUrl = mustGetenv("audius_web3_eth_provider_url")
ethOwnerWallet = os.Getenv("audius_eth_owner_wallet")

queryProposalStartBlock = mustGetenv("audius_query_proposal_start_block")
gqlUri = mustGetenv("audius_gql_uri")
gqlBackupUri = os.Getenv("audius_gql_backup_uri")

entityManagerAddress = mustGetenv("audius_contracts_entity_manager_address")

identityService = mustGetenv("audius_discprov_identity_service_url")

wormholeContractAddress = mustGetenv("audius_wormhole_contract_address")
claimDistributionContractAddress = mustGetenv("audius_solana_claim_distribution_contract_address")
solanaClusterEndpoint = mustGetenv("audius_solana_cluster_endpoint")
wAudioMintAddress = mustGetenv("audius_solana_waudio_mint")
usdcMintAddress = mustGetenv("audius_solana_usdc_mint")
solanaTokenProgramAddress = mustGetenv("audius_solana_token_program_address")
claimableTokenPda = mustGetenv("audius_solana_claimable_token_pda")
solanaFeePayerAddress = mustGetenv("audius_solana_fee_payer_address")
claimableTokenProgramAddress = mustGetenv("audius_solana_user_bank_program_address")
rewardsManagerProgramId = mustGetenv("audius_solana_rewards_manager_program_address")
rewardsManagerProgramPda = mustGetenv("audius_solana_rewards_manager_account")
rewardsManagerTokenPda = mustGetenv("audius_solana_rewards_manager_token_pda")
}

logger := slog.With("endpoint", myEndpoint)

// fetch peers
Expand All @@ -94,11 +209,40 @@ func startStagingOrProd(isProd bool, nodeType, env string) {
Self: registrar.Peer{
Host: httputil.RemoveTrailingSlash(strings.ToLower(myEndpoint)),
},
NodeType: nodeType,
Env: env,
Peers: peers,
ListenPort: "1996",
Dir: "/bolt",

Env: env,
NodeType: nodeType,
AudiusUrl: audiusUrl,

EthNetworkId: ethNetworkId,
EthTokenAddress: ethTokenAddress,
EthRegistryAddress: ethRegistryAddress,
EthProviderUrl: ethProviderUrl,
EthOwnerWallet: ethOwnerWallet,

QueryProposalStartBlock: queryProposalStartBlock,
GqlUri: gqlUri,
GqlBackupUri: gqlBackupUri,

EntityManagerAddress: entityManagerAddress,

IdentityServiceEndpoint: identityService,

WormholeContractAddress: wormholeContractAddress,
ClaimDistributionContractAddress: claimDistributionContractAddress,
SolanaClusterEndpoint: solanaClusterEndpoint,
WAudioMintAddress: wAudioMintAddress,
UsdcMintAddress: usdcMintAddress,
SolanaTokenProgramAddress: solanaTokenProgramAddress,
ClaimableTokenPda: claimableTokenPda,
SolanaFeePayerAddress: solanaFeePayerAddress,
ClaimableTokenProgramAddress: claimableTokenProgramAddress,
RewardsManagerProgramId: rewardsManagerProgramId,
RewardsManagerProgramPda: rewardsManagerProgramPda,
RewardsManagerTokenPda: rewardsManagerTokenPda,
}

ph, err := New(config)
Expand Down
28 changes: 28 additions & 0 deletions monitoring/uptime/node-ui/.env.stage.local
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,31 @@
VITE_ENV_OVERRIDE=stage
VITE_NODE_TYPE_OVERRIDE=discovery
VITE_NODE_URL_OVERRIDE=https://discoveryprovider3.staging.audius.co
VITE_AUDIUS_URL_OVERRIDE=https://staging.audius.co

VITE_ETH_NETWORK_ID_OVERRIDE=5
VITE_ETH_TOKEN_ADDRESS_OVERRIDE=0x5375BE4c52fA29b26077B0F15ee5254D779676A6
VITE_ETH_REGISTRY_ADDRESS_OVERRIDE=0xF27A9c44d7d5DDdA29bC1eeaD94718EeAC1775e3
VITE_ETH_PROVIDER_URL_OVERRIDE=https://eth-goerli.g.alchemy.com/v2/OeXKHus0Nn5z_O7VZjzbprNtKjrYCdUX
VITE_ETH_OWNER_WALLET_OVERRIDE= # 0x5375BE4c52fA29b26077B0F15ee5254D779676A6 # it's blank in other stage configs

VITE_QUERY_PROPOSAL_START_BLOCK_OVERRIDE=1
VITE_GQL_URI_OVERRIDE=https://api.thegraph.com/subgraphs/name/audius-infra/audius-network-goerli
VITE_GQL_BACKUP_URI_OVERRIDE= # it's staging so having a backup isn't as important

VITE_ENTITY_MANAGER_ADDRESS_OVERRIDE=0x1Cd8a543596D499B9b6E7a6eC15ECd2B7857Fd64

VITE_IDENTITY_SERVICE_ENDPOINT_OVERRIDE=https://identityservice.staging.audius.co

VITE_WORMHOLE_CONTRACT_ADDRESS_OVERRIDE=0xf6f45e4d836da1d4ecd43bb1074620bfb0b7e0d7
VITE_CLAIM_DISTRIBUTION_CONTRACT_ADDRESS_OVERRIDE=0x74b89B916c97d50557E8F944F32662fE52Ce378d
VITE_SOLANA_CLUSTER_ENDPOINT_OVERRIDE=https://solana-mainnet.g.alchemy.com/v2/N_o4w4Lgk2afO8uho9uuZu0LNi6gldVz
VITE_WAUDIO_MINT_ADDRESS_OVERRIDE=BELGiMZQ34SDE6x2FUaML2UHDAgBLS64xvhXjX5tBBZo
VITE_USDC_MINT_ADDRESS_OVERRIDE=EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
VITE_SOLANA_TOKEN_PROGRAM_ADDRESS_OVERRIDE=TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA
VITE_CLAIMABLE_TOKEN_PDA_OVERRIDE=Aw5AjygeMf9Nvg61BXvFSAzkqxcLqL8koepb14kvfc3W
VITE_SOLANA_FEE_PAYER_ADDRESS_OVERRIDE=E3CfijtAJwBSHfwFEViAUd3xp7c8TBxwC1eXn1Fgxp8h
VITE_CLAIMABLE_TOKEN_PROGRAM_ADDRESS_OVERRIDE=2sjQNmUfkV6yKKi4dPR8gWRgtyma5aiymE3aXL2RAZww
VITE_REWARDS_MANAGER_PROGRAM_ID_OVERRIDE=CDpzvz7DfgbF95jSSCHLX3ERkugyfgn9Fw8ypNZ1hfXp
VITE_REWARDS_MANAGER_PROGRAM_PDA_OVERRIDE=GaiG9LDYHfZGqeNaoGRzFEnLiwUT7WiC6sA6FDJX9ZPq
VITE_REWARDS_MANAGER_TOKEN_PDA_OVERRIDE=HJQj8P47BdA7ugjQEn45LaESYrxhiZDygmukt8iumFZJ
4 changes: 3 additions & 1 deletion monitoring/uptime/node-ui/.eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module.exports = {
'plugin:react-hooks/recommended',
'plugin:react/recommended',
'plugin:react/jsx-runtime',

'plugin:prettier/recommended',
],
ignorePatterns: ['dist', '.eslintrc.cjs'],
parser: '@typescript-eslint/parser',
Expand All @@ -17,6 +17,8 @@ module.exports = {
'warn',
{ allowConstantExport: true },
],
'@typescript-eslint/no-unsafe-call': 'off',
'@typescript-eslint/no-unsafe-assignment': 'off',
},
parserOptions: {
ecmaVersion: 'latest',
Expand Down
5 changes: 3 additions & 2 deletions monitoring/uptime/node-ui/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@

React app exposing uptime of nodes in the network.

To test locally: `npm run stage` or `npm run prod`.
When ran on stage or prod, the app will query its local /up_api/env endpoint to get environment variables that are set on the node (because the React app can't access these directly for security reasons).
* To test locally: `npm run stage` or `npm run prod`
* To test in a more prod-like manner locally: `npm run stage:preview` or `npm run prod:preview`
* When ran on stage or prod, the app will query its local `/up_api/env`` endpoint to get environment variables that are set on the node (because the React app can't access these directly for security reasons)
Loading

0 comments on commit 820d60f

Please sign in to comment.