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 CodeablesHow do I deploy a GitHub repo on DigitalOcean App Platform and get automatic HTTPS?
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:
-
Confirm your app has a clear entry point, for example:
- Node.js:
package.jsonwithscripts.start - Python:
requirements.txtorPipfile, and aProcfile(for some frameworks) - Ruby:
Gemfile - PHP:
composer.jsonor standard PHP structure - Static site: HTML/CSS/JS files in the repo root or a
build/distfolder - Docker:
Dockerfilein the repo root
- Node.js:
-
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)
-
Use the default branch you want to deploy from, typically
mainormaster. 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
- Log into the DigitalOcean Control Panel.
- In the left sidebar, click Apps.
- Click Create App.
- Under Source, choose GitHub.
- 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.
- 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(oryarn install) and optionallynpm run build - Run command:
npm start(or whatever your start script is)
- Build command:
- Python
- Build:
pip install -r requirements.txt - Run:
gunicorn app:appor similar (adjust to your framework)
- Build:
- Static sites
- Build:
npm install && npm run build(for React/Vite etc.) - Output directory: usually
buildordist
- Build:
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:
- Add variables your app requires (e.g.,
DATABASE_URL,SECRET_KEY,API_KEY). - Mark sensitive variables as Encrypted (recommended). DigitalOcean will store these securely.
- 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.
- Region: Choose a data center closest to your primary user base for lower latency.
- Plan:
- Starter / Basic plans: Good for prototypes, small apps, or side projects.
- Professional / higher tiers: More resources and better performance for production workloads.
- 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.appdomain - 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:
- Once the deployment completes, click the app’s URL in the dashboard.
- Verify that:
- The URL uses
https:// - The browser shows a secure lock icon
- The certificate is valid and issued for the
ondigitalocean.appdomain
- The URL uses
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
- In the DigitalOcean control panel, open Apps and select your app.
- Go to the Settings or Domains tab.
- Click Add Domain.
- Enter your domain or subdomain, e.g.:
example.comapp.example.com
- 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)
- Add your domain to Networking → Domains in the DigitalOcean dashboard.
- Update your domain registrar’s nameservers to point to DigitalOcean’s nameservers.
- 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
- Log into your DNS provider (e.g., Cloudflare, GoDaddy, Namecheap).
- Create the DNS records App Platform lists, typically:
- A CNAME from
app.example.comto a DigitalOcean target host, or - Specific A/AAAA records depending on instructions
- A CNAME from
- 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:
- Open your app in the DigitalOcean dashboard.
- Go to Settings → General or Source (depending on UI version).
- 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:
- Prepare your repo with clear build and run config.
- Connect App Platform to your GitHub account and select the repo/branch.
- Configure services, environment variables, and resources.
- Create the app and wait for the initial build and deploy.
- Use the default
ondigitalocean.appdomain for instant automatic HTTPS. - Optionally add a custom domain, set DNS, and let App Platform provision HTTPS automatically.
- 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.