Best way to synchronize another Nexus 3 repository

4,819 views
Skip to first unread message

Patrick D

unread,
Nov 17, 2016, 5:17:26 PM11/17/16
to Nexus Users
My team is running two Nexus 3 instances. One that is connected to a network that has public internet access. The other does not have direct access to the network with public internet access or the Nexus instance running there. The only connection between these two networks is effectively an FTP.  My plan was to try and run a cron job on the system running Nexus on the public internet instance to find all assets added since the last run, FTP the files up, have a staggered cron job that would look for new files in the FTP and then import them in to the "closed" Nexus server.

Is this something I could do with the Groovy script to at least get a list of new assets and then dump that list of direct URLs out so that I could download them? So far for node packages, I manually copy the node_modules folder for each project after doing a fresh npm install to the FTP, unpack that folder on the closed side, and then I have written a script that walks all of the packages we have for each of our projects and does an npm publish to the closed Nexus repo. The end result is that the user running the script appears as the publisher, which we really don't care about, but are all available on the closed nexus instance.

I am open to any suggestions.

Thanks,
Patrick

Patrick D

unread,
Nov 18, 2016, 12:26:33 PM11/18/16
to Nexus Users

I believe I have discovered a solution, somewhat hacky but it might check some other boxes I needed to check.

1) Setup a webhook for the repositories I need
2) This will POST to a simple app that essentially takes the payload which contains json with a timestamp, repositoryName, name (artifact name), version
3) On a cron schedule pull everything greater than the last successful transfer via a curl using the URL that can be built from the info posted in the web hook
4) Ship these through the FTP
5) On the other instance have  cron that picks these up and does the proper publish depending on the artifact type

If anyone has a simpler way or other suggestions feel free to chime in. It would be great if there was a REST api that would allow me to query the artifacts and also publish them manually regardless of the artifact type (JavaScript, Java, Python) instead of having to use the tool.

gaze

unread,
Aug 31, 2017, 11:31:11 AM8/31/17
to Nexus Users
Hi,

I have two nexus repositories, One with internet the other without internet. I am having trouble to sync the repositories. Initially i just copy and paste the directory "sonatype-work\nexus3\db\component" but as the number of artifacts increase, this way is not feasible. 
May i see the code on how you did it as mentioned in previous post? 

Andrey Pirovskikh

unread,
Jan 17, 2018, 6:28:52 AM1/17/18
to Nexus Users
Interesting solution, I have to make something like this. May I see ttho code

четверг, 31 августа 2017 г., 18:31:11 UTC+3 пользователь gaze написал:

Paul French

unread,
Jan 17, 2018, 8:12:17 AM1/17/18
to Andrey Pirovskikh, Nexus Users
I'm not a nexus3 user yet (still on nexus2) but if the two nexus instances can see each other then you would setup one repo as a proxy of the other. That way nexus will maintain the proxy repo for you and will only pull down artifacts as and when requested from the main repo.

If only specific ports are open between the instances then can't you use a standard sync tool e.g. rsync or if has to be ftp then one of the ftp sync tools out there.

Cheers

--
You received this message because you are subscribed to the Google Groups "Nexus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nexus-users+unsubscribe@glists.sonatype.com.
To post to this group, send email to nexus...@glists.sonatype.com.
To view this discussion on the web visit https://groups.google.com/a/glists.sonatype.com/d/msgid/nexus-users/6f3ed59d-ee22-4c9b-abf1-aa0cecf52aa0%40glists.sonatype.com.
For more options, visit https://groups.google.com/a/glists.sonatype.com/d/optout.



--

Paul French
Senior Technical Consultant
07803 122058
paul....@kirona.com

Confidentiality Notice & Disclaimer

Reply all
Reply to author
Forward
Message has been deleted
0 new messages