Loading...

Getting started

With Front End Hosting - Advanced, one NodeJS application is provisioned with three environments: Development (Dev), Staging (Stage), and Production (Prod).

To view an application: 

  1. Sign in to the Cloud Platform user interface.
  2. In the top menu, click Develop.
  3. Select your organization.
  4. Select an application.
  5. Click View <application name>.

 

New environments are provisioned with the default content page.

To verify that a site is working correctly, visit the default URL of a specific environment:

Setting up

  1. Add a public key to your Acquia profile:
  1. Clone the application’s repository:
  1. Copy your code to a new Git repository:
  1. Configure Package.Json
    The package.json file must be located in the root folder of your project that contains the following commands. These are required to host a NodeJS site.
  • Build command configuration

    Utilize NodeJS Hosting's build system by setting npm install && npm run build as your build command, assuring a robust and efficient deployment process.

"scripts": {
    ...
    "build": "npm install && next build",
    "start": "next start",
  },
 	 
  • Framework based custom configuration
    ​Configure the start script in your package.json file in order to initiate the production server. Use the command that corresponds to your specific framework.

Node.js:

{
"scripts": {
    "build": "npm install",
    "start": "node index.js"
  },
}

Next.js:

{
  "scripts": {
    "build": "npm install && next build",
    "start": "next start"
  }
}

Nuxt.js:

{
  "scripts": {
    "build": "npm install && nuxt build",
    "start": "nuxt start"
  }
}

React.js:

{
  "scripts": {
    "build": "npm install && react-scripts build",
    "start": "react-scripts start",
  }
}

Angular.js:

{
  "scripts": {
    "build": "npm install && ng build --prod",
    "start": "ng serve --port $PORT --host 0.0.0.0 --disable-host-check --open",
    "serve": "http-server -c-1 dist/your-project-name"
  }
}
  • For Angular.js, when testing this configuration locally, ensure execution of the required commands on a Linux machine.
    Next, run the command PORT=3000 npm start to launch the Angular application on any Linux machine.

Vue.js:

{
  "scripts": {
    "build": "npm install && vue-cli-service build",
    "start": "serve -s dist",
    "serve": "vue-cli-service serve",
  }
}
  • To serve production builds of frameworks like Angular, React, and Vue, we recommend using either serve or http-server. These Node.js packages provide simple and efficient ways to host static files.

Installation

Install your preferred package using npm:

$ npm install serve

or

$ npm install http-server

Usage

After you build the project (typically into a dist directory), start the production server with the following commands:

serve -s dist

 

http-server dist

You can also include these commands in the start script of your package.json for easy deployment.

5. Environment variables Configuration:

To use the latest environment variable values in your Node.js code, incorporate them during the Node.js build process. Any changes to environment variables will require a redeployment of your Front End Hosting - Advanced site to update both build and runtime environments.

6. Deployment workflow:

7. Deploy the branch:

In the future, new commits to the new branch trigger its deployment automatically.

Subscription details

For information on viewing your subscription details, refer to Managing subscriptions > Viewing subscriptions.

Monitoring

For monitoring instructions, refer to Using Stack Metrics to monitor activity on your environments.

Build minutes

As part of the code build/deployment process, multiple commands run in the backend to produce a build artifact and deploy it to an environment. These include:

  • git commands to clone code from an application repository
  • npm run-build commands to produce the deployable bundle of an environment branch

Application deployment

The total build time is tracked as build minutes.

  • If a customer goes over the allocated build minutes, they can continue to use Front End Hosting - Advanced. However, an Account Manager is notified and the account holder is contacted to upgrade the assigned entitlement.
  • Build is implicitly triggered with each deployment. Build logs are visible in “Task Logs” in Cloud UI. A build is retriggered 2 times upon failure.
  • Post Deployment Cloud Actions can be enabled/disabled to clear Varnish/CDN cache.

Domain configuration

CDN configuration

Did not find what you were looking for?

If this content did not answer your questions, try searching or contacting our support team for further assistance.

Back to Section navigation
Back to Site navigation