> ## Documentation Index
> Fetch the complete documentation index at: https://www.aptible.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Deploy your custom code

> Learn how to deploy your custom code on Aptible

## Overview

The following guide is designed to help you deploy custom code on Aptible. During this process, Aptible will launch containers to run your custom app and Managed Databases for any data stores, like PostgreSQL, Redis, etc., that your app requires to run.

## Compatibility

Aptible supports many frameworks; you can deploy any code that meets the following requirements:

* **Apps must run on Linux in Docker containers**

  * To run an app on Aptible, you must provide Aptible with a Dockerfile. To that extent, all apps on Aptible must be able to run Linux in Docker containers.
    <Tip> New to Docker? [Check out Docker’s getting started guide](https://docs.docker.com/get-started/).</Tip>

* **Apps may only receive traffic over HTTP or TCP.**

  * App endpoints (load balancers) are how you expose your Aptible app to the Internet. These endpoints only support traffic received over HTTP or TCP. While you cannot serve UDP services from Aptible, you may still connect to UDP services (such as DNS, SNMP, etc.) from apps hosted on Aptible.

* **Apps must not depend on persistent storage.**

  * App containers on Aptible are ephemeral and cannot be used for data persistence. To store your data with persistence, we recommend using a [Database](http://aptible.com/docs/databases) or third-party storage solution, such as AWS S3. Apps that rely on persistent local storage or a volume shared between multiple containers must be re-architected to run on Aptible. If you have questions about doing so, contact [Aptible Support](/how-to-guides/troubleshooting/aptible-support) for assistance.

# Deploy Code

<Info>Prerequisites: Ensure you have [Git](https://git-scm.com/downloads) installed, a Git repository with your application code, and a [Dockerfile](/core-concepts/apps/deploying-apps/image/deploying-with-git/overview) ready to deploy.</Info>

Using the Deploy Code tool in the Aptible Dashboard, you can deploy Custom Code. The tool will guide you through the following:

<Steps>
  <Step title="Deploy with Git Push">
    <img src="https://mintcdn.com/aptible/2c_c-XH-dAzVOaDu/images/custom-code1.png?fit=max&auto=format&n=2c_c-XH-dAzVOaDu&q=85&s=e05a3f6c5952e32364be7ad30092a51d" alt="" width="2000" height="1000" data-path="images/custom-code1.png" />
  </Step>

  <Step title="Add an SSH key">
    <img src="https://mintcdn.com/aptible/2c_c-XH-dAzVOaDu/images/custom-code2.png?fit=max&auto=format&n=2c_c-XH-dAzVOaDu&q=85&s=a6203ba1bb8d2992ea129a4e53a63f83" alt="" width="2000" height="1000" data-path="images/custom-code2.png" />

    If you have not done so already, you will be prompted to set up an [SSH key](/core-concepts/security-compliance/authentication/ssh-keys#ssh-keys).
  </Step>

  <Step title="Environment Setup">
    <img src="https://mintcdn.com/aptible/2c_c-XH-dAzVOaDu/images/custom-code3.png?fit=max&auto=format&n=2c_c-XH-dAzVOaDu&q=85&s=482bd8b4ad7900c8590f6a014963d110" alt="" width="2000" height="1000" data-path="images/custom-code3.png" />

    Select your [stack](/core-concepts/architecture/stacks) to deploy your resources. This will determine what region your resources are deployed to. Then, name the [environment](/core-concepts/architecture/environments) your resources will be grouped into.
  </Step>

  <Step title="Push your code to Aptible">
    <img src="https://mintcdn.com/aptible/2c_c-XH-dAzVOaDu/images/custom-code4.png?fit=max&auto=format&n=2c_c-XH-dAzVOaDu&q=85&s=8444bf4b0fd18982a776ed6cc5bf4cef" alt="" width="2000" height="1000" data-path="images/custom-code4.png" />

    Select **Custom Code** deployment, and from your command-line interface, add Aptible’s Git Server and push your code to our scan branch using the commands in the Aptible Dashboard
  </Step>

  <Step title="Provision a database and configure your app">
    <img src="https://mintcdn.com/aptible/2c_c-XH-dAzVOaDu/images/custom-code5.png?fit=max&auto=format&n=2c_c-XH-dAzVOaDu&q=85&s=33fa6e8e398d9e9eb9c07afd516c3d55" alt="" width="2000" height="2000" data-path="images/custom-code5.png" />

    Optionally, provision a database, configure your app with [environment variables](/core-concepts/apps/deploying-apps/configuration#configuration-variables), or add additional [services](/core-concepts/apps/deploying-apps/services) and commands.
  </Step>

  <Step title="Deploy your code and view logs">
    <img src="https://mintcdn.com/aptible/2c_c-XH-dAzVOaDu/images/custom-code6.png?fit=max&auto=format&n=2c_c-XH-dAzVOaDu&q=85&s=482c422d89425642f6c8028ebec5b5f0" alt="" width="2000" height="1000" data-path="images/custom-code6.png" />

    Deploy your code and view [logs](/core-concepts/observability/logs/overview) in real time
  </Step>

  <Step title="Expose your app to the internet">
    <img src="https://mintcdn.com/aptible/2c_c-XH-dAzVOaDu/images/custom-code7.png?fit=max&auto=format&n=2c_c-XH-dAzVOaDu&q=85&s=0a086642589af4f75d61ff01424c4cac" alt="" width="2000" height="1000" data-path="images/custom-code7.png" />

    Now that your code is deployed, it's time to expose your app to the internet. Select the service that needs an [endpoint](/core-concepts/apps/connecting-to-apps/app-endpoints/overview), and Aptible will automatically provision a managed endpoint.
  </Step>

  <Step title="View your deployed app 🎉" icon="party-horn" />
</Steps>
