Skip to content

01. Installation

Roger Zaragoza edited this page Nov 11, 2016 · 2 revisions

Running Nexus in development (with a docker image)

The quickest way to get an instance of Nexus up and running is using docker. It's a containerization platform that can bundle all the dependencies of a software (into what they call an image) and run it into a virtualized environment.

Nexus provides an official docker image containing a rethinkDB instance and the latest nexus binary ready to work so you don't have to worry about dependencies or setting a database to start testing nexus.

1. Install docker

First of all: install docker on your system.

2. Download image

Once docker is installed you can download and run images on it. This command will download the latest nexus image (and can be used to update it later too):

docker pull nayarsystems/nexus

The following will list your available docker images. You should see a nayarsystems/nexus image listed.

docker images

3. Run image

To run the image with a simple configuration run:

docker run -ti --rm -p 80:80 -p 1717:1717 nayarsystems/nexus -l http://0.0.0.0:80 -l tcp://0.0.0.0:1717

This will run the image with nexus listening on TCP port 1717 and HTTP and WebSocket on port 80. The console will show the logs from the container (-ti) and the docker container will be removed when it stops (--rm), losing all the data. If you want a more complex setting read step 4, if you are fine with this setup continue with Start using Nexus.

4. Run image (advanced)

If you want something more complex, like persisting data into the container or running the image in the background, here are explained some other parameters that can be passed to docker run. The command structure is the following:

docker run <run-options> <exposed-ports> nayarsystems/nexus <nexus-parameters>

run-options

Options passed to docker run, here are some common used examples, more info on docker run reference:

  • -ti --rm runs container in foreground mode attached to tty and remove container when exiting.
  • -d --name nexus runs container in background mode with name nexus. When command returns you can run docker logs -f nexus to see the output or docker stop nexus to stop it and after that docker rm nexus to remove the container.
  • -d --name nexus -v /data does the same as before but persist the /data directory when the container is stopped so when you start it again with docker start nexus all the data created by nexus (users, tags, templates..) is still present. The data is deleted when the container is removed.

exposed-ports

Options passed to docker run that specify which ports listening inside the container running the image will map to each port on the machine.

This means that if our nexus server is instructed to listen on port 80 and 1717, we have to tell docker which ports of our machine will match those ports. Usually we want them to be the same, but we have to specify them anyways.

  • -p local_port:container_port should be specified multiple times for each port you want to be enabled.

nexus-parameters

Options passed to nexus itself. Here are some of the most common options:

  • -l (tcp|ssl|http|https)://addr:port should be specified multiple times to set the listeners. If no listener is specified by default nexus listens in TCP port 1717.
  • -v will make nexus logs be more verbose.
  • --production will make nexus output its logs in JSON format.