App Platform is a Platform-as-a-Service (PaaS) offering that allows developers to publish code directly to DigitalOcean servers without worrying about the underlying infrastructure.
Visit the Apps page and click Create App.
Select the GitHub repository that contains your source code and specify the branch or tag in your repository that contains your app’s source code.
In the Source Directory field, specify the folder that contains the source.
If your app needs to access files outside of its subdirectory at runtime, use /
as the source directory.
At the beginning of the build, the entire repo is cloned to /workspace
. When you specify a source directory, it is used as the working directory for the entire build instead of /workspace
. Files outside of the selected source directory are accessible only during the build. At runtime, only files inside the source directory are accessible. Therefore, if your app needs to access files outside its subdirectory at runtime, you should not specify a source directory and instead adjust the build and run commands using cd <subdirectory>
directives as needed.
If you’d like to automatically re-deploy your app when pushing to this branch/tag, select Autodeploy and click Next.
Configure resources for your app.
Click Next.
If you want to use resource- and app-level environment variables, on the Environment page, click Edit to supply them. Click the Encrypt checkbox to ensure a variable’s value is encrypted in the App Spec. Click Next.
If you want to change the default name or project for your app, or choose the region where you would like your app to be hosted, click Edit on the Info page. Click Save and then click Next.
Review your app’s resources, environment variables and billing information on the Review page and then click Create Resources.
Once your app deploys, you can view the app at the URL at the top of the app’s Overview page.
For Node.js monorepos, you need to configure the build and run commands as follows when creating the app:
For YARN Workspaces:
cd <path-to-source-subdirectory>
yarn build
cd <path-to-source-subdirectory>
yarn serve
For Lerna and npm, Lerna and YARN, or Lerna and YARN Workspaces:
lerna bootstrap
to the scripts
property in the package.json
file:"scripts": {
"bootstrap": "lerna bootstrap",
"postinstall": "lerna bootstrap"
}
yarn bootstrap
cd <path-to-source-subdirectory>
yarn build
cd <path-to-source-subdirectory>
npm run serve
We provide the following sample monorepos that you can deploy using App Platform:
sample-monorepo
: A sample monorepo GitHub repository where each subdirectory is an independent app.sample-yarn-workspaces-monorepo
: A sample Node.js monorepo GitHub repository that uses Yarn workspaces and has an app with dependencies outside its subdirectory.sample-yarn-lerna-monorepo
: A sample Node.js monorepo GitHub repository that uses Lerna and has an app with dependencies outside its subdirectory.