Hub 2018.1 Help

Stop and Start the Hub Service

This page describes how to stop and start your Hub server.

The following situations require that you stop your Hub server:

  • You want to change the location of the Hub database.
  • You want to modify Hub properties or JVM options for your Hub server.
  • You want to upgrade your Hub installation.

Stop and Start an MSI Installation

When you install Hub with an MSI distribution, Hub runs as a Windows service. The display name of the windows service is JetBrains Hub. After the initial configuration, the application runs in the background on the server.

To start and stop the Windows service, use the Services Microsoft Management Console (MMC) (Control Panel > Administrative Tools > Services).

Stop and Start a ZIP Installation

If you installed Hub with a ZIP distribution, you run Hub from the command line. The scripts that you use to start and stop Hub are located in the <hub_home>/bin/ directory. The <hub_home> directory is the location where the ZIP distribution was unpacked during installation.

To stop and start Hub on macOS or Linux platforms, execute the command as a non-root user.

Enter commands to stop and start the Hub service in a command-line interface. Use the following commands to manage the status of your Hub instance:

CommandDescription
hub.sh run Starts the Hub service. With this command, the console is blocked until the service is stopped with the hub.sh stop command.
hub.sh start Starts the Hub service. With this command, the console is only blocked during the startup process.
hub.sh stop Stops the Hub service.
hub.sh restart Restarts the Hub service.
hub.sh help Displays a list of all commands that can be executed in the command-line interface.

Stop and Run a Docker Container

Run Hub docker container

To run Hub container, execute the command:

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>

Command attributes:

  • -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.

Stop Hub docker container

To stop the Hub service gracefully, run the command:

docker exec <containerId> stop

For a graceful shutdown, you can also use the standard `docker kill --signal=SIGTERM <containerId>` command.

We do not recommend using the standard command `docker stop`. By default, this command sends the `SIGTERM` signal to the Hub process inside the Docker container, then waits for 10 seconds. If Hub does not finish the shutdown within that time period, the `SIGKILL` is sent to the kernel and the Hub process is killed. This may lead to data corruption. To avoid this outcome, specify an appropriate timeout value when using this command. For example, the following command leaves enough time for the Hub service to shut down:

docker stop -t 60 <containerId>

Run Hub container as a service

Docker team recommends to use cross-platform built-in restart policy for running container as a service. For this, configure your docker service to start on system boot and simply add parameter --restart unless-stopped to the docker run command that starts Hub.

However, when it comes to the sequential start of several services (including Hub), the restart policy method will not suit. You can use a process manager instead.

Here's an example of how to run Hub container as a service on Linux with help of systemd.

To run Hub container as a service on Linux with systemd

  1. Create a service descriptor file /etc/systemd/system/docker.hub.service:
    [Unit] Description=Hub Service After=docker.service Requires=docker.service [Service] TimeoutStartSec=0 Restart=always ExecStartPre=-/usr/bin/docker exec %n stop ExecStartPre=-/usr/bin/docker rm %n ExecStartPre=/usr/bin/docker pull jetbrains/hub:<version> ExecStart=/usr/bin/docker run --rm --name %n \ -v :/opt/hub/data \ -v :/opt/hub/conf \ -v :/opt/hub/logs \ -v :/opt/hub/backups \ -p :8080 \ jetbrains/hub:<version> [Install] WantedBy=default.target
  2. Enable starting the service on system boot with the following command:
    systemctl enable docker.hub

You can also stop and start the service manually at any moment with the following commands, respectively:

sudo service docker.hub stop sudo service docker.hub start
Last modified: 22 May 2018