Question

Use output_dir in App Plateform

Hello,

I have Nx workspace which build my Angular app inside dist/apps/{app_name}. Even if I use output_dir option inside my app spec yaml file (seen in the doc) to point to dist/apps/{app_name} the files taken are, for exemple /apps/front/index.html instead of /index.html. It seems that the default params (_static, public or dist) override the output_dir option or the default params (here dist) has priority over output_dir option.

Is there a solution to use dist/apps/{app_name} as dir for my Angular app ?

Actually my work-around is to do yarn nx build front && mkdir -p public && mv dist/apps/front/* public && rm -rf dist which is dirty.

Thanks,


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.

Kamal Nasser
DigitalOcean Employee
DigitalOcean Employee badge
November 11, 2020
Accepted Answer

Hi @scorsi

The output_dir option will take priority over the default behavior of checking for a few known directory names (_static, public, dist, build).

It sounds like the output_dir option isn’t being set. If you export your app spec in the UI (App -> Settings -> View App Spec), do you see it on the static site?

UPDATE (Nov 24, 2020) The control panel now supports the Output Directory option in the component settings.

To set this option properly, you will need to update your app spec via doctl or the API as it is not yet exposed via the Web UI:

  1. Install doctl
  2. List your apps and find your app’s UUID: doctl apps list
  3. Save your app’s spec to a file: doctl apps spec get APP-UUID > app.yaml
  4. Open app.yaml in a text editor and add the output_dir property.
  5. Update your app with the new spec: doctl apps update --spec app.yaml APP-UUID. This will kick off a new deployment

Let me know if that works!

Where is this Output Directory option in the component settings ?

Im needing to set the output_dir due to using symfony and thats where all my assets are served/stored so atm im getting 403 within root but app loads under https://blah.com/public

alerts:
- rule: DEPLOYMENT_FAILED
- rule: DOMAIN_FAILED
databases:
- engine: PG
  name: db
  version: "12"
envs:
- key: APP_ENV
  scope: RUN_AND_BUILD_TIME
  value: dev
features:
- buildpack-stack=ubuntu-22
ingress:
  rules:
  - component:
      name: vectisplanner
    match:
      path:
        prefix: /
name: vectisplanner
region: lon
services:
- build_command: |
    composer update
    composer install
    npm run build
  environment_slug: php
  envs:
  - key: DATABASE_URL
    scope: RUN_TIME
    value: ${db.DATABASE_URL}
  github:
    branch: main
    deploy_on_push: true
    repo: Wordlesschunk/VectisPlanner
  http_port: 8080
  instance_count: 1
  instance_size_slug: basic-xs
  name: vectisplanner
  run_command: heroku-php-apache2
  source_dir: /

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