Deployment Guide
This guide covers deploying both microservices in the shipping system:- svc-envio-encomienda - REST API for shipment management (port 8080)
- svc-web-semantica - Semantic web RDF/OWL service (port 8081)
Prerequisites
Required Software
- Java: JDK 25 (as specified in pom.xml:29)
- Maven: 3.6 or higher
- MySQL: 8.0 or higher
- Operating System: Linux, macOS, or Windows with Java support
Verify Java Installation
Database Setup
MySQL Installation
Ubuntu/Debian
Ubuntu/Debian
macOS (Homebrew)
macOS (Homebrew)
Windows
Windows
Download and install MySQL from https://dev.mysql.com/downloads/installer/
Create Database
Connect to MySQL and create the required database:The database schema will be automatically created by Hibernate based on the
spring.jpa.hibernate.ddl-auto=update setting.Configuration
svc-envio-encomienda Configuration
File:svc-envio-encomienda/src/main/resources/application.propertiesSource: svc-envio-encomienda/src/main/resources/application.properties:1
Default Configuration
Default Configuration
Configuration Properties Explained
Database Connection
Database Connection
spring.datasource.url
- JDBC connection string for MySQL
- Format:
jdbc:mysql://[host]:[port]/[database] - Default:
localhost:3306/bd_envio_encomienda
- MySQL username
- Default:
root - Production: Use dedicated user with limited privileges
- MySQL password
- Production: Use environment variables or secret management
JPA/Hibernate Settings
JPA/Hibernate Settings
spring.jpa.properties.hibernate.dialect
org.hibernate.dialect.MySQLDialect- Optimizes SQL for MySQL 8+
update- Auto-creates/updates schema (development)- Options:
none,validate,update,create,create-drop - Production: Use
validateand manage schema with migrations (Flyway/Liquibase)
true- Logs SQL statements (development)- Production: Set to
falsefor performance
true- Pretty-prints SQL in logs- Production: Set to
false
Microservice Integration
Microservice Integration
microservicio.semantica.url
- URL of the semantic web service
- Default:
http://localhost:8081/api/v1/grafo - Update for production deployment with actual service URL
Production Configuration Example
application-prod.properties
application-prod.properties
svc-web-semantica Configuration
File:svc-web-semantica/src/main/resources/application.propertiesSource: svc-web-semantica/src/main/resources/application.properties:1
Default Configuration
Default Configuration
Configuration Properties Explained
TDB Storage
TDB Storage
jena.tdb.directoryProduction: Use absolute path:
- Directory for Apache Jena TDB (triple store database)
- Default:
tdb_data(relative to application root) - Stores RDF triples persistently
The TDB directory will be created automatically if it doesn’t exist.
Building the Application
Build Both Services
From the project root directory:svc-envio-encomienda/target/svc-envio-encomienda-0.0.1-SNAPSHOT.jarsvc-web-semantica/target/svc-web-semantica-0.0.1-SNAPSHOT.jar
Build Individual Service
Maven Build Configuration
Maven Build Configuration
The
pom.xml (svc-envio-encomienda/pom.xml:84) includes:- Spring Boot Maven Plugin - Creates executable JAR
- Lombok Processor - Annotation processing
- Java Compiler - Targets Java 25
- Spring Boot Starter Data JPA
- Spring Boot Starter Web
- Spring Boot Starter Validation
- Spring Cloud OpenFeign
- MySQL Connector
- Lombok
Running the Services
Development Mode
Option 1: Using Maven (recommended for development)
Terminal 1 - Semantic Web Service:Option 2: Using JAR files
Terminal 1:Production Deployment
Using systemd (Linux)
Service File: /etc/systemd/system/svc-envio-encomienda.service
Service File: /etc/systemd/system/svc-envio-encomienda.service
Service File: /etc/systemd/system/svc-web-semantica.service
Service File: /etc/systemd/system/svc-web-semantica.service
Using Docker
Dockerfile - svc-envio-encomienda
Dockerfile - svc-envio-encomienda
docker-compose.yml
docker-compose.yml
Verification
Check Service Health
Verify Database Connection
Check application logs:Successful startup should show Hibernate creating tables and Tomcat starting on ports 8080/8081.
Test API Endpoints
Troubleshooting
MySQL Connection Refused
MySQL Connection Refused
Error:
Communications link failureSolutions:-
Verify MySQL is running:
-
Check MySQL is listening on 3306:
-
Verify credentials:
- Check firewall rules (if remote MySQL)
Port Already in Use
Port Already in Use
Error:
Port 8080 already in useSolutions:-
Find process using port:
-
Kill process:
-
Change port in application.properties:
TDB Directory Permission Denied
TDB Directory Permission Denied
Error: Cannot write to
tdb_dataSolutions:-
Create directory with proper permissions:
-
Or use relative path in working directory:
Java Version Mismatch
Java Version Mismatch
Error:
Unsupported class file major version 69Solution: Ensure Java 25 is installed and active:Performance Tuning
JVM Options
Production JVM Settings
Production JVM Settings
-Xms1024m- Initial heap size-Xmx2048m- Maximum heap size-XX:+UseG1GC- Use G1 garbage collector-XX:MaxGCPauseMillis=200- Target max GC pause time-XX:+HeapDumpOnOutOfMemoryError- Create dump on OOM
Database Connection Pool
Add to application.properties:Security Considerations
Environment Variables Setup
Monitoring and Logging
Enable Spring Boot Actuator
Add topom.xml:
Logging Configuration
Related Documentation
- Data Model Reference - Entity definitions
- Error Handling - Exception handling
- Ontology Reference - RDF/OWL ontology