Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[INF-76] New Local Deployment Setup with docker-compose #2988

Merged
merged 81 commits into from
Jul 14, 2022

Conversation

cheran-senthil
Copy link
Contributor

@cheran-senthil cheran-senthil commented Apr 28, 2022

This PR removes the need for init-repos

Everything works solely through docker and the entire audius dev stack can be brought up with docker compose up

This is incompatible with service-commands and is a full refactor

Description

  • sudo and /etc/hosts modification no longer required
  • Makes Solana contract addresses deterministic
  • Block Explorer for Ganache instances
  • Reduces size of solana-programs and increases the build speed dramatically (13 GB to 2 GB)
  • Centralizes configuration to one file
  • Use pre-deployed images for Solana, ETH and POA -> this should bring down A up to < 1 minute
  • Add Discovery Provider and register it
  • Add Creator Node and register it
  • Creates wrapper script to imitate A

Follow Up PR

  • Rewrite all service-command commands and scripts in JavaScript for consistency
  • Collect and centralize scripts across audius

Tests

  • docker compose up
  • Health Checks on local
# Ubuntu 22.04 LTS | 12 vCPU / 24 GB RAM | 256 GB SSD

# initial setup
curl "https://raw.githubusercontent.com/AudiusProject/audius-protocol/master/dev-tools/setup.sh" | bash

# refresh terminal for docker
exit

# build and pull
audius-compose build # About 10 minutes
docker compose pull

audius-compose up # About 20 seconds

@cheran-senthil cheran-senthil changed the title Deploy contracts via docker New Local Deployment Setup with docker-compose May 9, 2022
@cheran-senthil cheran-senthil added requires-special-attention This change is risky and/or critical and requires special attention in review service-commands Service Commands solana labels May 9, 2022
@cheran-senthil
Copy link
Contributor Author

@hareeshnagaraj if you could take a look at the Solana changes, that would be great, thanks!

@cheran-senthil cheran-senthil changed the title New Local Deployment Setup with docker-compose [INF-76] New Local Deployment Setup with docker-compose May 9, 2022
docker-compose.yml Outdated Show resolved Hide resolved
contracts/migrations/4_user_replica_set_migration.js Outdated Show resolved Hide resolved
contracts/contract-config.js Show resolved Hide resolved
contracts/contract-config.js Show resolved Hide resolved
docker-compose.yml Outdated Show resolved Hide resolved
identity-service/Dockerfile Outdated Show resolved Hide resolved
Copy link
Contributor

@csjiang csjiang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added some comments/qs! Looks great overall can't wait to switch to this new world :mochi_nani:

.env Outdated Show resolved Hide resolved
docker-compose.yml Outdated Show resolved Hide resolved
docker-compose.yml Outdated Show resolved Hide resolved
docker-compose.yml Show resolved Hide resolved
docker-compose.yml Show resolved Hide resolved
solana-programs/Dockerfile Outdated Show resolved Hide resolved
solana-programs/Dockerfile Show resolved Hide resolved
solana-programs/scripts/build.sh Show resolved Hide resolved
solana-programs/scripts/build.sh Outdated Show resolved Hide resolved
solana-programs/scripts/deploy.sh Show resolved Hide resolved
Copy link
Contributor

@csjiang csjiang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nvm - ran this and doesn't work yet so making this a comment haha

Copy link
Contributor

@csjiang csjiang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry, approval -> comment doesn't work so i'm doing approval -> request changes to remove the trigger-happy approval heh

@cheran-senthil cheran-senthil force-pushed the vss-new-local-deploy branch 2 times, most recently from d70658a to fd9fabe Compare July 12, 2022 18:18
Copy link
Member

@raymondjacobson raymondjacobson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change looks good to me & rebasing+merging I think is the most sensible next steps. Client still has some work to get going off of this (proxy/registration stuff we chatted about), AAO and ES probably need implementation, and I think we should separate the containers some. I think we need to get through the long tail of those TODOs (and deleting the old A code) before we end up with two standards :)

ETH_CONTRACTS_ABI_DIR = pathlib.Path(__file__).parent / "../build/eth-contracts"


def health_check(discprov_url):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit, preference for this to work based on status code alone. block diff should just be accounted for in health check long term imo

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we may also want to not health check the node pre-registration per @hareeshnagaraj 's changes today.

  1. content nodes need a discovery node to be online to be healthy
  2. registering a content node will fail unless there are discovery nodes
  3. discovery nodes will be unable to index the endpoints of content nodes if they never get registered
  4. death

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Identity times out the nodes that are not healthy though, I'm not sure how to get around this

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will add a follow up task

mkdir -p "$HOME/.local/bin"

ln -sf "$PROTOCOL_DIR/dev-tools/audius-compose" "$HOME/.local/bin/audius-compose"
# ln -sf "$PROTOCOL_DIR/dev-tools/audius-cloud" "$HOME/.local/bin/audius-cloud"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove maybe?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should be adding audius-cloud soon, I think this is safe to keep?

sudo -u postgres createdb audius_discovery
else
sudo -u postgres pg_ctl start -D /db
sudo -u postgres pg_ctl start -D /db -o "-c shared_buffers=512MB" -o "-c shared_preload_libraries=pg_stat_statements"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks, this is great! although long-term i still do believe in the db being similarly containerized being a helpful thing.

