Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When try upload docker(hosted) repository from backup he was not uploaded #571

Open
vvvvvvch opened this issue Apr 26, 2024 · 3 comments
Open
Labels
bug Something isn't working pinned

Comments

@vvvvvvch
Copy link

What happened:

We has two nexus3 - old and new. We try create backup docker(hosted) repository from nexus.old and upload to nexus.new.
For this used https://github.com/030/n3dr/blob/main/cmd/n3dr/repositoriesV2.go#L63C98-L63C111

First, create backup

n3dr repositoriesV2 -u admin -p admin -n nexus.old \
    --dockerPort 8445 --dockerHost http://nexus.old \
    --showLogo=false --logFile ./std-out-backup-docker.log --logLevel=debug \
    --backup --directory-prefix ./nx --n3drRepo nx_docker_hosted

The command executed without errors. Something has downloaded.
In nexus.new create docker(hosted) repository "nx_docker_hosted" and execute script

n3dr repositoriesV2 -u admin -p admin -n nexus.new \
    --showLogo=false --logFile ./std-out-upload-docker.log --logLevel=debug --https=false \
    --upload --directory-prefix ./nx/

Command write this in log and nothing uploaded

time="2024-04-23T12:37:04+03:00" level=info msg="found the following localDiskRepos: '[nx_docker_hosted]'" func="github.com/030/n3dr/internal/app/n3dr/artifactsv2/upload.(*Nexus3).reposOnDisk" file="/home/runner/work/n3dr/n3dr/internal/app/n3dr/artifactsv2/upload/upload.go:84"
time="2024-04-23T12:37:04+03:00" level=info msg="Uploading files to Nexus: 'nexus.da.lan' repository: 'nx_docker_hosted'..." func="github.com/030/n3dr/internal/app/n3dr/artifactsv2/upload.(*Nexus3).uploadArtifactsSingleDir" file="/home/runner/work/n3dr/n3dr/internal/app/n3dr/artifactsv2/upload/upload.go:717"
time="2024-04-23T12:37:05+03:00" level=info msg="format of repo: 'nx_docker_hosted' is: '' and repoType: ''" func="github.com/030/n3dr/internal/app/n3dr/artifactsv2/upload.(*Nexus3).repoFormatLocalDiskRepo" file="/home/runner/work/n3dr/n3dr/internal/app/n3dr/artifactsv2/upload/upload.go:113"
time="2024-04-23T12:37:05+03:00" level=error msg="repoFormat not detected. Verify whether repo: 'nx_docker_hosted' resides in Nexus" func="github.com/030/n3dr/internal/app/n3dr/artifactsv2/upload.(*Nexus3).uploadArtifactsSingleDir" file="/home/runner/work/n3dr/n3dr/internal/app/n3dr/artifactsv2/upload/upload.go:733"
time="2024-04-23T12:37:05+03:00" level=debug msg="n3dr was running for: '88.28997ms'" func=main.execute.func1 file="/home/runner/work/n3dr/n3dr/cmd/n3dr/root.go:64"

What you expected to happen:

  1. n3dr should(?) create backup of docker(hosted) repository
  2. n3dr should(?) upload from backup to new docker(hosted) repository

Backup\upload docker repositories is supported by n3dr or I do something wrong?

How to reproduce it (as minimally and precisely as possible):

Anything else we need to know?:

nexus.old and nexus.new - two separate servers
all scripts are executed from "same as nexus server" linux machine (not in a nexus servers)

Environment:

  • nexus version: OSS 3.43.0-01 (new), OSS 3.29.2-02 (old)
  • n3dr version (use n3dr -v): n3dr version refs/tags/7.5.2 (installed from snap)
  • OS (e.g: cat /etc/os-release): ubuntu 22.04 lts server
  • Kernel (e.g. uname -a):
  • Others:
@vvvvvvch vvvvvvch added the bug Something isn't working label Apr 26, 2024
@030 030 added the pinned label Apr 26, 2024
@030
Copy link
Owner

030 commented Apr 26, 2024

@vvvvvvch Did you create the docker repository in your new nexus server? Could you check this doc?

@vvvvvvch
Copy link
Author

@030 Yes, repository created and I try backup\upload right like in docker.md

If this help, that is my steps

  1. Create repository in new nexus server with the same name like in old nexus server (with the same repo settings)
  2. execute script below
#!/bin/bash

## Nexus variable
nx_user="admin"
nx_pwd="admin"
nx_url="nexus.old"
nx_backup_prefix="./nxbackup"
nx_brepo_name="nx_docker_hosted"

nx2_user="admin"
nx2_pwd="admin"
nx2_url="nexus.new"
nx_upload_dir="./nxupload/"

nx_dport="8446"
nx_dhost="https://nexus.old"
nx2_dhost="https://nexus.new"

flogs="./std-out-nx-temp.log"

nx_backup(){
    n3dr repositoriesV2 -u $nx_user -p $nx_pwd -n $nx_url \
        --dockerPort $nx_dport --dockerHost $nx_dhost \
        --showLogo=false --logFile $flogs --logLevel=debug --https=false \
        --backup --directory-prefix $nx_backup_prefix --n3drRepo $nx_brepo_name
}

nx_upload(){
    n3dr repositoriesV2 -u $nx2_user -p $nx2_pwd -n $nx2_url \
        --showLogo=false --logFile $flogs --logLevel=debug --https=false \
        --dockerPort $nx_dport --dockerHost $nx2_dhost \
        --upload --directory-prefix $nx_upload_dir
}

nx_backup
mv "$nx_backup_prefix/$nx_brepo_name" "$nx_upload_dir"
nx_upload

Everything seems to be the same as described in the documentation

Debug Log: n3dr-backup-upload.log

But I don’t understand, is this a problem with the script or something with the code? What also confuses me is that the size of the backup copy of docker repository is in Kb.

030 added a commit that referenced this issue Apr 27, 2024
030 added a commit that referenced this issue Apr 27, 2024
030 added a commit that referenced this issue Apr 27, 2024
030 added a commit that referenced this issue Apr 27, 2024
030 added a commit that referenced this issue Apr 27, 2024
030 added a commit that referenced this issue Apr 27, 2024
030 added a commit that referenced this issue Apr 27, 2024
030 added a commit that referenced this issue Apr 27, 2024
@vvvvvvch
Copy link
Author

One small question about backup docker repositories

When I backup repo, who contain images with command

n3dr repositoriesV2 -u $nx_user -p $nx_pwd -n $nx_url \
        --dockerPort $nx_dport --dockerHost $nx_dhost \
        --showLogo=false --logFile $flogs --logLevel=debug --https=false \
        --backup --directory-prefix $nx_backup_prefix --n3drRepo $nx_brepo_name

What I should get in backup directory? I has only some manifests from repository, not images.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working pinned
Projects
None yet
Development

No branches or pull requests

2 participants