This document outlines the steps to compile and deploy the damn-api Spring Boot project, which integrates with PostgreSQL and Neo4j databases running as separate Docker containers.
-
Prerequisites:
- Java 21 installed.
- Maven installed.
- Docker and Docker Compose installed.
-
Clone or Create Project:
- Either unzip the provided
damn-api.zipfile on your local machine or clone the project from GitHub:git clone https://github.com/damn-maps/damn-api.git
- Either unzip the provided
-
Build the Project:
- Navigate to the project root (
damn-maps/):cd damn-maps - Compile and package the project:
mvn clean install
- Navigate to the project root (
-
Start PostgreSQL and Neo4j:
- Create a Docker network for container communication:
sudo docker network create damn-network
- Start the Neo4j container:
sudo docker run --name neo4j -p 7474:7474 -p 7687:7687 -e NEO4J_AUTH=neo4j/yourpassword -e NEO4J_dbms_security_procedures_unrestricted=apoc.* -e NEO4J_dbms_security_procedures_allowlist=apoc.* -e NEO4J_dbms_memory_transaction_total_max=4g -e NEO4J_dbms_memory_heap_initial__size=1g -e NEO4J_dbms_memory_heap_max__size=2g -e NEO4J_dbms_memory_pagecache_size=1g --memory="6g" --memory-swap="8g" -v C:/Users/Lenovo/Downloads/apoc-2025.02.0.jar:/var/lib/neo4j/plugins/apoc-2025.02.0.jar -v neo4j-data:/data -v neo4j-logs:/logs --network damn-network neo4j:2025.02.0
- Pull the PostgreSQL image:
sudo docker pull postgres
- Start the PostgreSQL container:
sudo docker run --name damn_map_postgres --network damn-network -e POSTGRES_USER=damn -e POSTGRES_PASSWORD=mypassword -e POSTGRES_DB=damn_maps -p 5432:5432 -d postgres
- Create a Docker network for container communication:
-
Build and Run the Spring Boot App:
- From the project root (
damn-maps/), build the Docker image and start the application:docker-compose up --build
- From the project root (