Before you begin, ensure you have the following installed on your system:
- Docker
- Docker Compose
First, clone the repository to your local machine:
git clone https://github.com/napalm23zero/template-java-17-spring-oracle.git
cd template-java-17-spring-oracle
This project uses .env
files to manage configuration settings. The .env
file is provided to manage sensitive data. Here's a simple one with the following content, just for testing. Once you deploy this app in production, change these values:
ORACLE_PASSWORD=1q2w3e4r5t6y
ORACLE_USER=template
ORACLE_DATABASE=template_app
ORACLE_HOST=template-oracle-db-build
ORACLE_PORT=1521
SERVER_PORT=8080
To run both the backend and the Oracle database using Docker Compose, follow these steps:
-
Ensure you have the
.env
file configured as described above. -
Use the provided script to set the environment variables correctly based on your OS and start Docker Compose:
-
On Unix (Linux/macOS):
./start-docker-compose.sh
-
On Windows PowerShell:
.\start-docker-compose.ps1
-
-
Access the application:
- API Endpoint: http://localhost:8080/api
- Swagger UI: http://localhost:8080/swagger-ui.html
To run only the backend and connect to an external Oracle database, follow these steps:
-
Update the
.env
file with your external database details:ORACLE_PASSWORD=your_external_db_password ORACLE_USER=your_external_db_user ORACLE_DATABASE=your_external_db_service_name ORACLE_HOST=your_external_db_host ORACLE_PORT=your_external_db_port
-
Start the backend service using the external database configuration:
-
On Unix (Linux/macOS):
./start-docker-compose.sh
-
On Windows PowerShell:
.\start-docker-compose.ps1
-
-
Access the application:
- API Endpoint: http://localhost:8080/api
- Swagger UI: http://localhost:8080/swagger-ui.html
When running the application with Docker Compose, use the following connection string to access the Oracle database:
- JDBC URL:
jdbc:oracle:thin:@localhost:1521/template_app
- Username:
template
- Password:
1q2w3e4r5t6y