Configuring Static Website Services with flightcontrol.json
Static Web Service Attributes
The type for static web services is static, and should be specified like the following:
type: 'static'Common Service Configuration
Before configuring the service-specific options below, you should review the Common Service Configuration that applies to all service types. This includes important settings for:
- Name
- Environment variables
- Build configuration
- Watch paths
- And moreā¦
Static-Specific Options
The following attributes are specific to static web services:
Install, Build, and Post Build Commands
basePath: string
- Example:
"basePath": "./apps/frontend" - Optional, defaults to
. - The directory containing your application code, relative to the repository root
- Allows you to specify in which folder the following build commands should run
installCommand: string
- Example:
"installCommand": "./install.sh" - Optional, intelligent default based on your language and framework detected at the
basePath - What we use to install dependencies for your build
buildCommand: string
- Example:
"buildCommand": "blitz build" - Optional, intelligent default based on your language and framework detected at the
basePath - What we use to build your app
postBuildCommand: string
- Example:
"postBuildCommand": "./postBuildCommand.sh" - Optional, Empty by Default
- Used as a build hook to run any operation after your build is complete
- Note:
buildCommandmust be set forpostBuildCommandto be used
Output Directory
outputDirectory: string
- Example:
"outputDirectory": "web/dist" - Optional with default:
"public" - Relative to the configured
basePath. If base path isweband built files are atweb/dist, then output directory should be set todist - All the files in this directory will be served statically via the CloudFront Content Delivery Network (CDN)
Single Page Application
singlePageApp: boolean
- Example:
"singlePageApp": true - Optional with default:
false - When true, all routes will load your root
/page. - This should be enabled for sites like create-react-app and Redwood, but not for static site generators like Next.js, Gatsby, etc.
Cloudfront Auto Cache Invalidation
cloudfrontAutoCacheInvalidation: boolean
- Example:
"cloudfrontAutoCacheInvalidation": true - Optional with default:
true - Enables automatic cache invalidation for Cloudfront distributions after successful deployments
Origin Shield
originShieldEnabled: boolean
- Example:
"originShieldEnabled": true - Optional with default:
true - Enables origin shield for Cloudfront distributions. Origin Shield is a feature of CloudFront that helps reducing latency and improving performance, mainly useful for serving static assets. Could increase latency for dynamic content like API requests.
Version History Count
versionHistoryCount: number
- Example:
"versionHistoryCount": 5 - Optional with default:
10 - Number of previous versions to keep for rollback purposes
Integrations
integrations: object
Under the integrations key, you can configure integrations with third-party services. At this time, the only supported integration is with Sentry.
Upload Sentry Source Maps
uploadSentrySourceMap: boolean
- Example:
"integrations": { "uploadSentrySourceMap": true } - Optional with default:
false - Enables uploading source maps to Sentry. This is useful for debugging errors in production. For more, see our Sentry guide.