You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Postman has a script that will automatically retrieve a new set of access and refresh tokens whenever you get a 401 error. This only works when the 401 is received before the access token expires.
nvim ~/.zshrc
// Add the following to the bottom of the file
export JAVA_HOME=$(/usr/libexec/java_home)
// exit vim... if you can.
// reload your bash profile
source ~/.zshrc
install gradle
brew install gradle
install postgres locally
brew install postgres@16
// Add postgres to your path
echo 'export PATH="$PATH:/opt/homebrew/opt/postgresql@16/bin"' >> ~/.zshrc
// reload your bash profile
source ~/.zshrc
// create default user in postgres
createuser -s postgres
// start postgres via homebrew
brew services start postgresql@16
// stop postgres (when you're done)
brew services stop postgresql@16
// login to postgres
psql -U postgres
// create postgres user for harmony (no password set because this user is for local dev only)
postgres=# CREATE USER harmony_app;
// create db for harmony
postgres=# CREATE DATABASE harmony OWNER harmony_app;
// exit psql
exit
generate a JWT secret key
openssl rand -base64 32
set environment variables
open the repository and create a .env file containing the following:
// build and run the docker image locally
./gradlew runDockerContainer
// OPTIONAL - use gradle to run the app directly if you'd like to run the app w/o docker
// (JDBC_DATABASE_URL needs to be localhost)
./gradlew bootRun
Look for a message like this in the terminal
Started BackendApplicationKt in 1.931 seconds
Open the app in a web browser and check the health endpoint to verify it's running
Go to http://localhost:8080/ in a web browser
If you see "Hello World" then the application is running locally.
Troubleshooting
"Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured."
Your database is not configured.
Make sure to add the following dependency in the build.gradle file
implementation 'org.postgresql:postgresql'
Make sure teh following are set in application.properties file
> Task :buildDockerImage FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':buildDockerImage'.
> A problem occurred starting process 'command 'docker''
The Docker daemon is misbehaving, you may need to restart your machine
You can try building the image manually
docker build -t harmony-backend:latest .
You can also try running ./gradlew bootRun to run the application on localhost
You'll need to update your JDBC_DATABASE_URL from host.docker.internal to localhost in .env
Dependencies not resolving in IntelliJ?
Open the build.gradle file in IntelliJ
Click on the little elephant refresh button in the top right of the window.
You can also relaunch your IDE
If you see a flyway error like the following when building:
error:
* What went wrong:
Execution failed for task ':flywayMigrate'.
> Error occurred while executing flywayMigrate
Validate failed: Migrations have failed validation
Detected applied migration not resolved locally: 20250305120418.
If you removed this migration intentionally, run repair to mark the migration as deleted.
This might have happened because a migration was deleted after it was run. To fix this, run the following command in the terminal:
./gradlew flywayRepair
This will mark the migration as deleted and allow the application to build.