This guide covers the installation of the HERCULES SGI system, including all backend services, the authentication server, and the frontend application.
-- Connect to PostgreSQL as superuserCREATE DATABASE csp;CREATE DATABASE eti;CREATE DATABASE pii;CREATE DATABASE cnf;CREATE DATABASE com;CREATE DATABASE tp;CREATE DATABASE usr;CREATE DATABASE rel;CREATE DATABASE rep;CREATE DATABASE prc;CREATE DATABASE eer;-- Create users and grant permissionsCREATE USER sgi_user WITH PASSWORD 'your_secure_password';GRANT ALL PRIVILEGES ON DATABASE csp TO sgi_user;GRANT ALL PRIVILEGES ON DATABASE eti TO sgi_user;GRANT ALL PRIVILEGES ON DATABASE pii TO sgi_user;GRANT ALL PRIVILEGES ON DATABASE cnf TO sgi_user;GRANT ALL PRIVILEGES ON DATABASE com TO sgi_user;GRANT ALL PRIVILEGES ON DATABASE tp TO sgi_user;GRANT ALL PRIVILEGES ON DATABASE usr TO sgi_user;GRANT ALL PRIVILEGES ON DATABASE rel TO sgi_user;GRANT ALL PRIVILEGES ON DATABASE rep TO sgi_user;GRANT ALL PRIVILEGES ON DATABASE prc TO sgi_user;GRANT ALL PRIVILEGES ON DATABASE eer TO sgi_user;
Database schemas are automatically created by Liquibase migrations when you first start each service.
4
Build Backend Services
Build all backend services using Maven:
# Build the parent project and frameworkmvn clean install -DskipTests# Or build specific servicescd sgi-csp-servicemvn clean package -DskipTests
This will:
Compile Java source code
Run annotation processors (Lombok, Hibernate, etc.)
Package services as executable JAR files
Generate build artifacts in target/ directories
5
Run Database Migrations
Database migrations run automatically when services start. For manual execution:
cd sgi-csp-servicemvn liquibase:update
Ensure database connection properties are configured in application.yml before running migrations.
6
Install and Build Frontend
Build the Angular frontend application:
cd sgi-webapp# Install Node.js dependenciesnpm install# Build for developmentnpm run build# Or build for productionnpm run build-prod
The build output will be in dist/sgi-webapp/.
7
Deploy Frontend with Nginx
Configure Nginx to serve the frontend:
server { listen 80; server_name your-domain.com; root /usr/share/nginx/html; index index.html; location / { try_files $uri $uri/ /index.html; } # Proxy API requests to backend services location /api/csp { proxy_pass http://sgi-csp-service:8080; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; } location /api/eti { proxy_pass http://sgi-eti-service:8080; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; } # Add similar blocks for other services... location /auth { proxy_pass http://sgi-auth:8080/auth; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; }}
# Start a service with the production profilejava -jar sgi-csp-service/target/sgi-csp-service-1.1.0-SNAPSHOT-exec.jar \ --spring.profiles.active=prod# Or use Spring Boot Maven plugin for developmentcd sgi-csp-servicemvn spring-boot:run -Dspring-boot.run.profiles=dev
Services expose port 8080 by default. Configure different ports using server.port property.
# First, unpack the JAR for Docker layerscd sgi-csp-servicemvn dependency:unpack -Dartifact=io.github.herculesproject.sgi:sgi-csp-service:1.1.0-SNAPSHOT:jar:exec -DoutputDirectory=target/dependency# Build the Docker imagedocker build -t sgi-csp-service:1.1.0 .