{% extends "prose.html" %}

{% block title %}Bioregistry Deployment and Sustainability{% endblock %}

{% block styles %}
    {{ super() }}
    <link href="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/themes/prism.css" rel="stylesheet"/>
{% endblock %}

{% block scripts %}
    {{ super() }}
    <script src="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/prism.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/plugins/autoloader/prism-autoloader.min.js"></script>
{% endblock %}

{% block content %}
    <h1>Sustainability</h1>
    <h2>Deployment in the Cloud</h2>
    <p>
        There are several aspects to the way the Bioregistry web application is deployed listed in this section.
    </p>
    <h3>Domain Name</h3>
    <p>
        The <code>bioregistry.io</code> domain is registered with Namecheap and costs about $33 per year. It is managed
        and supported by the <a
            href="https://indralab.github.io/">INDRA Lab</a>, a part of the <a
            href="https://hits.harvard.edu/the-program/laboratory-of-systems-pharmacology/">Laboratory of
        Systems Pharmacology</a> and <a href="https://hits.harvard.edu/">Harvard Program in Therapeutic Science
        (HiTS)</a> at Harvard Medical School.
    </p>
    <h3>Hardware</h3>
    <p>
        The Bioregistry is hosted on an Amazon Elastic Compute Cloud (EC2) via a load balancing service to stay secure
        and highly available. It is managed and supported by the <a href="https://indralab.github.io/">INDRA Lab</a>, a
        part of the <a href="https://hits.harvard.edu/the-program/laboratory-of-systems-pharmacology/">Laboratory of
        Systems Pharmacology</a> and <a href="https://hits.harvard.edu/">Harvard Program in Therapeutic Science
        (HiTS)</a> at Harvard Medical School.
    </p>
    <h3>Software</h3>
    <p>
        These are the software and operating system specifications for the currently running instance of the
        Bioregistry:
    </p>
    <dl>
        <dt>Bioregistry Version</dt>
        <dd>{{ software_version }}</dd>
        {% if software_git_hash %}
            <dt>Git Hash</dt>
            <dd>
                <a href="https://github.com/biopragmatics/bioregistry/commit/{{ software_git_hash }}">
                    {{ software_git_hash }}
                </a>
            </dd>
        {% endif %}
        <dt>Python</dt>
        <dd>{{ python_version }}</dd>
        <dt>Platform</dt>
        <dd>{{ platform }}</dd>
        <dt>Platform Version</dt>
        <dd>{{ platform_version }}</dd>
        <dt>Deployed</dt>
        <dd>{{ deployed }}</dd>
    </dl>
    <h3>Containerization</h3>
    <p>
        A Docker image is automatically built nightly following the
        <a href="https://github.com/biopragmatics/bioregistry/actions/workflows/update.yml">update workflow</a>
        on GitHub Actions and pushed to the <a href="https://hub.docker.com/r/biopragmatics/bioregistry"><i class="fab fa-docker"></i>
        biopragmatics/bioregistry</a> DockerHub repository. This image is built with the Python 3.9 alpine base image,
        which significantly reduces non-essential components. The final compressed image weights less than 40 MB of disk
        space and runs inside Docker with about 65 MB of memory at baseline. This could easily fit on a dedicated
        <a href="https://aws.amazon.com/ec2/instance-types/t4/">t4g.nano</a> instance on AWS that costs about
        $37/year on-demand or around $20/year reserved.
    </p>
    <h3>Deployment</h3>
    <p>
        The Bioregistry's EC2 instance runs the following script on a cron job that stops the current running instance,
        pulls the latest image from this DockerHub repository and starts it back up. The whole process only takes a few
        seconds.
    </p>
    <pre><code class="language-bash">#!/bin/bash
# /data/services/restart_bioregistry.sh

# Store the container's hash
BIOREGISTRY_CONTAINER_ID=$(docker ps --filter "name=bioregistry" -aq)

# Stop and remove the old container, taking advantage of the fact that it's named specifically
if [ -n "BIOREGISTRY_CONTAINER_ID" ]; then
  docker stop $BIOREGISTRY_CONTAINER_ID
  docker rm $BIOREGISTRY_CONTAINER_ID
fi

# Pull the latest
docker pull biopragmatics/bioregistry:latest

