Skip to content

Stage assets for serving

Staging prepares built assets for serving to clients or pushing to cloud storage. Before an asset can be served or pushed, it must be staged.

Staging creates entries in the genome_stage_folder (default: ~/.refgenie/archives/) based on the asset’s serving modes. The serving mode is defined by the asset class — see Serving modes for background.

Serving modeWhat staging createsDisk cost
fileA directory symlink from the stage folder to the asset’s build directoryNone (symlink only)
archiveA .tgz tarball in the stage folderFull compressed copy
noneNothing — staging is skippedNone

If an asset class specifies both file and archive modes, staging creates both a symlink and a tarball.

After building an asset, stage it:

Terminal window
refgenie stage stage hg38/fasta

You can stage multiple assets at once:

Terminal window
refgenie stage stage hg38/fasta hg38/bowtie2_index mm10/fasta

View all staged assets with their mode and size:

Terminal window
refgenie stage staged

This displays a table with the asset digest, registry path, mode (file or archive), and size (for archive mode).

Remove staging records and clean up staged files:

Terminal window
refgenie stage unstage hg38/fasta

The build command supports --stage and --push-to flags to combine building, staging, and push intent creation:

Terminal window
refgenie build hg38/fasta --stage --push-to my-s3-remote

The --stage flag stages the asset after building. The --push-to flag creates push intent records for the specified remote(s) after staging. See Configure remote storage for setting up remotes and pushing.

The refgenie server (refgenie serve) serves assets from the stage folder. The workflow is:

  1. Build the asset: refgenie build hg38/fasta
  2. Stage the asset: refgenie stage stage hg38/fasta
  3. Serve the asset: refgenie serve

File-mode staging is especially efficient for local servers because the symlink means no data is duplicated — the server reads directly from the build directory through the symlink. Cloud sync tools like aws s3 sync also follow symlinks by default.

For the complete build-to-serve workflow, see the Building and serving tutorial.

The stage folder location is controlled by the REFGENIE_GENOME_STAGE_FOLDER environment variable:

Terminal window
export REFGENIE_GENOME_STAGE_FOLDER=~/.refgenie/archives

The default is $REFGENIE_HOME_PATH/archives.