Skip to content

Running Stash Origin in a Container

The OSG operates the StashCache data federation, which provides organizations with a method to distribute their data in a scalable manner to thousands of jobs without needing to pre-stage data across sites or operate their own scalable infrastructure.

Stash Origins store copies of users' data. Each community (or experiment) needs to run one origin to export its data via the StashCache federation. This document outlines how to run such an origin in a Docker container.

Before Starting

Before starting the installation process, consider the following points:

  1. Docker: For the purpose of this guide, the host must have a running docker service and you must have the ability to start containers (i.e., belong to the docker Unix group).
  2. Network ports: The Stash Origin listens for incoming HTTP/S and XRootD connections on ports 1094 and 1095 (by default).
  3. File Systems: Stash Origin needs a partition on the host to store user data.

Configuring Stash Origin

In addition to the required configuration above (ports and file systems), you may also configure the behavior of your origin with the following variables using an environment variable file:

Where the environment file on the docker host, /opt/origin/.env, has (at least) the following contents (replace "YOUR_SITE_NAME" with the name of your site as registered in Topology:


Creating an Auth file

XrootD needs an authorization file (AuthFile) to control access to different parts of the namespace in your origin. You can create a simple authfile named /opt/origin/auth_file as follows:

u * /origin rl

Create a configuration file for XrootD to find your authfile. Create a file /opt/origin/10-origin-authfile.cfg:

set StashOriginPublicAuthfile = /etc/xrootd/public-origin-authfile

Disabling OSG monitoring

By default, XCache reports to the OSG so that OSG staff can monitor the health of data federations. To disable OSG monitoring (for example so you can report monitoring information to another destination), set the following in your environment variable configuration:



Only disable OSG monitoring on services that are solely used for testing.

Running an Origin

To run the container, use docker run with the following options, replacing the text within angle brackets with your own values:

[email protected] $ docker run --rm --publish 1094:1094 \
         --publish 1095:1095 \
             --volume <HOST PARTITION>:/origin \
             --volume /opt/origin/10-origin-authfile.cfg:/etc/xrootd/config.d/10-origin-authfile.cfg \
             --volume /opt/origin/auth_file:/etc/xrootd/public-origin-authfile \
             --env-file=/opt/origin/.env \

It is recommended to use a container orchestration service such as docker-compose or kubernetes, or start the stash origin container with systemd.

Running Stashcache on container with systemd

An example systemd service file for StashCache. This will require creating the environment file in the directory /opt/origin/.env.


This example systemd file assumes <HOST PARTITION> is /srv/origin.

Description=Stash Origin Container

ExecStartPre=-/usr/bin/docker stop %n
ExecStartPre=-/usr/bin/docker rm %n
ExecStartPre=/usr/bin/docker pull opensciencegrid/stash-origin:stable
ExecStart=/usr/bin/docker run --rm --name %n -p 1094:1094 -p 1095:1095 -v /srv/origin:/origin -v /opt/origin/10-origin-authfile.cfg:/etc/xrootd/config.d/10-origin-authfile.cfg -v /opt/origin/auth_file:/etc/xrootd/public-origin-authfile --env-file /opt/origin/.env opensciencegrid/stash-origin:stable


This systemd file can be saved to /etc/systemd/system/docker.stash-origin.service and started with:

[email protected] $ systemctl enable docker.stash-origin
[email protected] $ systemctl start docker.stash-origin


You must register the cache before considering it a production service.

Validating Origin

To validate the origin please follow the validating-origin instructions

Getting Help

To get assistance, please use the this page or contact directly.