# Run the start script, remove -d to run interactively
docker run -id --name bioregistry -p 8766:8766 biopragmatics/bioregistry:latest</code></pre>
    <p>This script can be put on the EC2 instance and run via SSH with:</p>
    <pre><code class="language-bash">#!/bin/bash

ssh -i ~/.ssh/&lt;credentials&gt.pem &lt;user&gt;@&lt;address&gt; 'sh /data/services/restart_bioregistry.sh'</code></pre>
    <h3>SSL/TLS</h3>
    <p>
        The SSL/TLS certificate for <code>bioregistry.io</code> so it can be served with HTTPS is managed through
        the <a href="https://aws.amazon.com/certificate-manager/">AWS Certificate Manager</a>.
    </p>

    <h2>Project Longevity</h2>
    <p>
        The deployment of the Bioregistry is currently funded by the DARPA Young Faculty Award W911NF2010255
        grant. Due to its low cost, the Laboratory of Systems Pharmacology at Harvard Medical School has
        additionally committed discretionary (i.e., not tied to a project) funding to continue running the
        Bioregistry instance at https://bioregistry.io.
    </p>
    <p>
        The Bioregistry project is also interested in acquiring grants to help ensure its longevity. We give a
        conservative estimate of around $100-200/year to support domain registration, AWS costs, and
        personnel time for maintenance. This means that the Bioregistry could cost as little as $1,000
        to run for 10 years (which is much longer than most scientific databases/websites are able to persist).
    </p>

    <h3>Mirroring</h3>
    <p>
        The Bioregistry can be mirrored following
        <a href="https://bioregistry.readthedocs.io/en/latest/deployment.html">these instructions</a>.
    </p>

    <h3>Deploying with Custom Content</h3>
    <p>
        The Bioregistry can be deployed using custom content by following
        <a href="https://bioregistry.readthedocs.io/en/latest/deployment.html#deploying-a-custom-bioregistry">these
        instructions</a>.
    </p>
    
    <h2>Project Governance</h2>
    <p>
        Stakeholders in the Bioregistry have been interested in questions including:
    </p>
    <ul>
        <li>Will the service still be running in 10 years?</li>
        <li>Who makes technical decisions about how the web application?</li>
        <li>Who makes curation decisions about the underlying registry?</li>
        <li>
            Should there be acceptance criteria for new entries, such as a minimum metadata standard or assessment of
            impact?
        </li>
        <li>
            How will the Bioregistry avoid the pitfalls of a closed curation process like the one implemented
            by Identifiers.org?
        </li>
        <li>How should inevitable prefix/namespace collisions be handled?</li>
    </ul>
    <p>
        These questions do not have easy answers and apply to most databases, software, and web applications in the life
        sciences.

        As first steps towards addressing those, we have written explicit, public, well-defined
            <a href="https://github.com/biopragmatics/bioregistry/blob/main/docs/CONTRIBUTING.md">contribution
                guidelines</a>,
            <a href="https://github.com/biopragmatics/bioregistry/blob/main/docs/CODE_OF_CONDUCT.md">code of
                conduct</a>, and
            <a href="https://github.com/biopragmatics/bioregistry/blob/main/docs/GOVERNANCE.md">project
                governance</a>.
    </p>
    <p>
       If you would like to be part of this discussion and/or development of these policies, you can try the
       following:
    </p>
    <ul>
        <li>
            Join the<a href="https://join.slack.com/t/obo-communitygroup/shared_invite/zt-qdvt040i-ac3eU1MOgXF~lehfeNa9eA">
            OBO Community Slack workspace</a> and participate in discussions on the
            <a href="https://obo-communitygroup.slack.com/archives/C023P0Z304T">#prefixes</a> channel.
        </li>
        <li>
            Participate in discussion labeled with
            <a href="https://github.com/biopragmatics/bioregistry/issues?q=is%3Aissue+label%3APolicy">Policy</a> on the Bioregistry's GitHub issue tracker
        </li>
    </ul>
    <h2>Evaluation of FAIR Data Principles</h2>
    <p>
        Content negotiation was implemented in <a href="https://github.com/biopragmatics/bioregistry/pull/682">
        PR #682</a> in order to better comply with FAIR-ness evaluations such as th
        <a href="https://fair-enough.semanticscience.org">FAIR Enough Evaluation</a>
    </p>
{% endblock %}
