Skip to content

Commit

Permalink
Merge pull request #45 from 030/24-caches
Browse files Browse the repository at this point in the history
fix(preserve): [#24] NPM and Maven caches yml should be separated.
  • Loading branch information
030 authored Oct 16, 2022
2 parents 9c3a5b1 + fdacfda commit 537838d
Show file tree
Hide file tree
Showing 87 changed files with 1,558 additions and 1,193 deletions.
3 changes: 1 addition & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
test/gradle/demo
test/npm/demo
test/testdata
2 changes: 1 addition & 1 deletion .github/workflows/dip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
chmod +x /tmp/git-chglog
/tmp/git-chglog -o docs/CHANGELOG.md --config configs/chglog/config.yml --next-tag ${tag}
echo "Checking README.md..."
sed -i "s|\(yaam:\).*|\1${tag}|" docs/start/DOCKER.md
sed -i "s|\(yaam:\).*|\1${tag}|" README.md
echo "Checking k8s-openshift deployment..."
sed -i "s|\(yaam:\).*|\1${tag}|" deployments/k8s-openshift/deploy.yml
- uses: EndBug/add-and-commit@v9
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ name: Go
jobs:
build:
runs-on: ubuntu-20.04
timeout-minutes: 25
steps:
- uses: actions/checkout@v2
- name: Set up Go
Expand All @@ -19,8 +18,9 @@ jobs:
with:
node-version: 14
- name: Unit tests
timeout-minutes: 20
run: |
go test -short -cover -v -coverprofile=coverage.txt \
go test -timeout=20m -short -cover -v -coverprofile=coverage.txt \
-covermode=atomic ./...
- uses: codecov/codecov-action@v1
with:
Expand All @@ -33,9 +33,9 @@ jobs:
args: >
-Dsonar.organization=030-github
-Dsonar.projectKey=030_yaam
-Dsonar.exclusions=internal/goswagger/**,test/gradle/demo/**,test/npm/demo/**
-Dsonar.exclusions=test/testdata/**
-Dsonar.sources=.
-Dsonar.coverage.exclusions=**/*_test.go,internal/goswagger/**/*,test/gradle/demo/**,test/npm/demo/**
-Dsonar.coverage.exclusions=**/*_test.go,test/testdata/**
-Dsonar.verbose=true
-Dsonar.go.coverage.reportPaths="coverage.txt"
env:
Expand All @@ -57,4 +57,4 @@ jobs:
README.md -s /data/configs/.markdownlint.rb
docker run --rm -v $(pwd):/app -w /app -e GOFLAGS=-buildvcs=false \
golangci/golangci-lint:v1.49.0-alpine golangci-lint run -v \
--timeout 2m30s
--timeout 2m30s --config configs/.golangci.yml
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
version=$(echo "${{ github.ref }}" | sed -e "s|.*\/\(.*\)$|\1|")
echo "Version: ${version}"
echo "Checking README.md..."
grep "yaam:${version}" docs/start/DOCKER.md
grep "yaam:${version}" README.md
echo "Checking k8s-openshift deployment..."
grep "yaam:${version}" deployments/k8s-openshift/deploy.yml
- name: Create release
Expand Down
14 changes: 7 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ dip

cmd/yaam/yaam

test/gradle/demo/.gradle
test/gradle/demo/build
test/gradle/demo/build.gradle
test/gradle/demo/settings.gradle
test/testdata/gradle/demo/.gradle
test/testdata/gradle/demo/build
test/testdata/gradle/demo/build.gradle
test/testdata/gradle/demo/settings.gradle

test/npm/demo/node_modules
test/npm/demo/.npmrc
test/npm/demo/package-lock.json
test/testdata/npm/demo/node_modules
test/testdata/npm/demo/.npmrc
test/testdata/npm/demo/package-lock.json
247 changes: 224 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,44 +52,245 @@ of artifact types. Yet Another Artifact Manager (YAAM):
- has no UI.
- does not have a database.
- scales horizontally.
- supports downloading and publication of Generic, Maven and NPM artefacts,
preserves NPM and Maven packages from public repositories and unifies Maven
repositories.
- supports downloading and publication of Apt, Generic, Maven and NPM
artefacts, preserves NPM and Maven packages from public repositories and
unifies Maven repositories.

## Configuration
## Quickstart

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

- [Base.](docs/config/BASE.md)
```bash
mkdir ~/.yaam/repositories
sudo chown 9999 -R ~/.yaam/repositories
```

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

- [Generic.](docs/config/GENERIC.md)
- [Maven.](docs/config/MAVEN.md)
- [NPM.](docs/config/NPM.md)
```bash
---
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
Start YAAM:

- [Binary.](docs/start/BINARY.md)
- [Docker.](docs/start/DOCKER.md)
- [K8s/OpenShift.](docs/start/K8SOPENSHIFT.md)
```bash
docker run \
-e YAAM_DEBUG=false \
-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.0
```

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

```bash
machine http://localhost
login hello
password world
```

sudo vim /etc/apt/sources.list

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

Preserve the artifacts:

```bash
sudo apt-get update
```

### Generic

Upload:

```bash
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:

```bash
413 Request Entity Too Large
```

add:

```bash
data:
proxy-body-size: 5G
```

## Capabilities
and restart the controller pod.

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

- [Generic.](docs/publish/GENERIC.md)
- [Maven.](docs/publish/MAVEN.md)
Download:

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

- [Maven.](docs/preserve/MAVEN.md)
- [NPM.](docs/preserve/NPM.md)
### Gradle

### Unify
Adjust the `build.gradle` and/or `settings.gradle`:

- [Maven.](docs/unify/MAVEN.md)
```bash
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:

```bash
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:

```bash
./gradlew clean
```

or publish them:

```bash
./gradlew publish
```

### NPM

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

```bash
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`.

```bash
npm i -d
```

## Run

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

- [Binary.](docs/start/BINARY.md)
- [K8s/OpenShift.](docs/start/K8SOPENSHIFT.md)

## Other

- [Background.](docs/other/BACKGROUND.md)
- [Maven unify.](docs/other/MAVEN.md)
Loading

0 comments on commit 537838d

Please sign in to comment.