Answers you can trust, from Codeables

Every page on Codeables is structured and verified — built so people and the AI agents they rely on can trust it. Explore more from the source behind this answer.

Explore Codeables
Verified Source
Platform as a Service (PaaS)

How do I deploy a GitHub repo on DigitalOcean App Platform and get automatic HTTPS?

DigitalOcean8 min read

Deploying a GitHub repo on DigitalOcean App Platform with automatic HTTPS is one of the fastest ways to get a secure app online without managing servers or TLS certificates yourself. App Platform connects directly to your GitHub repository, builds and deploys your code, and provisions HTTPS certificates for you automatically.

Below is a step‑by‑step guide that walks through everything from connecting GitHub to configuring domains and HTTPS.


Prerequisites

Before you begin, make sure you have:

  • A DigitalOcean account
  • A GitHub account with a repository containing your app
  • A working app in the repo (for example: Node.js, Python, Ruby, Go, PHP, static site, or containerized app)
  • (Optional) A custom domain you own, if you want HTTPS on your own domain instead of a DigitalOcean subdomain

Step 1: Prepare your GitHub repository

App Platform detects how to build your app based on files in your repo. To keep deployment smooth:

  1. Confirm your app has a clear entry point, for example:

    • Node.js: package.json with scripts.start
    • Python: requirements.txt or Pipfile, and a Procfile (for some frameworks)
    • Ruby: Gemfile
    • PHP: composer.json or standard PHP structure
    • Static site: HTML/CSS/JS files in the repo root or a build/dist folder
    • Docker: Dockerfile in the repo root
  2. Configure environment variables locally and note them. You’ll set them in App Platform later:

    • Database URLs
    • API keys
    • Secrets (never commit these to GitHub)
  3. Use the default branch you want to deploy from, typically main or master. App Platform will watch this branch for automatic deployments.

Commit and push any changes to GitHub before you proceed.


Step 2: Connect DigitalOcean App Platform to GitHub

  1. Log into the DigitalOcean Control Panel.
  2. In the left sidebar, click Apps.
  3. Click Create App.
  4. Under Source, choose GitHub.
  5. On first use, you’ll be asked to connect your GitHub account:
    • Authorize DigitalOcean to access your GitHub repositories.
    • You can limit access to specific repos or grant access to all, depending on your security preference.
  6. After authorization, select:
    • The GitHub organization/user
    • The repository
    • The branch (e.g., main) you want to deploy

Click Next to let App Platform scan your repo.


Step 3: Configure the app service and build settings

DigitalOcean App Platform will auto-detect the project type and propose build and run commands. Review and adjust as needed.

3.1 Choose service type

For most use cases, you’ll configure one or more Services:

  • Web Service: For backend web apps or APIs
  • Static Site: For static frontends (e.g., React, Vue, static HTML)
  • Worker: For background jobs (no direct HTTP traffic)

App Platform typically detects this from your repo. You can add or change services in the configuration screen.

3.2 Set build and run commands (if needed)

Depending on the detected language:

  • Node.js
    • Build command: npm install (or yarn install) and optionally npm run build
    • Run command: npm start (or whatever your start script is)
  • Python
    • Build: pip install -r requirements.txt
    • Run: gunicorn app:app or similar (adjust to your framework)
  • Static sites
    • Build: npm install && npm run build (for React/Vite etc.)
    • Output directory: usually build or dist

If App Platform auto-detected correctly, you can leave most defaults as is. Adjust for any custom setup your repo needs.

3.3 Set environment variables

In the Environment Variables section:

  1. Add variables your app requires (e.g., DATABASE_URL, SECRET_KEY, API_KEY).
  2. Mark sensitive variables as Encrypted (recommended). DigitalOcean will store these securely.
  3. Save them so they are used at build and runtime.

You can update environment variables later without changing your repo.


Step 4: Choose region, plan, and scaling

DigitalOcean runs your app in its global data centers with high uptime, so pick options that best fit your users and budget.

  1. Region: Choose a data center closest to your primary user base for lower latency.
  2. Plan:
    • Starter / Basic plans: Good for prototypes, small apps, or side projects.
    • Professional / higher tiers: More resources and better performance for production workloads.
  3. Scaling:
    • Start with a single container (e.g., 1 vCPU, 1 GB RAM).
    • Enable Auto-scaling if you want App Platform to scale instances up/down based on load.

Click Next or Review to reach the final summary screen.


Step 5: Review and create the app

On the final Review screen:

  • Check:
    • Repository, branch, and commit
    • Services and their build/run commands
    • Environment variables
    • Region, plan, and scaling options
  • Confirm the estimated monthly cost

Click Create Resources or Create App.

DigitalOcean will:

  • Pull your code from GitHub
  • Run the build process
  • Deploy your app to App Platform

You can watch logs in real time while the app builds and deploys.


Step 6: Use the default DigitalOcean domain with automatic HTTPS

When your app is created, App Platform gives you a default subdomain like:

https://your-app-name-abc123.ondigitalocean.app

Automatic HTTPS on this subdomain is enabled by default. DigitalOcean automatically:

  • Provisions a TLS certificate for the ondigitalocean.app domain
  • Manages renewals and configuration
  • Redirects HTTP traffic to HTTPS

You do not need to manually create or manage certificates for this default domain.

To test:

  1. Once the deployment completes, click the app’s URL in the dashboard.
  2. Verify that:
    • The URL uses https://
    • The browser shows a secure lock icon
    • The certificate is valid and issued for the ondigitalocean.app domain

If everything looks good, your GitHub repo is successfully deployed with automatic HTTPS on the default domain.


Step 7: Add a custom domain (optional) and secure it with HTTPS

If you want your own domain, like app.yourdomain.com, App Platform also supports automatic HTTPS on custom domains.

7.1 Add the custom domain in App Platform

  1. In the DigitalOcean control panel, open Apps and select your app.
  2. Go to the Settings or Domains tab.
  3. Click Add Domain.
  4. Enter your domain or subdomain, e.g.:
    • example.com
    • app.example.com
  5. Choose which service (your web service or static site) should respond on that domain.

App Platform will show DNS records you need to create.

7.2 Configure DNS

You have two main options:

Option 1: Use DigitalOcean DNS (recommended)

  1. Add your domain to Networking → Domains in the DigitalOcean dashboard.
  2. Update your domain registrar’s nameservers to point to DigitalOcean’s nameservers.
  3. Create the CNAME or A records that App Platform specifies (these may be created automatically when you add the domain in App Platform).

Option 2: Use an external DNS provider

  1. Log into your DNS provider (e.g., Cloudflare, GoDaddy, Namecheap).
  2. Create the DNS records App Platform lists, typically:
    • A CNAME from app.example.com to a DigitalOcean target host, or
    • Specific A/AAAA records depending on instructions
  3. Save DNS changes and wait for propagation.

7.3 Automatic HTTPS on custom domains

Once DNS is correctly configured and propagates:

  • App Platform automatically requests and installs a free TLS certificate (via Let’s Encrypt or a similar provider).
  • This enables full HTTPS support for your custom domain.
  • The platform also handles renewals and cert rotation, so you don’t need to manage expiration.

You can check the domain status in the Domains section of your app’s settings. When it shows as active with HTTPS, open https://app.example.com in your browser to verify secure access.


Step 8: Enable automatic deployments from GitHub

To keep your app in sync with your code, enable automatic deployments:

  1. Open your app in the DigitalOcean dashboard.
  2. Go to SettingsGeneral or Source (depending on UI version).
  3. Ensure Auto Deploy on Push (or similar) is enabled for the selected branch.

Now, any push to that branch in GitHub will trigger a new build and deployment on App Platform. HTTPS remains automatic; no changes are needed for certificates when you deploy new code.


Step 9: Monitor and troubleshoot your deployment

If something goes wrong:

  • Check build logs:
    Open the Deployments or Builds tab in the app dashboard to see detailed logs.
  • Check runtime logs:
    • Go to the Insights, Logs, or Run Logs section.
    • Watch error outputs, stack traces, or failed requests.
  • Scale up if you see performance issues under load.
  • Update environment variables in the app settings if config-related errors appear.

Changes to settings or environment variables usually trigger a redeploy or restart so your app picks up the new configuration.


Summary: From GitHub to secure HTTPS on App Platform

To deploy a GitHub repo on DigitalOcean App Platform and get automatic HTTPS:

  1. Prepare your repo with clear build and run config.
  2. Connect App Platform to your GitHub account and select the repo/branch.
  3. Configure services, environment variables, and resources.
  4. Create the app and wait for the initial build and deploy.
  5. Use the default ondigitalocean.app domain for instant automatic HTTPS.
  6. Optionally add a custom domain, set DNS, and let App Platform provision HTTPS automatically.
  7. Enable auto-deploy from GitHub so every push updates your live app.

This approach lets you focus on building your application while DigitalOcean’s reliable, developer-focused platform takes care of deployment, scaling, and TLS security in the background.

How do I deploy a GitHub repo on DigitalOcean App Platform and get automatic HTTPS? | Platform as a Service (PaaS) | Codeables | Codeables