JetBrains Space Help

Configure Space for Docker Compose Production Environment

Enable customization of your Space On-Premises instance

The Docker Compose installation of Space On-Premises comes with a predefined configuration that works out of the box. However, for Space On-Premises to work in a production environment, you should perform some additional configuration.

Space On-Premises configuration is a set of conf files stored in the Space application container. To configure Space On-Premises, you should copy the files to the host machine, modify them, and then point Space to the new file location.

  1. Open the {space_install_dir/config} directory (e.g., space-on-premises/config) and run:

    docker cp {space_container_id}:/home/space/circlet-server-onprem/config .

    The following configuration files will be copied to the {space_install_dir/config} directory on the host machine:

    • langservice.on-premises.conf

    • packages.on-premises.conf

    • space.on-premises.conf

    • vcs.on-premises.properties

  2. Edit the configuration files according to your needs.

  3. Stop your Space instance:

    docker-compose -p space-on-premises down docker-compose -p space-on-premises rm -f

  4. Open the docker-compose.yml file located in the Space installation directory.

  5. Change the default location of the Space configuration files. To do this, edit the docker-compose.yml file:

    1. Comment out the config:{} line:

      ... # config:{} ...
    2. Change every reference to the docker volume configuration from config to ./config. Namely, from:

      ... volumes: - config:/home/init-config/config ... volumes: - config:/home/space/circlet-server-onprem/config ... volumes: - config:/home/space/git/vcs-hosting/config ... volumes: - config:/home/space/packages-server/config ... volumes: - config:/home/space/langservice-server/config ...

      to:

      ... volumes: - ./config:/home/init-config/config ... volumes: - ./config:/home/space/circlet-server-onprem/config ... volumes: - ./config:/home/space/git/vcs-hosting/config ... volumes: - ./config:/home/space/packages-server/config ... volumes: - ./config:/home/space/langservice-server/config ...
  6. Start Space On-Premises with the updated configuration:

    docker-compose -p space-on-premises up -d

Make your Space On-Premises instance network-accessible

By default, Docker Compose installation of Space On-Premises uses 127.0.0.1 and localhost as the base URLs. This configuration works well only in the proof-of-concept scenario when you run Space locally. If you want to run Space on a separate machine and make it network-accessible, you must use the nginx web server. It will work as a reverse proxy and redirect requests to Space.

