Reposilite Documentation
repository·main·Indexed 23 days ago
https://github.com/dzikoysk/reposiliteA backend system written in Kotlin using Javalin, designed with Hexagonal Architecture and Domain Driven Development. It supports various infrastructure targets like SQL databases and AWS S3 storage. The project includes a frontend, a site implementation using Next.js, and a plugin system with core plugins such as swagger-plugin and javadoc-plugin. Documentation covers deployment via Docker Compose, plugin development using lifecycle events, and storage API abstractions like Location and FileDetails.
What's inside Reposilite
- Reposilite (formerly NanoMaven) is a lightweight repository manager designed for Maven artifacts. It serves as a simple, lightweight alternative to enterprise repository managers such as Nexus, Archiva, or Artifactory.
Overview of Reposilite 3.x source components
mainReposilite 3.x is composed of several key modules and external dependencies. If you are looking to contribute or understand the architecture, note the following primary components:
Main Reposilite Repository
- Backend: The core logic of Reposilite.
- Frontend: The dashboard implementation, built using Vue 3.
- Plugins: Official extensions for the Reposilite platform.
- Website: The source for
reposilite.com, built with Next.js (React).
Supporting Libraries (Reposilite Playground)
Reposilite utilizes several utility libraries from the
reposilite-playgroundorganization, including:- Javalin RFCs: Extension methods and coroutine support for the Javalin web framework.
- Javalin OpenApi: Annotation-based OpenAPI implementation supporting Swagger and ReDoc.
- Journalist: A logging abstraction supporting SL4J.
- Exposed Upsert: Adds upsert functionality to the Exposed framework.
Core Dependencies
- Javalin: The underlying web framework.
- CDN: A configuration library used to handle the
.cdnformat. - Expressible: A dependency-free utility library for enhanced response handling in functional codebases.
Available Reposilite Core Plugins
mainReposilite provides several basic plugins maintained alongside the core project to extend its functionality. These include:
- example-plugin: A basic template for creating Reposilite plugins using Java and Gradle KTS.
- groovy-plugin: Enables the scripting API in Groovy, useful for rapid prototyping of scripts.
- javadoc-plugin: Serves
-javadoc.jarfiles as Java documentation pages, accessible at/javadoc/<gav>. - migration-plugin: Facilitates upgrading from Reposilite 2.x by converting the old
tokens.datfile into the JSON schema used in Reposilite 3.x. - swagger-plugin: Exposes a Swagger UI at the
/swaggerpath for the built-in OpenAPI/openapiendpoint.
Manage shared configuration in Reposilite
mainShared configuration defines content that is consistent across all Reposilite instances, such as repositories and frontend customization.
By default, Reposilite stores shared configuration in a database and synchronizes state between instances every 10 seconds using an interval-based approach. This supports hot-reloading of properties.
To modify shared configuration via the web interface:
- Log in to the dashboard with an access token that has management permission.
- Navigate to the Settings tab.
Best practice: Use a reverse proxy for SSL
mainIn most deployment scenarios, it is recommended NOT to configure SSL directly within Reposilite. Instead, serve Reposilite behind a proxy service such as Nginx and handle the SSL termination at the proxy level. This is often a more robust way to bootstrap your infrastructure.Why Reposilite 3.x uses Kotlin instead of Java
mainReposilite 3.x transitioned from Java (used in 1.x and 2.x) to Kotlin to improve the codebase in several ways:
- Consistency: Main sources, tests, and build scripts are fully written in Kotlin, eliminating the need for Groovy.
- Extensibility: By using Kotlin extension functions instead of static utility methods, the project can extend base objects (like those in the Javalin framework) more cleanly.
- Null Safety: Kotlin's language-level support for nullability allows for replacing
Optionaltypes with nullable types, reducing complexity. - Functional Programming: Kotlin provides better syntax and standard library support for functional programming patterns.
- Modern Language Features: Improved generic type implementation and more robust standard library features compared to older JDK versions.
Configure storage providers and mirrors for repositories
mainEach repository can be configured with its own specific backend settings:
- Storage Providers: You can assign different storage backends to different repositories. For example, one repository might use the local filesystem while another uses S3-compatible object storage.
- Mirrors: Reposilite can be configured to mirror (proxy) other external repositories. See the Mirrors Guide for detailed configuration instructions.
Configure repository visibility and access
mainRepositories in Reposilite can have different visibility settings that control how they appear in the dashboard and how they are accessed:
- HIDDEN: The repository will not be visible in the Reposilite dashboard. However, artifacts can still be downloaded (e.g., via Gradle). To see a
HIDDENrepository in the dashboard, you must use a valid access token. - PRIVATE: Interaction with the repository (downloading, indexing, or deploying) is restricted. You must use a valid access token to interact with
PRIVATErepositories.
- HIDDEN: The repository will not be visible in the Reposilite dashboard. However, artifacts can still be downloaded (e.g., via Gradle). To see a
Understand Reposilite configuration layers
mainReposilite uses three distinct configuration layers to manage different types of settings:
- Parameters: Startup configuration passed via program arguments (CLI flags).
- Local configuration: Immutable, file-based configuration for a specific instance (e.g., hostname, port, database connection). It is stored in CDN format.
- Settings (Shared configuration): Mutable state stored in a database that is shared across all Reposilite instances and supports hot-reloading.
Note: Reposilite will automatically generate configuration files during the first startup if it has write permissions to the disk.
Handle null safety in Kotlin
mainInstead of using
Optional<T>wrappers like in Java, Kotlin uses nullable types marked with a?.- Nullable Type:
String?can hold a null value. - Safe Call Operator (
?.): Calls a method only if the receiver is not null; otherwise returns null. - Elvis Operator (
?:): Returns a default value if the preceding expression is null.
val value: String? = "text" // Safe call and default value val isEmpty = value ?.isEmpty() // returns null if value is null ?: true // returns true if previous expression was nullWhen working with collections like Maps, accessing a missing key returns a nullable type:
val map = mapOf("key1" to "value1") // handled is String? val handled: String? = map["key1"] // value is String (non-nullable) due to Elvis operator val value: String = map["key2"] ?: "default"- Nullable Type:
Configure Reposilite configuration modes
mainConfiguration modes determine how Reposilite handles the local configuration file using the CDN library. This is useful for managing updates when new properties are introduced.
Mode Description autoAutomatically processes and updates the configuration file if entries are missing. noneDisables automatic updates; users must update files manually when new properties are introduced. Configure Mirror properties
mainEach proxied repository has individual settings to control how it interacts with the upstream source:
- Link: Specifies the source. Can be a URL (e.g.,
https://repo.maven.apache.org/maven2/) or a Local ID of another local repository (e.g.,releases). - Store: Determines if proxied artifacts are stored locally. Enabling this improves response time and availability at the cost of disk space.
- Storage policy: Controls how metadata is handled. This is a repository-wide setting.
PRIORITIZE_UPSTREAM_METADATA(Default): Attempts to fetch the latest version from the remote repository.STRICT: Prioritizes the cached version over upstream metadata (effectively full offline mode).
- Allowed groups: A list of group IDs (e.g.,
org.reposilite) that are permitted to be proxied. If empty, all groups are allowed. - Allowed extensions: Limits proxied artifacts to specific file extensions. Default allowed extensions include
.jar,.war,.aar,.xml,.pom,.module,.asc,.md5,.sha1,.sha256, and.sha512.
- Link: Specifies the source. Can be a URL (e.g.,