This README provides instructions on how to set up and launch the local development environment for the project. Follow these steps to get started 🚀.
Before you begin, ensure you have the following installed on your system:
- Docker and Docker Compose
- Maven
- JDK 17 or newer
-
Start the Docker Containers
Navigate to the
build/local
directory of your project where thedocker-compose.yml
file is located. Run the following command to start your local development databases:cd build/local docker-compose up -d
This command will start all the services defined in your
docker-compose.yml
file in detached mode. -
Verify the Containers are Running
You can check if the containers are up and running using:
docker-compose ps
Ensure that the databases are listed as "Up".
Before initiating the integration tests, it's crucial to ensure that the databases required for testing are active and accessible. To achieve this, start by launching Docker Compose, which will spin up the necessary database instances. Following this setup, compile your application using Maven, and don't forget to include the database configurations—URL, user, and password—via Maven flags. This preparatory step is essential for successfully launching your integration tests.
-
Set Environment Variables (Optional)
Navigate back to the root directory of your project (if you're not already there from running Docker Compose) and compile your project sources with Maven:
Instead of passing sensitive information directly in the command line, you can set them as environment variables:
export DATABASE_URL=jdbc:postgresql://localhost:5432/carrent export DATABASE_USER=localuser export DATABASE_PASSWORD=localpassword
-
Compile the Application
With the environment variables set, you can now run building your application with Maven:
mvn clean generate-sources -Ddatabase.url=${env.DATABASE_URL} -Ddatabase.user=${env.DATABASE_USER} -Ddatabase.password=${env.DATABASE_PASSWORD} -X
If you prefer not to use environment variables, you can directly insert the values into the command. However, be mindful of security implications.
mvn clean generate-sources -Ddatabase.url=jdbc:postgresql://localhost:5432/carrent -Ddatabase.user=localuser -Ddatabase.password=localpassword -X
You have successfully set up and launched your local development environment. Happy coding!