yaam

YAAM

CI GoDoc Widget GitHub go.mod Go version Go Report Card StackOverflow SE Questions DevOps SE Questions ServerFault SE Questions Docker Pulls Docker Image Size (latest semver) Issues Pull requests Total downloads GitHub forks GitHub watchers GitHub stars License Repository Size Contributors Commit activity Last commit Release date GitHub release (latest SemVer) Bugs Code Smells Coverage Duplicated Lines (%) Lines of Code Maintainability Rating Quality Gate Status Reliability Rating Security Rating Technical Debt Vulnerabilities codecov GolangCI Chocolatey yaam codebeat badge Conventional Commits semantic-release

Although there are many artifact managers, like Artifactory, Nexus3 and Verdaccio, they are either monoliths, consume a lot of resources (memory and CPU), lack Infrastructure as Code (IaC) or do not support all kind of artifact types. Yet Another Artifact Manager (YAAM):

Quickstart

Create a directory and change the permissions to ensure that YAAM can store artifacts:

mkdir ~/.yaam/repositories
sudo chown 9999 -R ~/.yaam/repositories

Configure YAAM by creating a ~/.yaam/config.yml with the following content:

---
caches:
  apt:
    3rdparty-ubuntu-nl-archive:
      url: http://nl.archive.ubuntu.com/ubuntu/
  maven:
    3rdparty-maven:
      url: https://repo.maven.apache.org/maven2/
    3rdparty-maven-gradle-plugins:
      url: https://plugins.gradle.org/m2/
    3rdparty-maven-spring:
      url: https://repo.spring.io/release/
    other-nexus-repo-releases:
      url: https://some-nexus/repository/some-repo/
      user: some-user
      pass: some-pass
  npm:
    3rdparty-npm:
      url: https://registry.npmjs.org/
groups:
  maven:
    hello:
      - maven/releases
      - maven/3rdparty-maven
      - maven/3rdparty-maven-gradle-plugins
      - maven/3rdparty-maven-spring
publications:
  generic:
    - something
  maven:
    - releases
  npm:
    - 3rdparty-npm

Start YAAM:

docker run \
  -e YAAM_LOG_LEVEL=trace \
  -e YAAM_USER=hello \
  -e YAAM_PASS=world \
  --rm \
  --name=yaam \
  -it \
  -v /home/${USER}/.yaam:/opt/yaam/.yaam \
  -p 25213:25213 utrecht/yaam:v0.5.4

Once YAAM has been started, configure a project to ensure that artifacts will be downloaded from this artifact manager.

Apt

sudo vim /etc/apt/auth.conf.d/hello.conf

machine http://localhost
login hello
password world

sudo vim /etc/apt/sources.list

deb http://localhost:25213/apt/3rdparty-ubuntu-nl-archive/ focal main restricted

Preserve the artifacts:

sudo apt-get update

Generic

Upload:

curl -X POST -u hello:world \
http://yaam.some-domain/generic/something/world4.iso \
--data-binary @/home/${USER}/Downloads/ubuntu-22.04.1-desktop-amd64.iso

Troubleshooting:

413 Request Entity Too Large

add:

data:
  proxy-body-size: 5G

and restart the controller pod.

Verify in the /etc/nginx/nginx.conf file that the client_max_body_size has been increased to 5G.

Download:

curl -u hello:world http://yaam.some-domain/generic/something/world6.iso \
-o /tmp/world6.iso

Gradle

Adjust the build.gradle and/or settings.gradle:

repositories {
  maven {
    allowInsecureProtocol true
    url 'http://localhost:25213/maven/releases/'
    authentication {
      basic(BasicAuthentication)
    }
    credentials {
      username "hello"
      password "world"
    }
  }
  maven {
    allowInsecureProtocol true
    url 'http://localhost:25213/maven/3rdparty-maven/'
    authentication {
      basic(BasicAuthentication)
    }
    credentials {
      username "hello"
      password "world"
    }
  }
  maven {
    allowInsecureProtocol true
    url 'http://localhost:25213/maven/3rdparty-maven-gradle-plugins/'
    authentication {
      basic(BasicAuthentication)
    }
    credentials {
      username "hello"
      password "world"
    }
  }
}

Publish:

publishing {
  publications {
    mavenJava(MavenPublication) {
      versionMapping {
        usage('java-api') {
          fromResolutionOf('runtimeClasspath')
        }
        usage('java-runtime') {
          fromResolutionResult()
        }
      }
    }
  }

  repositories {
    maven {
        allowInsecureProtocol true
        url 'http://localhost:25213/maven/releases/'
        authentication {
          basic(BasicAuthentication)
        }
        credentials {
          username "hello"
          password "world"
        }
    }
  }
}

Preserve the artifacts:

./gradlew clean

or publish them:

./gradlew publish

NPM

Create a .npmrc file in the directory of a particular NPM project:

registry=http://localhost:25213/npm/3rdparty-npm/
always-auth=true
_auth=aGVsbG86d29ybGQ=
cache=/tmp/some-yaam-repo/npm/cache20220914120431999

Note: the _auth key should be populated with the output of: echo -n 'someuser:somepass' | openssl base64.

npm i -d

Run

Next to docker, one could also use a binary or K8s or OpenShift to run YAAM:

Other