Skip to content

paulodamaso/artipie-artipie

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EO principles respected here DevOps By Rultor.com We recommend IntelliJ IDEA

Build Status Javadoc License Hits-of-Code Maven Central PDD status

Artipie is an experimental binary artifact management tool, similar to Artifactory, Nexus, Archiva, ProGet, and many others. The following set of features makes Artipie unique among all others:

The fastest way to start using Artipie is via Docker. First, create a new directory artipie and repo sub-directory inside it. Then, put your YAML config file into the repo sub-dir. Make sure that the name of your config file is the name of repository you are going to host, and its name matches [a-z0-9_]{3,32}. For example foo.yaml:

repo:
  type: maven
  storage:
    type: fs
    path: /var/artipie

Now, go back to artipie and start the container:

$ docker run -v "$(pwd):/var/artipie" -p 8080:80 artipie/artipie

You should be able to use it with Maven at http://localhost:8080.

In the sections below you can see how to configure Artipie to use it with different package managers.

We recommend you read the "Architecture" section in our White Paper to fully understand how Artipie is designed.

Binary Repo

Try this repo.yaml file:

repo:
  type: file
  storage:
    type: fs
    path: /var/artipie/storage

You can send HTTP PUT/GET requests to http://localhost:8080/repo/<filename> to upload/download a binary file, e.g. http://localhost:8080/repo/libsqlite3.so.

Maven Repo

Try this maven.yaml file to host a Maven repo:

repo:
  type: maven
  storage:
    type: fs
    path: /var/artipie/maven
  permissions:
    admin:
      - upload
      - download
    jeff:
      - upload
      - download
    "*":
      - download

Add <distributionManagement> section to your pom.xml (don't forget to specify authentication credentials in ~/.m2/settings.xml for artipie server):

<project>
  [...]
  <distributionManagement>
    <snapshotRepository>
      <id>artipie</id>
      <url>http://localhost:8080/maven</url>
    </snapshotRepository>
    <repository>
      <id>artipie</id>
      <url>http://localhost:8080/maven</url>
    </repository>
  </distributionManagement>
</project>

Then, mvn deploy your project.

Add <repository> and <pluginRepository> to your pom.xml (alternatively configure it via ~/.m2/settings.xml) to use deployed artifacts:

<project>
  [...]
  <pluginRepositories>
    <pluginRepository>
      <id>artipie</id>
      <name>artipie plugins</name>
      <url>http://localhost:8080/maven</url>
    </pluginRepository>
  </pluginRepositories>
  <repositories>
    <repository>
      <id>artipie</id>
      <name>artipie builds</name>
      <url>http://localhost:8080/maven</url>
    </repository>
  </repositories>
</project>

Run mvn install (or mvn install -U to force download dependencies).

Maven proxy Repo

Try this maven-central.yaml file to host a proxy to Maven central:

repo:
  type: maven-proxy
  storage: default

Artipie will redirect all Maven requests to Maven central. Add it as a mirror to settings.xml:

<settings>
  <mirrors>
    <mirror>
      <id>artipie-mirror</id>
      <name>Artipie Mirror Repository</name>
      <url>https://central.artipie.com/mirrors/maven-central</url>
      <mirrorOf>central</mirrorOf>
    </mirror>
  </mirrors>
</settings>

RPM Repo

Create new directory /var/artipie, directory for configuration files /var/artipie/repo and directory for RPM repository /var/artipie/centos. Put repository config file to /var/artipie/repo/centos.yaml:

repo:
  type: rpm
  storage:
    type: fs
    path: /var/artipie/centos
  settings:
    digest: sha256 # Digest algorithm for rpm packages checksum calculation, sha256 (default) and sha1 are supported
    naming-policy: sha1 # Naming policy for metadata files: plain, sha1 or sha256 (default) prefixed
    filelists: true # Calculate metadata filelists.xml, true by default
      

Put all RPM packages to repository directory: /var/artipie/centos/centos.

Optional: generate metadata using CLI tool.

Start Artipie Docker image:

$ docker run -v /var/artipie:/var/artipie artipie/artipie

On the client machine add local repository to the list of repos:

  • Install yum-utils if needed: yum install yum-utils
  • Add repository: yum-config-manager --add-repo=http://yourepo/
  • Refresh the repo: yum upgrade all
  • Download packages: yum install package-name

NPM Repo

Try this npm.yaml file:

repo:
  type: npm
  path: /npm
  storage:
    type: fs
    path: /tmp/artipie/data/npm
  permissions:
    john:
      - download
      - upload
    jane:
      - upload

To publish your npm project use the following command:

$ npm publish --registry=http://localhost:8080/npm

NPM Proxy Repo

Try this npm-proxy.yaml file:

repo:
  type: npm-proxy
  path: npm-proxy
  storage:
    type: fs
    path: /tmp/artipie/data/npm-proxy
  settings:
    remote:
      url: https://registry.npmjs.org

To use it for downloading packages use the following command:

$ npm install --registry=http://localhost:8080/npm-proxy <package name>

or set it as a default repository:

$ npm set registry http://localhost:8080/npm-proxy

Go Repo

Try this go.yaml file:

repo:
  type: go
  path: go
  storage:
    type: fs
    path: /tmp/artipie/data/go
  permissions:
    admin:
      - "*"
    "*":
      - download

To use it for installing packages add it to GOPROXY environment variable:

$ export GOPROXY="http://localhost:8080/go,https://proxy.golang.org,direct"

Go packages have to be located in the local repository by their names and versions, contain Go module and dependencies information in .mod and .info files. Here is an example for package example.com/foo/bar versions 0.0.1 and 0.0.2:

/example.com
  /foo
    /bar
      /@v
        list
        v0.0.1.zip
        v0.0.1.mod
        v0.0.1.info
        v0.0.2.zip
        v0.0.2.mod
        v0.0.2.info

list is simple text file with list of the available versions. You can use go-adapter to generate necessary files and layout for Go source code.

PHP Composer Repo

Try this my-php.yaml file:

repo:
  type: php
  path: my-php
  storage:
    type: fs
    path: /tmp/artipie/data/my-php

To publish your PHP Composer package create package description JSON file my-package.json with the following content:

{
  "name": "my-org/my-package",
  "version": "1.0.0",
  "dist": {
    "url": "https://www.my-org.com/files/my-package.1.0.0.zip",
    "type": "zip"
  }
}

And add it to repository using PUT request:

$ curl -X PUT -T 'my-package.json' "http://localhost:8080/my-php"

To use this library in your project add requirement and repository to composer.json:

{
    "repositories": [
         {"type": "composer", "url": "http://localhost:8080/my-php"}
    ],
    "require": {
        "my-org/my-package": "1.0.0"
    }
}

NuGet Repo

Try this nuget.yaml file:

repo:
  type: nuget
  path: my-nuget
  url: http://localhost:8080/my-nuget
  storage:
    type: fs
    path: /tmp/artipie/data/my-nuget

To publish your NuGet package use the following command:

$ nuget push my.lib.1.0.0.nupkg -Source=http://localhost:8080/my-nuget/index.json

To install the package into a project use the following command:

$ nuget install MyLib -Version 1.0.0 -Source=http://localhost:8080/my-nuget/index.json

Gem Repo

Try this gem.yaml file:

repo:
  type: gem
  storage:
    type: fs
    path: /tmp/artipie/data/my-nuget

Publish a gem:

$ gem push my_first_gem-0.0.0.gem --host http://localhost:8080/gem

Install a gem:

$ gem install my_first_gem --source http://localhost:8080/gem

Helm chart repo

Try this helm.yaml file:

repo:
  type: helm
  storage:
    type: fs
    path: /tmp/artipie/data/helm-charts

Publish a chart:

$ curl --data-binary "@my_chart-1.6.4.tgz" http://localhost:8080/helm

Install a chart:

$ helm repo add artipie http://localhost:8080/helm/charts
$ helm install my_chart artipie

Docker Repo

Try this docker.yaml file:

repo:
  type: docker
  storage:
    type: fs
    path: /tmp/artipie/data/my-docker

Docker registry has to be protected by HTTPS and should have no prefix in path. In order to access this Docker repository it is required to run a reverse proxy such as nginx or lighttpd to protect Artipie with HTTPS and add forwarding of requests from my-docker.my-company.com/<path> to my-artipie.my-company.com/my-docker/<path>. Then to push your Docker image use the following command:

$ docker push my-docker.my-company.com/my-image

To pull the image use the following command:

$ docker pull my-docker.my-company.com/my-image

Docker Proxy Repo

Try this docker-proxy.yaml file to host a proxy to mcr.microsoft.com registry:

repo:
  type: docker-proxy
  settings:
    host: mcr.microsoft.com

Artipie will redirect all pull requests to specified registry.

Proxy repository supports caching in local storage. To enable it and make previously accessed images available when source repository is down add storage section to config:

repo:
  type: docker-proxy
  settings:
    host: mcr.microsoft.com
  storage:
    type: fs
    path: /tmp/artipie/data/my-docker-cache

Python repo

Try this pypi.yaml file:

repo:
  type: pypi
  storage:
    type: fs
    path: /tmp/artipie/data/python-repo

Publish a package(whl or tar.gz):

  • Install twine utility, if you don't do it already docs.
$ python3 -m pip install --user --upgrade twine
  • build the package, as described in python docs
  • upload to server with a command
$ python3 -m twine upload --repository-url http://localhost:8080/pypi/ -u user.name -p pass testpkg/dist/*

Install a package:

$ pip install --index-url http://localhost:8080/pypi/ testpkg

Additional configuration

Environment variables:

  • SSL_TRUSTALL - trust all unkown certificates

Multitenancy

You may want to run Artipie for your company, which has a few teams. Each team may want to have its own repository. To do this, you create a global configuration file /etc/artipie.yml:

meta:
  layout: org
  storage:
    type: fs
    path: /tmp/artipie/data/my-docker
  credentials:
    type: file
    path: _credentials.yml

If the type is set to file, another YAML file is required in the storage, with a list of users who will be allowed to create repos (each pass is combination or either plain or sha256 and a text):

credentials:
  jane:
    pass: "plain:qwerty"
  john:
    pass: "sha256:xxxxxxxxxxxxxxxxxxxxxxx"

If the type is set to env, the following environment variables are expected: ARTIPIE_USER_NAME and ARTIPIE_USER_PASS. For example, you start Docker container with the -e option:

docker run -d -v /var/artipie:/var/artipie` -p 80:80 \
  -e ARTIPIE_USER_NAME=artipie -e ARTIPIE_USER_PASS=qwerty \
  artipie/artipie:latest

Metrics

You may enable some basic metrics collecting and periodic publishing to application log by adding metrics to meta section of global configuration file /etc/artipie.yml:

meta:
  metrics:
    type: log

How to contribute

Fork the repository, make changes, and send us a pull request. We will review your changes and apply them to the master branch shortly, provided they don't violate our quality standards. To avoid frustration, before sending us your pull request please run full Maven build:

$ mvn clean install -Pqulice

To avoid build errors use Maven 3.2+.

How to run it locally

To run Artipie server locally, build it with mvn clean package -Passembly and run with (change port if needed):

java -jar target/artipie-jar-with-dependencies.jar --config=example/artipie.yaml --port=8080

Example configuration uses org layout of Artipie with two level hierarchy, user test with password 123, and default storage in ./example/storage direcotry. To access the dashboard open http://localhost/test in your browser and enter user credentials.

Thanks to FreePik for the logo.

About

Binary Artifact Management Tool

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 98.0%
  • HTML 1.8%
  • Dockerfile 0.2%