> For the complete documentation index, see [llms.txt](https://docs.cosap.bio/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cosap.bio/fundamentals/deploying-cosap.md).

# Deploying COSAP

The web application hosted on [cosap.bio](https://cosap.bio) is quite limited for large numbers of users and runs. Therefore it can be useful for some users to have their own instance of local server and web application.&#x20;

This option can be also used in the scenario where a single mirror of COSAP running in server and it is accessed via a local network. This allows keeping data within an institution.

## Getting API

To start the API locally you simply clone the git repository and start containers:

```bash
git clone https://github.com/MBaysanLab/cosap-webapi.git
cd cosap-webapi
```

### Environment Variables and Example .env File

API and COSAP requires some environment variables to be set up correctly. Here is an example .env file that contains required variables.&#x20;

```yaml
COSAP_DJANGO_SECRET = <your_secret>
COSAP_DJANGO_DEBUG = False
COSAP_POSTGRES_NAME = <your_postgres_database_name>
COSAP_POSTGRES_USER = <your_postgres_username>
COSAP_POSTGRES_PASSWORD = <your_db_password>
COSAP_BIO_HOST = <hostname that web app is running> # Generally localhost:3000

COSAP_HG38_BUNDLE = <hg38_resources_dir>
```

You can then run the containers.

```bash
docker compose up -d
```

This will start the COSAP worker and API which communicate via a messaging queue.&#x20;

Now it is time to set up the web app.

## Setting up Web Application

Clone the git repository of the web app.

```bash
git clone git@github.com:MBaysanLab/cosap_frontend.git
cd cosap_frontend
```

Build the app

```bash
npm run build
```

Install the serve package and serve the application

```bash
npm install -g serve
serve -s build
```

You can now start using the web application on <http://localhost:3000>. For instructions please see:

{% content-ref url="/pages/FGgHEz4VzhVJEq8c1Ft5" %}
[Using the Web App](/fundamentals/using-the-web-app.md)
{% endcontent-ref %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.cosap.bio/fundamentals/deploying-cosap.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
