Skip to content

Commit

Permalink
Merge branch 'main' into am-link-to-album
Browse files Browse the repository at this point in the history
  • Loading branch information
amendelsohn committed Jan 4, 2024
2 parents 1f2cca8 + 5bb8bb6 commit fbd3388
Show file tree
Hide file tree
Showing 330 changed files with 24,106 additions and 35,629 deletions.
80 changes: 47 additions & 33 deletions .circleci/src/commands/@mobile-commands.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,14 @@ mobile-prepare-ios:
command: |
ln -s $PWD/node_modules/.bin/react-native $PWD/packages/mobile/node_modules/.bin/react-native || true
ln -s $PWD/node_modules/react-native $PWD/packages/mobile/node_modules/react-native || true
ln -s $PWD/node_modules/react-native-code-push $PWD/packages/mobile/node_modules/react-native-code-push || true
- restore_cache:
key: pods-{{ checksum "packages/mobile/ios/Podfile.lock" }}
- run:
name: install pods
command: |
cd packages/mobile/ios
pod install --deployment
bundle exec pod install
- save_cache:
key: pods-{{ checksum "packages/mobile/ios/Podfile.lock" }}
paths:
Expand Down Expand Up @@ -110,30 +111,35 @@ mobile-release-ios:
env:
default: '.env.prod'
type: string
slack-notify:
default: true
type: boolean
steps:
- run:
name: fastlane build and upload
command: cd packages/mobile/ios && bundle exec fastlane build_and_upload bundle_id:<<parameters.bundle-id>>
- run:
name: slack announce
command: |
cd packages/mobile
deploying_version=$(jq -r '.version' package.json)
job_url="https://app.circleci.com/pipelines/workflows/$CIRCLE_WORKFLOW_ID"
environment=<<parameters.bundle-id>>
if [ "$environment" = 'co.audius.audiusmusic' ] ||
[ "$environment" = 'co.audius.audiusmusic.releasecandidate' ] ||
[ "$environment" = 'co.audius.audiusmusic.staging.releasecandidate' ]; then
if [ <<parameters.slack-notify>> = true ]; then
cd packages/mobile
deploying_version=$(jq -r '.version' package.json)
job_url="https://app.circleci.com/pipelines/workflows/$CIRCLE_WORKFLOW_ID"
environment=<<parameters.bundle-id>>
if [ "$environment" = 'co.audius.audiusmusic' ] ||
[ "$environment" = 'co.audius.audiusmusic.releasecandidate' ] ||
[ "$environment" = 'co.audius.audiusmusic.staging.releasecandidate' ]; then
json_content="{ \"blocks\": ["
json_content+="{ \"type\": \"section\", \"text\": { \"type\": \"mrkdwn\", \"text\": \"Deployed $environment <${job_url}|v$deploying_version> to mobile ios \n\" } }"
json_content+="]}"
echo "Text to send to slack: $json_content"
json_content="{ \"blocks\": ["
json_content+="{ \"type\": \"section\", \"text\": { \"type\": \"mrkdwn\", \"text\": \"Deployed $environment <${job_url}|v$deploying_version> to mobile ios \n\" } }"
json_content+="]}"
echo "Text to send to slack: $json_content"
# Send Slack message
curl -f -X POST -H 'Content-type: application/json' \
--data "$json_content" \
$SLACK_DAILY_DEPLOY_WEBHOOK
# Send Slack message
curl -f -X POST -H 'Content-type: application/json' \
--data "$json_content" \
$SLACK_DAILY_DEPLOY_WEBHOOK
fi
fi
# Prepare to build/upload/release Android
Expand All @@ -157,7 +163,7 @@ mobile-prepare-android:
name: install pip
command: |
sudo apt update
sudo apt install python3-pip
sudo apt install python3-pip ninja-build
- restore_cache:
key: 1-gems-{{ checksum "packages/mobile/android/Gemfile.lock" }}
- run: cd packages/mobile/android && (bundle check || bundle install --path vendor/bundle)
Expand Down Expand Up @@ -207,6 +213,7 @@ mobile-build-android:
name: Symlink react-native
command: |
ln -s $PWD/node_modules/react-native $PWD/packages/mobile/node_modules/react-native || true
ln -s $PWD/node_modules/react-native-code-push $PWD/packages/mobile/node_modules/react-native-code-push || true
- run:
name: generating the release apk & bundle
command: |
Expand All @@ -225,12 +232,16 @@ mobile-release-android:
track:
default: 'alpha'
type: string
slack-notify:
default: true
type: boolean
steps:
- run:
name: Symlink react-native
command: |
ln -s $PWD/node_modules/.bin/react-native $PWD/packages/mobile/node_modules/.bin/react-native || true
ln -s $PWD/node_modules/react-native $PWD/packages/mobile/node_modules/react-native || true
ln -s $PWD/node_modules/react-native-code-push $PWD/packages/mobile/node_modules/react-native-code-push || true
- run:
name: release android
command: |
Expand All @@ -239,24 +250,26 @@ mobile-release-android:
- run:
name: slack announce
command: |
cd packages/mobile
deploying_version=$(jq -r '.version' package.json)
job_url="https://app.circleci.com/pipelines/workflows/$CIRCLE_WORKFLOW_ID"
environment=<<parameters.upload-type>>
if [ <<parameters.slack-notify>> = true ]; then
cd packages/mobile
deploying_version=$(jq -r '.version' package.json)
job_url="https://app.circleci.com/pipelines/workflows/$CIRCLE_WORKFLOW_ID"
environment=<<parameters.upload-type>>
if [ "$environment" = 'prod' ] ||
[ "$environment" = 'releaseCandidate' ] ||
[ "$environment" = 'stagingReleaseCandidate' ]; then
if [ "$environment" = 'prod' ] ||
[ "$environment" = 'releaseCandidate' ] ||
[ "$environment" = 'stagingReleaseCandidate' ]; then
json_content="{ \"blocks\": ["
json_content+="{ \"type\": \"section\", \"text\": { \"type\": \"mrkdwn\", \"text\": \"Deployed $environment <${job_url}|v$deploying_version> to mobile android \n\" } }"
json_content+="]}"
echo "Text to send to slack: $json_content"
json_content="{ \"blocks\": ["
json_content+="{ \"type\": \"section\", \"text\": { \"type\": \"mrkdwn\", \"text\": \"Deployed $environment <${job_url}|v$deploying_version> to mobile android \n\" } }"
json_content+="]}"
echo "Text to send to slack: $json_content"
# Send Slack message
curl -f -X POST -H 'Content-type: application/json' \
--data "$json_content" \
$SLACK_DAILY_DEPLOY_WEBHOOK
# Send Slack message
curl -f -X POST -H 'Content-type: application/json' \
--data "$json_content" \
$SLACK_DAILY_DEPLOY_WEBHOOK
fi
fi
# Deploy Solana saga dApp store
Expand Down Expand Up @@ -303,11 +316,12 @@ mobile-release-saga-dapp-store:
command: |
ln -s $PWD/node_modules/.bin/react-native $PWD/packages/mobile/node_modules/.bin/react-native || true
ln -s $PWD/node_modules/react-native $PWD/packages/mobile/node_modules/react-native || true
ln -s $PWD/node_modules/react-native-code-push $PWD/packages/mobile/node_modules/react-native-code-push || true
- run:
name: Build Android
command: |
cd packages/mobile/android
./gradlew app:assembleRelease
./gradlew app:assembleRelease -PreactNativeArchitectures=arm64-v8a
- run:
name: Validate release
command: |
Expand Down
2 changes: 2 additions & 0 deletions .circleci/src/jobs/@mobile-jobs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ mobile-build-upload-production-ios-if-full-release:
build-directory: 'build-mobile-production'
bundle-id: 'co.audius.audiusmusic'
env: '.env.prod'
slack-notify: false

