GithubHelp home page GithubHelp logo

corcovadoming / nexus Goto Github PK

View Code? Open in Web Editor NEW

This project forked from stefanprodan/nexus

0.0 2.0 0.0 14 KB

A Sonatype Nexus Repository Manager Docker image based on Alpine with OpenJDK 8

Home Page: https://hub.docker.com/r/stefanprodan/nexus/

License: GNU General Public License v3.0

nexus's Introduction

Nexus Repository Manager OSS

A Sonatype Nexus Repository Manager image based on Alpine with OpenJDK 8.

Running Nexus with:

  • Repository on port 8081
  • Docker Registry (hosted) on port 5000
  • Data persistence on a host directory
docker run -d --name nexus \
    -v /path/to/nexus-data:/nexus-data \
	-p 8081:8081 \
	-p 5000:5000 \
	stefanprodan/nexus

Notes

  • Default credentials are: admin / admin123

  • It can take some time for the service to launch in a new container. You can tail the log to determine once Nexus is ready:

$ docker logs -f nexus
  • Test with curl:
$ curl -u admin:admin123 http://localhost:8081/service/metrics/ping
  • Installation of Nexus is to /opt/sonatype/nexus-version.

  • A persistent directory, /nexus-data, is used for configuration, logs, and storage.

  • Three environment variables can be used to control the JVM arguments

    • JAVA_MAX_MEM, passed as -Xmx. Defaults to 1200m.

    • JAVA_MIN_MEM, passed as -Xms. Defaults to 1200m.

    • EXTRA_JAVA_OPTS. Additional options can be passed to the JVM via this variable.

Configure NGINX as reverse proxy for Nexus and hosted Docker Registry

nginx.conf

worker_processes 1;

events { 
	worker_connections 1024; 
}

http {
	error_log /var/log/nginx/error.log warn;
	access_log  /dev/null;
	proxy_intercept_errors off;
	proxy_send_timeout 120;
	proxy_read_timeout 300;
	
	upstream nexus {
        server nexus:8081;
	}

	upstream registry {
        server nexus:5000;
	}

	server {
        listen 80;
        server_name nexus.demo.com;

        keepalive_timeout  5 5;
        proxy_buffering    off;

        # allow large uploads
        client_max_body_size 1G;

        location / {
		# redirect to docker registry
		if ($http_user_agent ~ docker ) {
			proxy_pass http://registry;
		}
		proxy_pass http://nexus;
		proxy_set_header Host $host;
		proxy_set_header X-Real-IP $remote_addr;
		proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
		proxy_set_header X-Forwarded-Proto "https";
        }
    }
}

Replace nexus.demo.com with your own domain. The NGINX server detects if a call is made by the docker client, based on user agent, and redirects that call to the Docker Registry. You alose need to setup a certificate with letsencrypt for Docker Registry to work over SSL.

Nexus and Nginx setup

docker network create nexus-net

docker run -d --name nexus \
    -v /path/to/nexus-data:/nexus-data \
    --restart unless-stopped \
    --network nexus-net \
	stefanprodan/nexus
	
docker run -d -p 80:80 -p 443:443 --name nginx \
    -v $(pwd)/nginx.conf:/etc/nginx/nginx.conf:ro \
    --restart unless-stopped \
    --network nexus-net \
    nginx

Changelog

  • 19 Sept 2016 - Nexus 3.0.2-02

nexus's People

Contributors

stefanprodan avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.