Skip to content

Configuration Repository

Andrey Popov edited this page Apr 12, 2023 · 20 revisions

Repository configuration

Artipie repository configuration is a yaml file, where repository type and artifacts storage are required to be specified:

repo:
  type: maven
  storage: 
    type: fs
    path: /tmp/artipie/data

type specifies the type of the repository (all supported types are listed below) and storage configures a storage to store repository data. Check policy section and learn how to set permissions to upload or download from repository for users.

Warning
Name of the repository configuration file is the name of the repository.

Supported repository types

For now Artipie supports the following repository types:

Type Description
Files General purpose files repository
Files Proxy Files repository proxy
Maven Java artifacts and dependencies repository
Maven Proxy Proxy for maven repository
Rpm .rpm (linux binaries) packages repository
Docker Docker images registry
Docker Proxy Proxy for docker repository
Helm Helm charts repository
Npm JavaScript code sharing and packages store
Npm Proxy Proxy for NPM repository
Composer Dependency manager for PHP packages
NuGet Hosting service for .NET packages
Gem RubyGem hosting service
PyPI Python packages index
PyPI Proxy Proxy for Python repository
Go Go packages storages
Debian Debian linux packages repository
Anaconda Built packages for data science
HexPM Package manager for Elixir and Erlang

Detailed configuration for each repository is provided in the corresponding subsection below.

Single repository on port

Artipie repositories may run on separate ports if configured. This feature may be especially useful for Docker repository, as it's API is not well suited to serve multiple repositories on single port.

To run repository on its own port port parameter should be specified in repository configuration YAML as follows:

repo:
  type: <repository type>
  port: 54321
  ...

Warning
Artipie scans repositories for port configuration only on start, so server requires restart in order to apply changes made in runtime.

Filters

Artipie provides means to filter out resources of a repository by specifying patterns of resource location. The filtering patterns should be specified in filters section of YAML repository configuration. Two list of filtering patterns can be specified inside filters section:

  • include list of patterns of allowed resources.
  • exclude list of patterns of forbidden resources.
filters:
  include:
    ...
  exclude:
    ...

Each http-request to repository resource is controlled by filters. The following rules are used to get access to repository resource:

  • Repository resource is allowed if it matches at least one of patterns in the include list and does not match any of patterns in the exclude list.
  • Repository resource is forbidden if it matches at least one of patterns in the exclude list or both list of patterns include and exclude are empty.

Artipie provides out-of-the-box pattern matching types:

  • glob patterns specify sets of resource locations with wildcard characters. Description of platform specific glob syntax is here
  • regexp patterns specify sets of resource locations with regular expression syntax

Each of pattern matching types can be defined as separate YAML-section inside include and exclude sections: glob and regexp sections should contain list of filters corresponding type of patter syntax.

filters:
  include:
    glob:
      - filter: '**/org/springframework/**/*.jar'
      - filter: '**/org/apache/logging/log4j/log4j-core/**/*.jar'
        priority: 10
    regexp:
      - filter: '.*/com/artipie/.*\.jar'  
      - filter: '.*/com/artipie/.*\.zip\?([^&]+)&(user=M[^&]+).*'  
  exclude:
    glob:
      - filter: '**/org/apache/logging/log4j/log4j-core/2.17.0/*.jar'
    ...

Filters are ordered by definition order or/and priority. Each filter can include a priority field that should contain numeric value of filter priority. The default value of priority is zero.

The usage of filter's priority allows to organize filters as ordered sequence of filters. Internally filtering algorithm searches first matched filter in each list of filters(include and exclude) so usage of ordering can be useful here.

Glob-filter

Glob-filter uses path part of request for matching.

Yaml format:

  • filter: globbing expression. It is mandatory and value contains globbing expression for request path matching. The value should be quoted to be compatible with YAML-format.
  • priority: priority value. It is optional and provides priority value. Default value is zero priority.

Regexp-filter

Regexp-filter uses path part of request or full URI for matching.

Yaml format:

  • filter: regular expression. It is mandatory and value contains regular expression for request matching. The value should be quoted to be compatible with YAML-format.
  • priority: priority value. It is optional and provides priority value. Default is zero priority.
  • full_uri: is a Boolean value. It is optional with default value 'false' and implies to match with full URI or path part of URI.
  • case_insensitive: is a Boolean value. It is optional with default value 'false' and implies to ignore case in regular expression matching.

Custom filter type

Custom filter types are supported by Artipie.

The following steps are required to implement new filter type:

  • Provide custom implementation of filter type by extending com.artipie.http.filter.Filter interface and to define custom filtering logic inside of method check(RequestLineFrom line, Iterable<Map.Entry<String, String>> headers). The Method check should return true if filter matches.
  • Provide custom implementation of filter factory by extending com.artipie.http.filter.FilterFactory and to annotate by name of new filter type (like annotation values glob and regexp are used in GlobFilterFactory and RegexpFilterFactory accordingly). This annotation's value should be specified as new pattern type inside include and exclude YAML-sections.
  • Assemble jar-file and add it to Artipie's classpath

See examples of classes GlobFilter, GlobFilterFactory, RegexpFilter and RegexpFilterFactory in com.artipie.http.filter package.

Clone this wiki locally