Question

Deploy angular app on Digitalocean App Platform

it’s my first time deploying an Angular application on DigitalOcean app platform (I develop React application usually). The problem I am experiencing here is the failure of application’s health checks during the deployment phase. I read the DigitalOcean’s documentation about health checks but still i can’t figure out what’s the problem.

These are my App Spec file and the screenshots of the DO log console.

alerts:
- rule: DEPLOYMENT_FAILED
- rule: DOMAIN_FAILED
envs:
- key: NODE_OPTIONS
  scope: RUN_AND_BUILD_TIME
  value: max-old-space-size=4096
- key: GENERATE_SOURCEMAP
  scope: RUN_AND_BUILD_TIME
  value: "false"
ingress:
  rules:
  - component:
      name: ------------
    match:
      path:
        prefix: /
name: seahorse-app
region: fra
services:
- build_command: npm run build
  environment_slug: node-js
  github:
    branch: master
    deploy_on_push: true
    repo: -----------------
  health_check:
    http_path: /
  http_port: 4200
  instance_count: 1
  instance_size_slug: professional-s
  name: ------------
  run_command: npm start
  source_dir: /

enter image description here


Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Bobby Iliev
Site Moderator
Site Moderator badge
May 15, 2023

Hi there,

The npm run starts a development server which is not really needed when deploying to production. What you could do instead is to deploy your Angular app as a static site rather than a web service.

You can follow the steps here on how to do that:

https://docs.digitalocean.com/products/app-platform/how-to/manage-static-sites/

Here is an example App Spec YAML file that should also work:

name: your-app-name
region: your-region (e.g., nyc)
services:
- environment_slug: static-site
  github:
    repo: your-github-username/your-repo-name
    branch: main
    deploy_on_push: true
static_sites:
- name: your-static-site-name
  github:
    repo: your-github-username/your-repo-name
    branch: main
    deploy_on_push: true
  routes:
  - path: /
  build_command: npm run build
  output_dir: /dist

If you prefer to use a web service rather than a static site, what you could do is set up a demo repository and share a link to it here so I could try to deploy it and further debug the health check problem.

Let me know how it goes1

Best,

Bobby

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel