anchor.diff:  This page contains instructions on getting a local development system up and running.
   
   toc::[]
  +
  +TIP: While we do our best to keep this page current, it may be a good idea to cross-reference the setup for link:../doc/deployment-with-dockercompose.html[docker-compose deployment] if you're having trouble getting it running locally. We use the publicly available docker-compose files in CI, so if anything changes, it will also get changed there.
   
   == Building rvi_sota_server Locally
   
  
positive.code: -------------------------------------------------------------
  sbt sota-resolver/run
  sbt sota-core/run
  sbt sota-webserver/run
  -------------------------------------------------------------
  
  
negative.code: CREATE DATABASE sota_core_test CHARACTER SET utf8;
  CREATE DATABASE sota_resolver CHARACTER SET utf8;
  CREATE DATABASE sota_resolver_test CHARACTER SET utf8;
  CREATE DATABASE sota_device_registry CHARACTER SET utf8;
  CREATE DATABASE sota_device_registry_test CHARACTER SET utf8;
  CREATE USER 'sota'@'localhost' IDENTIFIED BY 's0ta';
  GRANT ALL PRIVILEGES ON sota_core . * TO 'sota'@'localhost';
  GRANT ALL PRIVILEGES ON sota_core_test . * TO 'sota'@'localhost';
  GRANT ALL PRIVILEGES ON sota_resolver . * TO 'sota'@'localhost';
  GRANT ALL PRIVILEGES ON sota_resolver_test . * TO 'sota'@'localhost';
  GRANT ALL PRIVILEGES ON sota_device_registry . * TO 'sota'@'localhost';
  GRANT ALL PRIVILEGES ON sota_device_registry_test . * TO 'sota'@'localhost';
  FLUSH PRIVILEGES;
  ---------------------------------------------------------------------
  
  To update the database schema, run `sbt flywayMigrate`
  
  This will apply any new migrations in src/main/resources/db/migration, and keep your existing data. This command expects to find the databases on localhost with sota/s0ta for the username/password. The URL to the database and login details can be overridden with the `CORE_DB_URL`, `CORE_DB_USER` and `CORE_DB_PASSWORD` environment variables for the core, `RESOLVER_DB_URL`, `RESOLVER_DB_USER`, and `RESOLVER_DB_PASSWORD` for the external resolver, and `DEVICE_REGISTRY_DB_URL`, `DEVICE_REGISTRY_DB_USER`, and `DEVICE_REGISTRY_DB_PASSWORD` for the device registry. See `project/SotaBuild.scala` for the implementation.
  
  TIP: If you are having trouble with flywayMigrate after an update, try `sbt flywayRepair`, then `sbt flywayMigrate` again. If that doesn't work, you can delete all database tables with `sbt flywayClean`, and then re-create them with `sbt flywayMigrate`.
  
  