mobile-deploy-codepush-production-ios-if-ota-release:
working_directory: ~/audius-protocol
Expand Down Expand Up @@ -289,6 +290,7 @@ mobile-build-upload-production-android-if-full-release:
build-directory: 'build-mobile-production'
upload-type: 'prod'
track: 'alpha'
slack-notify: false

mobile-deploy-codepush-production-android-if-ota-release:
working_directory: ~/audius-protocol
Expand Down
2 changes: 1 addition & 1 deletion comms/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ COPY --from=builder /app/comms /bin/comms

EXPOSE 4222
VOLUME ["/tmp"]
ENTRYPOINT ["comms"]
CMD ["comms"]
2 changes: 2 additions & 0 deletions comms/discovery/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ type DiscoveryConfig struct {
MyWallet string
MyPrivateKey *ecdsa.PrivateKey `json:"-"`
IsStaging bool
IsSandbox bool // audius-d sandbox (comms_sandbox env var)
IsDev bool
IsRegisteredWallet bool

Expand All @@ -44,6 +45,7 @@ func Parse() *DiscoveryConfig {
c.MyHost = misc.TrimTrailingSlash(os.Getenv("audius_discprov_url"))
c.IsStaging = os.Getenv("AUDIUS_IS_STAGING") == "true"
c.IsDev = os.Getenv("comms_dev_mode") == "true"
c.IsSandbox = os.Getenv("comms_sandbox") == "true"

pk, err := parsePrivateKey(os.Getenv("audius_delegate_private_key"))
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion comms/discovery/discovery_main.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func backgroundRefreshRegisteredPeers(discoveryConfig *config.DiscoveryConfig) {
}

func refreshRegisteredPeers(discoveryConfig *config.DiscoveryConfig) error {
if discoveryConfig.IsDev {
if discoveryConfig.IsDev || discoveryConfig.IsSandbox {
discoveryConfig.IsRegisteredWallet = true
return nil
}
Expand Down
15 changes: 15 additions & 0 deletions comms/discovery/pubkeystore/recover.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"errors"
"fmt"
"math/big"
"os"
"strings"

"comms.audius.co/discovery/config"
Expand Down Expand Up @@ -46,6 +47,20 @@ func Dial(discoveryConfig *config.DiscoveryConfig) error {
finalPoaBlock = 30000000
}

if discoveryConfig.IsDev {
acdcEndpoint = "http://audius-protocol-poa-ganache-1"
poaEndpoint = "http://audius-protocol-poa-ganache-1" // won't ever be used
verifyingContract = "0x254dffcd3277C0b1660F6d42EFbB754edaBAbC2B"
finalPoaBlock = -1
}

if discoveryConfig.IsSandbox {
acdcEndpoint = os.Getenv("audius_web3_eth_provider_url")
poaEndpoint = os.Getenv("audius_web3_host")
verifyingContract = os.Getenv("audius_contracts_entity_manager_address")
finalPoaBlock = -1
}

poaClient, err = ethclient.Dial(poaEndpoint)
if err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion comms/discovery/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ func (s *ChatServer) getStatus(c echo.Context) error {
}

func (s *ChatServer) isHealthy() bool {
if s.config.IsDev {
if s.config.IsDev || s.config.IsSandbox {
return true
}
return s.config.IsRegisteredWallet && s.websocketError == nil
Expand Down
4 changes: 2 additions & 2 deletions contracts/contracts/EntityManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ contract EntityManager is SigningLogicInitializable {

function initialize(
address _verifierAddress,
uint _networkId
uint _chainId
) public initializer
{
require(
Expand All @@ -41,7 +41,7 @@ contract EntityManager is SigningLogicInitializable {
SigningLogicInitializable.initialize(
"Entity Manager",
"1",
_networkId
_chainId
);
}

Expand Down
6 changes: 3 additions & 3 deletions contracts/migrations/2_entity_manager_migration.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@ module.exports = (deployer, network, accounts) => {
const config = contractConfig[network]
const proxyAdminAddress =
config.blacklisterAddress || accounts[accounts.length - 1]
const networkId = await web3.eth.net.getId()
console.log(`Deploying EntityManager to ${networkId}`)
const chainId = await web3.eth.getChainId()
console.log(`Deploying EntityManager to ${chainId}`)
const deployLogicTx = await deployer.deploy(EntityManager)
const logicContractAddress = deployLogicTx.address
console.log(logicContractAddress)
const verifierAddress = config.verifierAddress || accounts[0]
const initializeData = encodeCall(
'initialize',
['address', 'uint'],
[verifierAddress, networkId]
[verifierAddress, chainId]
)
// Deploy proxy contract with encoded initialize function
let deployedProxyTx = await deployer.deploy(
Expand Down
9 changes: 3 additions & 6 deletions dev-tools/audius-compose
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ def build(

# build 2 extra images for protocol dashboard (stage and prod)
if "dashboard" in services and prod:
for target in ["stage", "prod"]:
for target in ["dev", "stage", "prod"]:
env = os.environ.copy()
env["DASHBOARD_ENV_TYPE"] = target
proc = subprocess.run(
Expand Down Expand Up @@ -294,13 +294,9 @@ def push(ctx, services, prod):
base_tag = f"{protocol_dir.name}-{service}"

if service == "dashboard" and prod:
# tag -stage image
subprocess.run(["docker", "tag", f"{base_tag}:dev", f"audius/{service}:{git_commit}-dev"], check=True)
subprocess.run(["docker", "tag", f"{base_tag}:stage", f"audius/{service}:{git_commit}-stage"], check=True)
subprocess.run(["docker", "push", f"audius/{service}:{git_commit}-stage"], check=True)

# tag -prod image
subprocess.run(["docker", "tag", f"{base_tag}:prod", f"audius/{service}:{git_commit}-prod"], check=True)
subprocess.run(["docker", "push", f"audius/{service}:{git_commit}-prod"], check=True)

subprocess.run(["docker", "tag", base_tag, f"audius/{service}:{git_commit}"], check=True)
subprocess.run(["docker", "push", f"audius/{service}:{git_commit}"], check=True)
Expand All @@ -310,6 +306,7 @@ def push(ctx, services, prod):
try:
for service in services:
if service == "dashboard" and prod:
subprocess.run(["docker", "push", f"audius/{service}:{git_commit}-dev"], check=True)
subprocess.run(["docker", "push", f"audius/{service}:{git_commit}-stage"], check=True)
subprocess.run(["docker", "push", f"audius/{service}:{git_commit}-prod"], check=True)

Expand Down
10 changes: 7 additions & 3 deletions dev-tools/compose/docker-compose.discovery.prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,19 @@ services:
build:
context: ${PROJECT_ROOT}/comms
dockerfile: Dockerfile
command: discovery
command: sh -c ". /tmp/dev-tools/startup/startup.sh && comms discovery"
restart: unless-stopped
env_file: .env # used by the startup script
environment:
comms_dev_mode: true
audius_delegate_private_key: 'c82ad757622db5a148089e0a8fc1741cefa8677ab56a2ac9e38dac905c5ad7c7'
audius_db_url: 'postgresql://postgres:postgres@db:5432/discovery_provider_1'
depends_on:
db:
condition: service_healthy
deploy:
mode: replicated
replicas: '${DISCOVERY_PROVIDER_REPLICAS}'
volumes:
- ${PROJECT_ROOT}/dev-tools:/tmp/dev-tools

trpc:
build:
Expand Down
2 changes: 1 addition & 1 deletion dev-tools/compose/docker-compose.test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ services:
build:
context: ${PROJECT_ROOT}/comms
dockerfile: Dockerfile
command: discovery-migrations
command: comms discovery-migrations
environment:
audius_db_url: 'postgres://postgres:postgres@discovery-provider-db:5432/discovery_provider?sslmode=disable'
depends_on:
Expand Down
6 changes: 3 additions & 3 deletions dev-tools/compose/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ x-common: &common
driver: json-file
extra_hosts:
# Allows the containers can talk to each other via their hostnames routed through nginx
- 'audius-protocol-comms-discovery-1:host-gateway'
- 'audius-protocol-comms-discovery-2:host-gateway'
- 'audius-protocol-comms-discovery-3:host-gateway'
- 'audius-protocol-comms-1:host-gateway'
- 'audius-protocol-comms-2:host-gateway'
- 'audius-protocol-comms-3:host-gateway'
- 'audius-protocol-creator-node-1:host-gateway'
- 'audius-protocol-creator-node-2:host-gateway'
- 'audius-protocol-creator-node-3:host-gateway'
Expand Down
Loading

0 comments on commit fbd3388

Please sign in to comment.