Hub 2017.4 Help

Docker Installation

To run a new instance of the Hub service in a docker container:

  1. Pull Hub Image
  2. Create and Configure Directories
  3. Run Hub Docker Container
  4. Configure Hub

Pull Hub Image

Pull an image of the latest Hub version from the Docker Hub Repository:

docker pull jetbrains/hub:<version>

<version> is a full version number of a Hub build.

Create and Configure Directories

Hub image container is a stateful container. Thus, before running it, you should create specific directories on the host machine to store Hub database, configuration files, logs, backups, and pass them to the Hub container as volumes. Otherwise, you risk losing Hub data when the container is removed.

These directories are:

  • data — a directory where Hub stores its database. For a new installation, this directory must be empty.
  • conf — a directory where Hub stores configuration files that contain environment settings, JVM options, Hub integration settings, and so on.
  • logs — a directory where Hub stores its log files.
  • backups — a directory where Hub stores backups. For more details about backups, seeBackup.

These directories must be accessible to the user account that is used to run Hub service inside the container. Hub uses the non-root account `13001:13001` (`group:id`, respectively).

For example, if you use a Linux host machine, you can execute the following commands to create Hub directories and apply the required access permissions:

mkdir -p -m 750 <path to data directory> <path to logs directory> <path to conf directory> <path to backups directory> chown -R 13001:13001 <path to data directory> <path to logs directory> <path to conf directory> <path to backups directory>

When the Hub-specific directories are created and configured, you can define the mapping between them and directories inside the docker container as the arguments of the docker run command.

Run Hub Docker Container

Use the following command to run a container with Hub service and map Hub data volumes and port:

docker run -it --name <hub-server-instance> \ -v <path to data directory>:/opt/hub/data \ -v <path to conf directory>:/opt/hub/conf \ -v <path to logs directory>:/opt/hub/logs \ -v <path to backups directory>:/opt/hub/backups \ -p <port on host>:8080 \ jetbrains/hub:<version>

Where:

  • -it — a flag that attaches Hub container input and output including the startup logs to the terminal window. Note that pressing `Ctrl+C` when the terminal is attached to a container output causes the container to shut down. Use `Ctrl+PQ` in order to detach the terminal from container output. For more details, see the official docker documentation.
  • --name hub-server-instance — the arbitrary name for the container.
  • -v <path to NNN directory>:/opt/hub/NNN — binding the Hub-specific 'NNN' directory on the host machine to the respective /opt/hub/NNN directory inside the container.
  • -p <port on host>:8080 — parameter that defines the ports mapping. It instructs the host machine to listen on port <port on host> and propagate all traffic to the port `8080` inside the docker container.

Hub service is started on {0.0.0.0:8080} inside the Docker container, and port 8080 is mapped to <port on host> you've specified. This way the service may be accessed from any machine that has network access to <port on host> of your host machine. For instance, if FQDN of the host machine is host.mydomain.com and the <port on host> is 7777, then the service will be available at http://host.mydomain.com:7777

Configure Hub

On the first run, the Hub service starts with the web-based Configuration Wizard at the address mentioned above. Open your browser, enter the address and follow the steps described in Configuration Wizard to complete the setup.

Configure Hub service from the Command Line

For automated installation purposes, you can skip the wizard. However, in this case, the Hub service starts with the default parameters. Thus, you need to explicitly set the base URL — the URL at which the Hub service is available to the end users.

To skip Configuration Wizard, run the configure command before running Hub:

docker run --rm -it -v <path to data directory>:/opt/hub/data \ -v <path to conf directory>:/opt/hub/conf \ -v <path to logs directory>:/opt/hub/logs \ -v <path to backups directory>:/opt/hub/backups \ -p <port on host>:8080 \ jetbrains/hub:<version> \ configure \ -J-Ddisable.configuration.wizard.on.clean.install=true \ --base-url=http://hub.mydomain.com:XXXX

If you ever need to change the base URL for your running Hub instance, use the configure command with the --base-url argument.

To change the Base URL of the Hub service

  1. Stop Hub: docker exec <containerId> stop

  2. Run the following command:

    docker run --rm -it -v <path to data directory>:/opt/hub/data \ -v <path to conf directory>:/opt/hub/conf \ -v <path to logs directory>:/opt/hub/logs \ -v <path to backups directory>:/opt/hub/backups \ -p <port on host>:8080 \ jetbrains/hub:<version> \ configure --base-url=http://hub.mydomain.com:XXXX
  3. Start Hub: docker start <containerId>

To see all stopped containers, run docker ps -a

Last modified: 21 February 2018