> For the complete documentation index, see [llms.txt](https://hatchbox.gitbook.io/hatchbox/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://hatchbox.gitbook.io/hatchbox/apps/deploy-scripts.md).

# Deploy Scripts

## What variables do I have access to in the deploy script?

We set a handful of variables you can use to add additional functionality to your deploy script:

* $DIR - the app's main directory
* $RELEASE - the timestamp of the new deploy
* $BRANCH - the branch being deployed
* $RELEASE\_DIR - the directory of the current deployment
* $WEB - boolean, true if running on a web server
* $CRON - boolean, true if running on the cron server
* $WORKER - boolean, true if running on a worker server
* $REVISION - the git revision that's being deployed
* $LOG\_ID - the ID of the deployment log

## How can I symlink another directory during deploy?

Add the following to your deploy script:

`ln -s $DIR/shared/myfolder $RELEASE_DIR/myfolder`

Keep in mind, you'll need to create myfolder on the server via SSH:

`mkdir myapp/shared/myfolder`

## What directories are symlinked during the deploy automatically?

The following directories are automatically symlinked to the shared folder every deploy so that the contents are shared between releases.

* /log&#x20;
* /tmp/pids&#x20;
* /tmp/cache&#x20;
* /tmp/sockets&#x20;
* /vendor/bundle&#x20;
* /public/system&#x20;
* /public/uploads&#x20;
* /public/assets&#x20;
* /storage

## What user is the deploy run as?

The `deploy` user.


---

# 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://hatchbox.gitbook.io/hatchbox/apps/deploy-scripts.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.
