Skip to content

Development Environment

Mike Yang edited this page Oct 14, 2022 · 14 revisions

Intellij Setup

  • Download and install IntelliJ
  • Checkout Ambry source

git clone git@github.com:linkedin/ambry.git

  • Update libraries and generate IntelliJ project files

cd <ambry.project.dir>

./gradlew build

./gradlew idea

  • Create IntelliJ workspace
  • Open Intellij and click open project pointing to <ambry.project.dir>
  • Apply the code style XML file provided in this repository (ide/intellij/codestyles/ambry-style.xml):
    1. In Intellij, open preferences -> editor -> code style
    2. Click the "Manage..." button next to "Scheme"
    3. Click "Import..."
    4. Select "Intellij IDEA code style XML"
    5. Choose .../ambry/ide/intellij/codestyles/ambry-style.xml
    6. Select the imported scheme and apply the settings

Eclipse setup

  • Install and prepare Eclipse
  • Download and install Eclipse (Indigo or Juno is recommended);
  • Install IvyIDE plugin as described here. This will allow to automatically create classpath containers starting from ivy files;
  • Checkout Ambry source

git clone git@github.com:linkedin/ambry.git <ambry.project.dir>

  • Generate Eclipse project files

cd <ambry.project.dir>

  • Bootstrap gradle wrapper with: gradle
  • Generate the eclipse projects with: ./gradlew eclipse. This command will create eclipse projects for every project defined in Ambry.
  • Create the Eclipse workspace
  • Open Eclipse and create a new workspace;
  • Import the generated project (File -> Import -> General -> Existing Projects into Workspace)
  • Navigate to the <ambry.project.dir>. Eclipse will find the projects generated by the previous command;
  • Select the projects you want to import;
  • You should see the projects you have imported.
  • You will need regenerate the projects and refresh eclipse every time there is a change in the projects dependencies. In other words, you need to run ./gradlew eclipse and refresh eclipse.

Dev MySQL Setup

For now, some integration tests require manual setup of MySQL. This setup will be automated in the future.

Mac

  1. Install MySQL. It is easiest to install using homebrew: brew install mysql Note that the root user password will be empty by default. Please change it if you wish to expose your local db to the network.
  2. Start MySQL: mysql.server start
  3. Set up test user (called "travis" for now):
mysql -e 'CREATE USER 'travis'@'localhost';' -uroot
mysql -e 'GRANT ALL PRIVILEGES ON * . * TO 'travis'@'localhost';' -uroot
mysql -e 'FLUSH PRIVILEGES;' -uroot
  1. Set up test databases and tables:
cd /project/directory/for/ambry
mysql -e 'CREATE DATABASE AccountMetadata;' -uroot
mysql -e 'USE AccountMetadata; SOURCE ./database/account_metadata/schema/create_tables.ddl;' -uroot
mysql -e 'CREATE DATABASE ambry_container_storage_stats;' -uroot
mysql -e 'USE ambry_container_storage_stats; SOURCE ./database/accountstats/schema/ddl/table.sql;' -uroot
mysql -e 'CREATE DATABASE AmbryNamedBlobs;' -uroot
mysql -e 'USE AmbryNamedBlobs; SOURCE ./database/AMBRYBLOBS/schema/ddl/00-table.sql;' -uroot
  1. If you wish to stop the MySQL process after you are finished testing, you can run mysql.server stop