Comprehensive guide to running the application in different modes.
Source Code Portal supports two execution modes:
- Spring Boot Mode (Recommended) - Modern Spring ecosystem with actuator endpoints
- Legacy Undertow Mode (Deprecated) - Standalone Undertow server
Recommendation: Use Spring Boot mode for all new deployments.
Spring Boot is the recommended mode for running the application. It provides modern Spring ecosystem features including dependency injection, auto-configuration, actuator endpoints, and better testability.
mvn spring-boot:runStartup time: ~10-15 seconds Default URL: http://localhost:9090
What happens:
- Spring Boot initializes Spring context
- Loads configuration from
application.ymland property files - Creates beans (CacheStore, ExecutorService, etc.)
- Loads repository configuration from
config.json - Pre-fetches GitHub data (initial cache population)
- Starts embedded Undertow server
mvn spring-boot:run -Dspring-boot.run.profiles=devDev profile enables:
- Debug logging (more verbose)
- Spring Boot DevTools (hot reload)
- Detailed error pages
- Cache statistics in logs
# Build first
mvn clean package
# Run the JAR
java -jar target/source-code-portal-*.jarPros:
- Faster startup (~5-7 seconds)
- No Maven overhead
- Production-ready artifact
Cons:
- Requires rebuild after code changes
- Open project in IntelliJ
- Navigate to
src/main/java/no/cantara/docsite/SpringBootServer.java - Right-click → Run 'SpringBootServer.main()'
Or create Run Configuration:
- Run → Edit Configurations
- Click + → Spring Boot
- Main class:
no.cantara.docsite.SpringBootServer - Active profiles:
dev(optional) - Click OK
Spring Boot supports different profiles for different environments:
mvn spring-boot:run -Dspring-boot.run.profiles=devConfiguration: application-dev.yml or application-dev.properties
Features:
- Debug logging
- Hot reload with DevTools
- Detailed error pages
- SQL logging (if using databases)
- Cache statistics
mvn spring-boot:run -Dspring-boot.run.profiles=prodConfiguration: application-prod.yml or application-prod.properties
Features:
- Optimized logging (INFO level)
- Error handling for production
- Performance optimizations
- Security hardening
mvn spring-boot:run -Dspring-boot.run.profiles=testUsed for:
- Integration testing
- CI/CD pipelines
- Staging environments
mvn spring-boot:run -Dspring-boot.run.profiles=dev,localProfiles are applied in order (later overrides earlier).
You can override any configuration property using environment variables with the SCP_ prefix:
# Set GitHub access token
SCP_GITHUB_ACCESS_TOKEN=your_token mvn spring-boot:run
# Set server port
SERVER_PORT=8080 mvn spring-boot:run
# Set multiple variables
SCP_GITHUB_ACCESS_TOKEN=token \
SERVER_PORT=8080 \
SPRING_PROFILES_ACTIVE=dev \
mvn spring-boot:runNaming convention:
- Spring Boot properties: Use standard names (e.g.,
SERVER_PORT) - Custom properties: Prefix with
SCP_(e.g.,SCP_GITHUB_ACCESS_TOKEN)
Pass JVM arguments for memory, debugging, etc.:
# Increase heap memory
mvn spring-boot:run -Dspring-boot.run.jvmArguments="-Xmx2g"
# Enable remote debugging
mvn spring-boot:run -Dspring-boot.run.jvmArguments="-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005"
# Multiple arguments
mvn spring-boot:run -Dspring-boot.run.jvmArguments="-Xmx2g -XX:+UseG1GC -Duser.timezone=UTC"Pass arguments to the application:
mvn spring-boot:run -Dspring-boot.run.arguments="--server.port=8080 --spring.profiles.active=dev"Spring Boot Actuator provides production-ready features for monitoring and management:
Health Endpoints:
/actuator/health- Overall application health/actuator/health/github- GitHub API rate limit status/actuator/health/cache- Cache health and statistics/actuator/health/executor- Thread pool health
Information Endpoints:
/actuator/info- Application information (version, runtime, configuration)/actuator/metrics- Application metrics (memory, CPU, HTTP requests)/actuator/prometheus- Prometheus-format metrics/actuator/caches- Cache manager details/actuator/scheduledtasks- Scheduled task list
Example usage:
# Check overall health
curl http://localhost:9090/actuator/health
# Check GitHub rate limit
curl http://localhost:9090/actuator/health/github
# View metrics
curl http://localhost:9090/actuator/metrics
# View specific metric
curl http://localhost:9090/actuator/metrics/jvm.memory.usedWeb Pages:
/or/dashboard- Main dashboard/group/{groupId}- Repository group view/contents/{org}/{repo}/{branch}- Repository contents/commits/{org}/{repo}- Commit history/docs- Documentation portal
API Endpoints:
/ping- Simple health check (returns "pong")/health- Legacy health endpoint (prefer/actuator/health)/github/webhook- GitHub webhook receiver
Resource Endpoints:
/badge/{org}/{repo}- Repository badges/css/*,/js/*,/images/*- Static resources
The legacy Undertow mode is still available but deprecated. It will be removed in a future version.
# Build first
mvn clean package
# Run with standalone Undertow
java -cp target/source-code-portal-*.jar no.cantara.docsite.Server- Navigate to
src/main/java/no/cantara/docsite/Server.java - Right-click → Run 'Server.main()'
- ❌ No Spring Boot Actuator endpoints
- ❌ No Spring Boot DevTools (hot reload)
- ❌ No auto-configuration
- ❌ Manual dependency wiring
- ❌ Limited observability
Available endpoints:
/health- Basic health check (no detailed indicators)- Application endpoints (same as Spring Boot mode)
Configuration is loaded in this order (later overrides earlier):
src/main/resources/application-defaults.properties- Default valuesapplication.properties- Custom overridessecurity.properties- Credentials (GitHub tokens)application_override.properties- Final overrides- Environment variables with
SCP_prefix - System properties (
-Dflags)
application.properties:
# Server configuration
server.port=9090
server.compression.enabled=true
# Logging
logging.level.no.cantara.docsite=INFO
logging.level.org.springframework=WARN
# Cache configuration
spring.cache.caffeine.spec=maximumSize=1000,expireAfterWrite=10m
# GitHub configuration
github.repository.visibility=publicsecurity.properties (not in version control):
github.oauth2.client.clientId=YOUR_CLIENT_ID
github.oauth2.client.clientSecret=YOUR_CLIENT_SECRET
github.client.accessToken=YOUR_ACCESS_TOKENSee Configuration Guide for detailed options.
# Terminal 1: Watch Sass files
sass --watch src/main/sass/scss:target/classes/META-INF/views/css
# Terminal 2: Run with dev profile
mvn spring-boot:run -Dspring-boot.run.profiles=devChanges to templates and CSS will reload automatically with Spring Boot DevTools.
mvn clean package
java -jar target/source-code-portal-*.jar --spring.profiles.active=prodmvn spring-boot:run -Dspring-boot.run.arguments="--server.port=8080"
# or
SERVER_PORT=8080 mvn spring-boot:runmvn spring-boot:run -Dspring-boot.run.jvmArguments="-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005"Then attach your IDE debugger to localhost:5005.
Run multiple instances on different ports:
# Terminal 1
SERVER_PORT=9090 mvn spring-boot:run
# Terminal 2
SERVER_PORT=9091 mvn spring-boot:runLook for log message:
Started SpringBootServer in X.XXX seconds
Check endpoints:
# Ping check
curl http://localhost:9090/ping
# Expected: pong
# Health check
curl http://localhost:9090/actuator/health
# Expected: {"status":"UP"}curl http://localhost:9090/actuator/health/githubSuccessful response:
{
"status": "UP",
"details": {
"rateLimit": {
"limit": 5000,
"remaining": 4999,
"reset": "2025-01-28T15:00:00Z"
}
}
}Failed response (missing token):
{
"status": "DOWN",
"details": {
"error": "Unauthorized"
}
}Console output: Most important messages shown in terminal
Log levels:
- ERROR: Critical failures
- WARN: Potential issues (rate limits, timeouts)
- INFO: Normal operations (startup, cache updates)
- DEBUG: Detailed operations (dev profile only)
Enable debug logging:
mvn spring-boot:run -Dspring-boot.run.arguments="--logging.level.no.cantara.docsite=DEBUG"Web server failed to start. Port 9090 was already in use.
Solution 1: Change port
SERVER_PORT=8080 mvn spring-boot:runSolution 2: Kill process using port
# Find process
lsof -i :9090
# Kill it
kill -9 <PID>Symptom: Startup takes >30 seconds
Causes:
- GitHub API slow/timing out
- Large number of repositories to fetch
- Network issues
Solution: Check GitHub health
curl http://localhost:9090/actuator/health/githubjava.lang.OutOfMemoryError: Java heap space
Solution: Increase heap size
mvn spring-boot:run -Dspring-boot.run.jvmArguments="-Xmx2g"Or for JAR:
java -Xmx2g -jar target/source-code-portal-*.jarCheck rate limit status:
curl http://localhost:9090/actuator/health/githubSolution: Ensure GitHub access token is configured (see Configuration Guide).
Symptom: Dashboard shows no data
Check:
- GitHub token configured:
/actuator/health/github - Config.json correct:
src/main/resources/conf/config.json - Cache health:
/actuator/health/cache
Enable debug logging:
mvn spring-boot:run -Dspring-boot.run.arguments="--logging.level.no.cantara.docsite.fetch=DEBUG"java \
-Xmx2g \
-XX:+UseG1GC \
-XX:MaxGCPauseMillis=200 \
-XX:+UseStringDeduplication \
-jar target/source-code-portal-*.jarJava 21 virtual threads are enabled by default, improving I/O performance for GitHub API calls.
Tune cache sizes in application.properties:
spring.cache.caffeine.spec=maximumSize=2000,expireAfterWrite=15m- Configuration Guide - Detailed configuration options
- Operations - Monitoring - Production monitoring
- Operations - Deployment - Deploy to production
- Architecture - Spring Boot - Understand initialization
- Spring Boot documentation: https://docs.spring.io/spring-boot/docs/current/reference/html/
- Spring Boot Actuator: https://docs.spring.io/spring-boot/docs/current/reference/html/actuator.html
- LEARNINGS.md - Runtime gotchas and solutions