I know you were trying to save complexity in number of containers running, but maybe if we are better about port mgmt & naming of containers, we'll make life a lot easier

discovery_1_indexer
discovery_1_server
discovery_1_db

discovery_2_indexer
etc. etc.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this sounds good, I've made a follow up task for this, thanks!

@@ -110,7 +110,6 @@ if [ "$audius_db_run_migrations" != false ]; then
echo "Finished running migrations"
fi


# start es-indexer
if [[ "$audius_elasticsearch_url" ]] && [[ "$audius_elasticsearch_run_indexer" ]]; then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in this new world, i don't think there's ES implemented yet right? not sure what the es indexer will do.

also noticed in playing with client, we don't have AAO either.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ES indexer should not start for now since audius_elasticsearch_url is not set

Will add ES and AAO in a follow up PR

@cheran-senthil cheran-senthil force-pushed the vss-new-local-deploy branch 3 times, most recently from 7bddebc to b9dbca8 Compare July 14, 2022 16:02
@cheran-senthil cheran-senthil merged commit ba91046 into master Jul 14, 2022
@cheran-senthil cheran-senthil deleted the vss-new-local-deploy branch July 14, 2022 16:26
hareeshnagaraj pushed a commit that referenced this pull request Jul 14, 2022
## Changelog

- #3463 by nicoback2 bump
- #3420 by nicoback2 Use
- #2988 by Cheran [INF-76]
- #3458 by Johannes Naylor
- #3456 by Sid Sethi
- libs by Johannes Naylor
- #3451 by Sebastian Klingler
- #3373 by Sebastian Klingler
- #3449 by Theo Ilie
- #3408 by Theo Ilie
- #3445 by Sebastian Klingler
- #3435 by Reed Added
- #3438 by Raymond Jacobson
- #3434 by Hareesh Nagaraj
- #3433 by Sebastian Klingler
- #3406 by nicoback2 Make
- #3402 by Hareesh Nagaraj
- #3394 by Raymond Jacobson
- #3392 by Raymond Jacobson
- #3363 by Michael Piazza
- #3366 by Joseph Lee
- #3354 by Joseph Lee
- #3362 by Michael Piazza
- #3361 by Raymond Jacobson
- #3360 by Raymond Jacobson
- #3347 by Raymond Jacobson
- #3345 by Raymond Jacobson
- #3337 by Sebastian Klingler
- #3336 by Sid Sethi
hareeshnagaraj pushed a commit that referenced this pull request Jul 14, 2022
## Changelog

- #3463 by nicoback2 bump
- #3420 by nicoback2 Use
- #2988 by Cheran [INF-76]
- #3458 by Johannes Naylor
- #3456 by Sid Sethi
- libs by Johannes Naylor
- #3451 by Sebastian Klingler
- #3373 by Sebastian Klingler
- #3449 by Theo Ilie
- #3408 by Theo Ilie
- #3445 by Sebastian Klingler
- #3435 by Reed Added
- #3438 by Raymond Jacobson
- #3434 by Hareesh Nagaraj
- #3433 by Sebastian Klingler
- #3406 by nicoback2 Make
- #3402 by Hareesh Nagaraj
- #3394 by Raymond Jacobson
- #3392 by Raymond Jacobson
- #3363 by Michael Piazza
- #3366 by Joseph Lee
- #3354 by Joseph Lee
- #3362 by Michael Piazza
- #3361 by Raymond Jacobson
- #3360 by Raymond Jacobson
- #3347 by Raymond Jacobson
- #3345 by Raymond Jacobson
- #3337 by Sebastian Klingler
- #3336 by Sid Sethi
hareeshnagaraj pushed a commit that referenced this pull request Jul 14, 2022
## Changelog

- #3463 by nicoback2 bump
- #3420 by nicoback2 Use
- #2988 by Cheran [INF-76]
- #3458 by Johannes Naylor
- #3456 by Sid Sethi
- libs by Johannes Naylor
- #3451 by Sebastian Klingler
- #3373 by Sebastian Klingler
- #3449 by Theo Ilie
- #3408 by Theo Ilie
- #3445 by Sebastian Klingler
- #3435 by Reed Added
- #3438 by Raymond Jacobson
- #3434 by Hareesh Nagaraj
- #3433 by Sebastian Klingler
- #3406 by nicoback2 Make
- #3402 by Hareesh Nagaraj
- #3394 by Raymond Jacobson
- #3392 by Raymond Jacobson
- #3363 by Michael Piazza
- #3366 by Joseph Lee
- #3354 by Joseph Lee
- #3362 by Michael Piazza
- #3361 by Raymond Jacobson
- #3360 by Raymond Jacobson
- #3347 by Raymond Jacobson
- #3345 by Raymond Jacobson
- #3337 by Sebastian Klingler
- #3336 by Sid Sethi
@AudiusProject AudiusProject deleted a comment from linear bot Sep 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
developer-experience Improvements to developer experience and ergonomics Epic infrastructure service-commands Service Commands size/XXL solana
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants