Kokil Thapa - Professional Web Developer in Nepal
Freelancer Web Developer in Nepal with 15+ Years of Experience

Kokil Thapa is an experienced full-stack web developer focused on building fast, secure, and scalable web applications. He helps businesses and individuals create SEO-friendly, user-focused digital platforms designed for long-term growth.

Deploy an App on DigitalOcean App Platform

By Kokil Thapa | Last reviewed: August 2026

You want to ship code without managing Linux servers, configuring Nginx, or debugging PHP-FPM sockets at 2 AM. When you deploy an app on DigitalOcean App Platform, you trade low-level infrastructure control for a managed PaaS that handles builds, SSL, scaling, and routing automatically. This guide walks through the exact configuration steps, environment variable strategies, and production hardening techniques I use when moving clients from traditional VPS setups to managed application platforms.

For developers accustomed to provisioning their own infrastructure, such as those exploring cloud hosting services in Nepal, the shift to a PaaS requires adjusting how you handle configuration, assets, and state. Instead of SSH-ing into a box to edit .env files or restart services, everything becomes declarative. If you are building Laravel applications specifically, understanding this distinction prevents the most common deployment failures I see in production environments.

How do you configure a Laravel project to deploy an app on DigitalOcean App Platform?

Laravel is a first-class citizen on DigitalOcean App Platform, but it does not work out-of-the-box like a static site. The platform uses Nixpacks or Herokuish buildpacks to detect PHP projects, yet Laravel’s specific requirements—storage symlinks, config caching, and asset compilation—need explicit handling. In my experience working on production Laravel applications, relying solely on auto-detection leads to missing storage links and broken asset paths.

Git Pushmain branchBuild Phasecomposer installnpm run buildRelease Hookphp artisan migratestorage:linkLive InstancePHP-FPM + NginxEphemeral Filesystem — Use S3/Spaces for persistent uploads
Laravel deployment pipeline on DigitalOcean App Platform: build, release hooks, and ephemeral storage constraints

Set explicit build and run commands

Do not trust auto-detection for Laravel 12.x projects. Define your build command to compile Vite assets and install dependencies in the correct order. In the App Platform dashboard under Settings > Build & Run, set:

<!-- Build Command -->
composer install --no-dev --optimize-autoloader && npm ci && npm run build

<!-- Run Command -->
heroku-php-apache2 public/

The heroku-php-apache2 binary is included in the PHP buildpack and correctly configures Apache with PHP-FPM, pointing the document root to public/. Using php artisan serve in production is a critical mistake—it runs a single-threaded development server that will collapse under minimal load.

Handle storage and cache in ephemeral environments

DigitalOcean App Platform containers are ephemeral. Any file written to disk during runtime disappears on redeployment. This breaks Laravel’s default file-based sessions, cache, and user uploads. You must configure external drivers before deploying:

  • Sessions & Cache: Set SESSION_DRIVER=database or redis, and CACHE_STORE=redis or database.
  • File Uploads: Configure FILESYSTEM_DISK=s3 and point to DigitalOcean Spaces (S3-compatible). Never store user uploads locally.
  • Logs: Use LOG_CHANNEL=stderr so logs stream to the App Platform console instead of vanishing with the container.

Migrations and storage linking must happen after each deploy but before traffic routes to the new container. Add a pre-deploy hook in your app spec or dashboard:

php artisan migrate --force && php artisan storage:link && php artisan config:cache && php artisan route:cache && php artisan view:cache

The --force flag is mandatory because the platform runs in non-interactive mode. Without caching config, routes, and views, every request parses PHP files unnecessarily—a performance penalty that matters at scale. For teams evaluating whether to hire a Laravel developer in Nepal versus managing deployments internally, these configuration details often determine whether a PaaS migration succeeds or stalls.

What environment variables and secrets does DigitalOcean App Platform require?

Environment management is where most deployments fail silently. The platform injects variables at runtime, but Laravel expects specific keys, and the platform provides its own service credentials in a format that doesn’t match Laravel’s conventions natively.

Map managed database credentials correctly

When you attach a DigitalOcean Managed Database, the platform exposes connection strings as ${db.DATABASE_URL}. Laravel cannot parse this directly. Create individual environment variables that reference the component values:

Laravel VariableApp Platform ReferenceNotes
DB_CONNECTIONmysql or pgsqlSet manually; not provided by platform
DB_HOST${db.HOSTNAME}Internal hostname resolves within VPC
DB_PORT${db.PORT}Usually 25060 for managed MySQL
DB_DATABASE${db.DATABASE}Auto-created when attaching DB
DB_USERNAME${db.USERNAME}Managed DB user, not root
DB_PASSWORD${db.PASSWORD}Rotated automatically by platform

Never hardcode database credentials. The platform rotates passwords periodically, and hardcoded values will break unexpectedly. Always use the ${component.VARIABLE} interpolation syntax.

Encrypt sensitive values and manage APP_KEY

Your APP_KEY must persist across deployments. Generate it once locally with php artisan key:generate --show, then add it as an encrypted environment variable in the dashboard. If this key changes, all existing encrypted data (password resets, signed URLs, session tokens) becomes invalid. Mark production secrets as "encrypted" in the App Platform UI—they are decrypted only at runtime and never appear in plain text in logs or API responses.

Configure trusted proxies for HTTPS

DigitalOcean App Platform terminates SSL at the load balancer. Your Laravel application receives HTTP requests internally, which causes url() helpers and redirects to generate http:// links. Add the following to config/trustedproxy.php or your middleware:

'proxies' => '*',

This tells Laravel to trust the X-Forwarded-Proto header from the platform’s proxy layer. Without this, OAuth callbacks, password reset emails, and canonical URLs break in production while working perfectly locally. This is one of the most frequent issues I encounter when auditing deployments for clients transitioning from traditional hosting.

How does DigitalOcean App Platform compare to Droplets and other PaaS options?

Choosing between a managed PaaS and self-managed infrastructure depends on team size, budget, and operational tolerance. Having shipped projects on both traditional Droplets using CI/CD pipelines with Deployer and managed platforms, the trade-offs are concrete.

App Platform (Managed)SSL / DNS / Load BalancerAuto-scaling ContainersBuild Pipeline & RollbacksLog Aggregation & MetricsYour Code OnlyDroplet (Self-Managed)You: SSL / Certbot / NginxYou: Scaling / MonitoringYou: CI/CD / Deploy ScriptsYou: Logs / Backups / SecurityFull Root Access & Control
Responsibility split: App Platform abstracts infrastructure layers that Droplet users must maintain manually
CriteriaDigitalOcean App PlatformDroplet + Deployer
Setup TimeMinutes (connect repo, deploy)Hours to days (OS, web server, DB, SSL, firewall)
Monthly Cost (Small App)$12–25 USD (~NPR 1,600–3,300)$6–12 USD (~NPR 800–1,600) + your time
ScalingAutomatic horizontal scalingManual vertical scaling or custom orchestration
SSH AccessNo (console access only)Full root SSH access
Custom Server ConfigLimited (build/run commands only)Unlimited (full OS control)
Maintenance BurdenNear zero (platform handles patches)Ongoing (security updates, PHP upgrades, monitoring)
Best ForStartups, APIs, client projects with small teamsHigh-traffic apps needing custom tuning, legacy systems

For most client projects I deliver—including legal-tech portals and eCommerce sites—the App Platform’s reduced maintenance burden justifies the higher base cost. When a project requires custom Nginx rules, long-running WebSocket processes, or costs exceeding $100/month at scale, I recommend Droplets with automated deployment tooling instead. The decision hinges on whether your bottleneck is developer time or compute cost.

How do you troubleshoot failed deployments and performance issues on App Platform?

Even with correct configuration, deployments fail. The platform’s build logs are your primary diagnostic tool, but knowing what to look for separates quick fixes from hours of guessing.

Diagnose build failures systematically

  1. Check dependency resolution first: Composer or npm lock file mismatches cause 60% of build failures. Ensure composer.lock and package-lock.json are committed and up to date.
  2. Verify PHP version compatibility: Laravel 12.x requires PHP 8.2 minimum. Set DO_PHP_VERSION=8.4 in environment variables if your project targets the latest stable release. The platform defaults may lag behind.
  3. Inspect memory limits during build: Asset compilation with Vite can exceed default build container memory. If builds timeout or OOM, upgrade the build instance size temporarily or optimize your Vite config to chunk assets.
  4. Validate run command syntax: A typo in the run command causes immediate crash loops. Test the exact command locally in a Docker container matching the platform’s PHP version before deploying.

Monitor runtime health and resource usage

After successful deployment, watch the metrics tab for CPU and memory saturation. App Platform containers have hard limits—if your app exceeds them, it restarts silently. Set up alerts for restart frequency. For Laravel apps, common culprits include unoptimized Eloquent queries loading excessive records, missing cache on expensive computations, and synchronous queue processing. Move heavy workloads to background jobs using Redis queues, and ensure your queue workers run as separate App Platform worker components rather than inside the web container.

Deployment Failed?Did the build complete successfully?NOYESBuild Phase Issues• Lock file mismatch• PHP version wrong• OOM during asset buildRuntime Phase Issues• Wrong run command• Missing env variables• Crash loop / port bindFix deps → RebuildCheck logs → Fix config
Troubleshooting decision tree: isolate whether failures occur during build or runtime to target fixes efficiently

Handle domain and SSL edge cases

Custom domains provision SSL automatically via Let’s Encrypt, but DNS propagation delays can cause temporary certificate errors. Always verify CNAME records point to the platform’s provided endpoint before adding the domain. For apex domains (naked domains without www), use an ALIAS or ANAME record if your DNS provider supports it; otherwise, redirect the apex to www at the DNS level. The platform does not support A-record binding for apex domains directly. This catches many teams off guard when migrating established domains with existing SEO equity. Proper canonical URL handling during migration preserves rankings—a concern I address regularly when providing technical SEO audits for clients moving to managed platforms.

Deploy an App on DigitalOcean App Platform With Confidence

Shipping to a managed platform removes entire categories of operational toil, but it demands discipline around statelessness, environment configuration, and framework-specific conventions. Start with explicit build/run commands, externalize all persistent storage, map database credentials correctly, and validate trusted proxy settings before your first production deploy. Monitor resource usage proactively and treat build logs as your primary debugging interface. When configured properly, you gain reliable deployments with near-zero maintenance overhead—freeing your team to focus on application logic rather than infrastructure firefighting.

If you’re planning a migration to DigitalOcean App Platform or need help configuring Laravel, Node.js, or PHP deployments for production, reach out to discuss your project. I’ve helped teams across Nepal and globally transition from self-managed servers to managed platforms without downtime or data loss.

Frequently Asked Questions

A fully managed PaaS that builds, deploys, and scales applications directly from your Git repository without managing underlying servers or infrastructure.

Basic static sites are free. Dynamic PHP apps start at USD 5/month (approx NPR 670) for the Basic tier with shared CPU, while Professional plans with dedicated resources begin at USD 12/month (approx NPR 1,600).

Yes, it natively supports Laravel 12 running on PHP 8.2 through 8.4 via its buildpack detection system or custom Dockerfiles for specific extension requirements.

Add them in the App Platform dashboard under Settings > Environment Variables rather than committing a .env file. The platform injects these securely during runtime and allows you to mark sensitive values like APP_KEY or database passwords as encrypted so they remain hidden in logs and the UI after initial entry.

Yes, and I often recommend this for production Laravel systems. You can add a DigitalOcean Managed MySQL or PostgreSQL cluster as a component, then reference its connection string via environment variables. This separates compute from storage scaling, provides automated backups, and avoids the resource contention issues common when running databases on the same basic-tier app instance serving web traffic.

Common causes include missing PHP extensions not detected by the default buildpack, Composer memory limits being exceeded, or Node.js version mismatches during asset compilation. Check the build logs carefully. Adding a .php-version file or switching to a custom Dockerfile usually resolves extension issues. For memory errors, set COMPOSER_MEMORY_LIMIT=-1 in your build environment variables to allow unrestricted composer install execution.

App Platform now supports Workers and Jobs components specifically for background processing. Configure a separate worker component pointing to php artisan queue:work --tries=3 for queues, and use the built-in cron job scheduler for php artisan schedule:run. Do not run supervisors or cron daemons inside your main web container; isolating workers prevents long-running jobs from blocking HTTP responses and consuming web dyno memory.

It depends on operational capacity. For solo developers or small teams without dedicated DevOps staff, App Platform eliminates server maintenance overhead entirely. However, for high-traffic Nepali eCommerce sites where I need full control over PHP-FPM tuning, opcache configuration, and nginx rules, a Droplet with Deployer 7 remains more flexible and cost-effective at scale. App Platform trades configurability for convenience.

Connect your GitLab repository directly in the App Platform console under Source Control. Every push to your configured branch triggers an automatic build and deploy cycle. For monorepos or complex setups, use GitLab CI to run tests first, then trigger deployment via the DigitalOcean API only after passing. This prevents broken code from reaching production while maintaining zero-downtime rolling deployments through App Platform's native release management.

App Platform containers are ephemeral; local file uploads disappear on every redeploy. Configure Laravel's filesystem driver to use DigitalOcean Spaces (S3-compatible object storage) for all user uploads, media library assets, and generated documents. Update FILESYSTEM_DISK=spaces in your environment variables and add the league/flysystem-aws-s3-v3 package. Never store persistent files on the application container itself in any PaaS environment.

App Platform provisions free Let's Encrypt certificates automatically when you add a custom domain. Simply add your domain in the dashboard, update DNS CNAME or A records as instructed, and SSL activates within minutes. Wildcard certificates are supported for subdomains. There is no manual certbot configuration needed unlike traditional Droplet setups, making HTTPS enforcement straightforward even for Nepal-focused projects requiring both English and Nepali language subdomains.

Technically possible but generally not recommended. WordPress expects persistent local filesystem access for plugins, themes, and uploads, which conflicts with App Platform's ephemeral containers. While you could mount Spaces and configure WP_FILESYSTEM_METHOD, plugin compatibility issues are frequent. For WordPress clients, I consistently recommend a managed Droplet or specialized WordPress hosting instead. Reserve App Platform for Laravel, Symfony, or Node.js applications designed for stateless deployment patterns.

Use the built-in console access from the dashboard to run artisan commands, check logs, or inspect the runtime environment. Stream real-time application and access logs directly in the UI. For deeper debugging, enable Laravel Debugbar only in staging environments, never production. If issues persist, attach a temporary development service component with SSH access. Remember that container restarts reset state, so capture diagnostic data immediately before reproducing intermittent failures.

App Platform offers vertical scaling (larger instances) and horizontal scaling (more containers) but lacks fine-grained orchestration controls like pod affinity, custom autoscaling metrics, or service mesh networking. For most Nepali business applications and legal-tech portals I build, App Platform's scaling is sufficient. Only consider migrating to Kubernetes when you need multi-region failover, complex microservice communication patterns, or regulatory compliance requiring specific infrastructure topology that managed PaaS cannot provide.

Enable opcache by ensuring the PHP buildpack detects your framework correctly. Cache config, routes, and views during the build phase using a post-build command: php artisan optimize. Use Redis for session and cache drivers instead of file or database. Set appropriate container health checks to prevent routing traffic to warming instances. Monitor response times via App Platform metrics and upgrade to Professional tier if shared CPU throttling causes latency spikes during peak Nepali business hours.

Share this article

Quick Contact Options
Choose how you want to connect me: