You are viewing...

How to Cheaply Self Host your Maven/Gradle artifacts without Nexus or Artifactory

Updated on February 24, 2020 at the 05th hour
Posted under:

DISCLAIMER: Expressed views on this blog are my own.

Disclaimer: This is more proof of concept than anything else.

I was setting up Sonatype's Nexus yesterday and was very annoyed at the setup ceremony associated with it. I got it working with SystemD's dynamic user, but the way it needs to be setup is insane to me. Why is it so expensive to set up?

I set the DataDir to /var/lib/private/...etc... the state directory for a Dynamic User. Karaf has some java -D options, I tried to move the config and Nexus would not start. I'd get errors like status=254/n/a or 255/Exception with no logs. When I did get it working after relenting on configuration, I tried to move to Java 9+ with the flags in the nexus.vmoptions. Look up a ticket and see it is not priority. Java is on 11 stable at this point. Fuck that, I don't want to run Java 8 anymore. Also, mind you 2GB default. I switched it down to 256mb, but it appears to have elasticsearch embedded in it and some other things that take up more memory than I would like for a single node. I don't need all of that.

I remind myself that certain products are feature driven. I am one person, I don't really want to think much about setting up a repository (file server) at the start of anything. I wanna get a cheap VPS and put a repository on it that's it just like Verdaccio. Me, being me inspired by Verdaccio, I decide to research the idea of how Maven/Gradle do publishing, so I could serve files cheaply.

Apparently one can setup a FTP server and be done with it. It is really that simple and nice. That requires getting a FTP server of course and setting it up etc etc. Not so bad.

One can also use HTTP too, so ok I can create an application. Just need to figure out the protocol/API then. Lol, the protocol is literally HTTP. I was amazed that it just uses HTTP streaming upload to transfer files. I'm surprised no one has created a really cheap version of Nexus or Artifactory in Golang at this point.

I'd rather run many cheap (Verdaccio, Custom Java Artifact repo, yum repo and docker repo) repo managers than one big expensive repository manager that takes a monster 500-600MB out of the box with no repositories in it. Memory is cheap and I'd like to keep it that way than waste it.

The proof of concept code to store your artifacts:

Wow. Leave it at that. I am going to create this in Rust with very minimal features (and if it is cheap to expand to nodejs and yum) and open source it someday.

Update: So I made a rudimentary version in Rust and my gawd, it only takes ~8mb of ram compared to the cpu/memory hog and craziness that was Nexus. NodeJs would have been good enough too. Java is great, but it is easy to use so much memory and not care.

You just read "How to Cheaply Self Host your Maven/Gradle artifacts without Nexus or Artifactory". Please share if you liked it!
You can read more recent posts here.