Prerequisites:

  • The domain names for Space components are already registered and resolved to the IP address of the host machine. Space components include: Space application, VCS, and Packages server. In our example, we will use the following names: space.example.com, git.example.com, and packages.example.com.

  • The corresponding TLS certificates are installed on the host machine. You can obtain the certificates from a trusted certificate authority (e.g., Let's Encrypt).

  • The host machine has the nginx web server installed. You can find the installation instructions on the official website.

  1. On the host machine, create the space.conf NGINX configuration file in the /etc/nginx/conf.d directory. For example:

    server { client_max_body_size 0; server_name space.example.com; location / { proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_set_header X-NginX-Proxy true; proxy_pass http://127.0.0.1:8084/; proxy_redirect off; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; } listen 443 ssl; ssl_certificate /path_to_certs/space.example.com/fullchain.pem; ssl_certificate_key /path_to_certs/space.example.com/privkey.pem; } server { client_max_body_size 0; server_name git.example.com; location / { proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_set_header X-NginX-Proxy true; proxy_pass http://127.0.0.1:8080/; proxy_redirect off; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; } listen 443 ssl; ssl_certificate /path_to_certs/git.example.com/fullchain.pem; ssl_certificate_key /path_to_certs/git.example.com/privkey.pem; } server { client_max_body_size 0; server_name packages.example.com; location / { proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_set_header X-NginX-Proxy true; proxy_pass http://127.0.0.1:8390/; proxy_redirect off; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; } listen 443 ssl; ssl_certificate /path_to_certs/packages.example.com/fullchain.pem; ssl_certificate_key /path_to_certs/packages.example.com/privkey.pem; } server { client_max_body_size 0; server_name minio.example.com; location / { proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_set_header X-NginX-Proxy true; proxy_pass http://127.0.0.1:9000/; proxy_redirect off; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; } listen 443 ssl; ssl_certificate /path_to_certs/packages.example.com/fullchain.pem; ssl_certificate_key /path_to_certs/packages.example.com/privkey.pem; } # configuring HTTP redirects server { if ($host = space.example.com) { return 301 https://$host$request_uri; } server_name space.example.com; listen 80; return 404; } server { if ($host = git.example.com) { return 301 https://$host$request_uri; } server_name git.example.com; listen 80; return 404; } server { if ($host = packages.example.com) { return 301 https://$host$request_uri; } server_name packages.example.com; listen 80; return 404; } server { if ($host = minio.example.com) { return 301 https://$host$request_uri; } server_name minio.example.com; listen 80; return 404; }

    In the example above, change:

    • All ssl_certificate and ssl_certificate_key paths to the real paths to your certificates.

    • All server_name values (space.example.com, git.example.com, and packages.example.com) to the real domain names.

  2. Save the changes and apply the configuration:

    sudo nginx -s reload
  3. Make your Space instance available for customization.

  4. Stop your Space instance if it is running.

  5. Open the Space installation directory.

  6. In the space.on-premises.conf file, update all url and altUrls parameters with new URL values. For example:

    circlet { frontend { url = "https://space.example.com" internalUrl = "http://space:9084" } packages { notifications { enabled = true } types { maven { url = "https://packages.example.com" } nuget { url = "https://packages.example.com" } npm { url = "https://packages.example.com" } container { url = "https://packages.example.com" } pypi { url = "https://packages.example.com" } composer { url = "https://packages.example.com" } dart { url = "https://packages.example.com" } files { url = "https://packages.example.com" } crates { url = "https://packages.example.com" } } } }
  7. In the packages.on-premises.conf file, update all url and internalUrl parameters with new URL values. For example:

    circlet { packages { url = "https://packages.example.com" internalUrl = "http://packages:9390" } space { url = "https://space.example.com" internalUrl = "http://space:9084" } storage { aws { publicUrl = "https://minio.example.com" } } }
  8. In the vcs.on-premises.properties file, update teh base.url and circlet.url.ext parameters with new URL values. For example:

    base.url=https://git.example.com circlet.url.int=http://space:9084 circlet.url.ext=https://space.example.com
  9. Start Space On-Premises with the updated configuration:

    docker-compose up -d

Enable mail server

The Docker Compose installation comes without a preconfigured mail server. The instructions below show how you can create a MailHog mail server and register it in Space.

  1. Stop your Space instance if it is running.

  2. Open the Space installation directory.

  3. In the docker-compose.yml file, add the mail server configuration:

    services: mailhog: image: mailhog/mailhog ports: - 1025:1025 # SMTP server port - 8025:8025 # UI port networks: - "frontend"
  4. Provide the mail server settings to Space. You can do this in two different ways: using the Space administration UI or using the Space configuration file.

    1. Start Space On-Premises with the updated configuration:

      docker-compose up -d
    2. Open your Space instance in the browser and specify mail settings as shown on this page.

    1. Make your Space instance available for customization.

    2. Open the space.on-premises.conf file and modify the mail configuration according to your requirements:

      mail { outgoing { enabled = true // protocol settings fromAddress = "space@space.example.com" host = "mailhog" port = 1025 protocol = "SMTP" // "SSL" and "TLS" are also supported login = "space" password = "space" messageQueuePrefix = "mailQueue" // handling properties aggregationDelaySecs = 900 rateLimitPerSecond = 3 } }
    3. Start Space On-Premises with the updated configuration:

      docker-compose up -d

(Case-specific) Enable manual downloads in Space Packages

If you use a custom object storage for your Space instance, you must configure its CORS policy to allow receiving GET requests from any origin:

Access-Control-Allow-Methods: GET Access-Control-Allow-Origin: *

Otherwise, users will not be able to manually download packages from the repository page in Space. Clicking the Download button will result in an error.

  1. Sign in to the AWS Management Console and open the Amazon S3 console.

  2. Open the S3 bucket used for Space Packages.

  3. Open the Permissions tab and add the following configuration to the CORS section:

    [ { "AllowedHeaders": [ "*" ], "AllowedMethods": [ "GET" ], "AllowedOrigins": [ "*" ], "ExposeHeaders": [] } ]
  4. Save the changes.

Last modified: 18 September 2023