Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion docs-developer/deploying.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

Our hosting service is [Netlify](https://www.netlify.com/). Deploying on a nginx instance is also possible, see below.

The repository config sets Netlify's publish directory to `dist/browser` in
[`netlify.toml`](/netlify.toml).

## Deploy to production

The `production` branch is configured to be automatically deployed to
Expand Down Expand Up @@ -94,6 +97,6 @@ document](https://docs.google.com/document/d/16YRafdIbk4aFgu4EZjMEjX4F6jIcUJQsaz
# Deploying on a nginx instance

To deploy on nginx (without support for direct upload from the Firefox UI), run `yarn build-prod`
and point nginx at the `dist` directory, which needs to be at the root of the webserver. Additionally,
and point nginx at the `dist/browser` directory, which needs to be at the root of the webserver. Additionally,
a `error_page 404 =200 /index.html;` directive needs to be added so that unknown URLs respond with index.html.
For a more production-ready configuration, have a look at the netlify [`_headers`](/res/_headers) file.
3 changes: 3 additions & 0 deletions netlify.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
[build]
publish = "dist/browser"

[context.l10n]
command = "yarn build-l10n-prod"
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
"protoc": "npx -p protobufjs-cli pbjs -t static-module -w commonjs -o ./src/profile-logic/import/proto/simpleperf_report.js ./src/profile-logic/import/proto/simpleperf_report.proto && npx -p protobufjs-cli pbts -o ./src/profile-logic/import/proto/simpleperf_report.d.ts ./src/profile-logic/import/proto/simpleperf_report.js",
"license-check": "devtools-license-check",
"preinstall": "node bin/pre-install.js",
"publish": "rimraf public_html && cp -r dist public_html",
"serve-static": "ws -d dist/ -s index.html -p 4243",
"publish": "rimraf public_html && cp -r dist/browser public_html",
"serve-static": "ws -d dist/browser/ -s index.html -p 4243",
"start": "cross-env NODE_ENV=development node scripts/run-dev-server.mjs",
"start-prod": "yarn build-prod && yarn serve-static",
"start-l10n": "cross-env NODE_ENV=development L10N=1 node scripts/run-dev-server.mjs",
Expand Down
2 changes: 1 addition & 1 deletion scripts/build-symbolicator.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const symbolicatorConfig = {
...nodeBaseConfig,
metafile: true,
entryPoints: ['src/symbolicator-cli/index.ts'],
outfile: 'dist/symbolicator-cli.js',
outfile: 'dist/node-tools/symbolicator-cli.js',
};

async function build() {
Expand Down
2 changes: 1 addition & 1 deletion scripts/build.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { mainBundleConfig } from './lib/esbuild-configs.mjs';
import { cleanDist, saveMetafile } from './lib/build-utils.mjs';

async function build() {
cleanDist();
cleanDist('dist/browser');
const buildResult = await esbuild.build(mainBundleConfig);
saveMetafile(buildResult);
console.log('✅ Main browser build completed');
Expand Down
21 changes: 11 additions & 10 deletions scripts/lib/esbuild-configs.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const __dirname = path.dirname(__filename);
const projectRoot = path.normalize(path.join(__dirname, '..', '..'));

const isProduction = process.env.NODE_ENV === 'production';
const browserDistDir = 'dist/browser';

// Configuration shared by both node and browser builds
const baseConfig = {
Expand Down Expand Up @@ -68,7 +69,7 @@ export const mainBundleConfig = {
sourcemap: true,
splitting: true,
entryPoints: ['src/index.tsx'],
outdir: 'dist',
outdir: browserDistDir,
metafile: true,
publicPath: '/',
entryNames: '[name]-[hash]',
Expand All @@ -90,14 +91,14 @@ export const mainBundleConfig = {
copy({
resolveFrom: projectRoot,
assets: [
{ from: ['res/_headers'], to: ['dist'] },
{ from: ['res/_redirects'], to: ['dist'] },
{ from: ['res/contribute.json'], to: ['dist'] },
{ from: ['res/robots.txt'], to: ['dist'] },
{ from: ['res/service-worker-compat.js'], to: ['dist'] },
{ from: ['res/img/favicon.png'], to: ['dist/res/img'] },
{ from: ['docs-user/**/*'], to: ['dist/docs'] },
{ from: ['locales/**/*'], to: ['dist/locales'] },
{ from: ['res/_headers'], to: [browserDistDir] },
{ from: ['res/_redirects'], to: [browserDistDir] },
{ from: ['res/contribute.json'], to: [browserDistDir] },
{ from: ['res/robots.txt'], to: [browserDistDir] },
{ from: ['res/service-worker-compat.js'], to: [browserDistDir] },
{ from: ['res/img/favicon.png'], to: [`${browserDistDir}/res/img`] },
{ from: ['docs-user/**/*'], to: [`${browserDistDir}/docs`] },
{ from: ['locales/**/*'], to: [`${browserDistDir}/locales`] },
],
}),
generateHtmlPlugin({
Expand All @@ -122,7 +123,7 @@ export const photonConfig = {
sourcemap: true,
publicPath: '/photon/',
entryPoints: ['res/photon/index.js'],
outdir: 'dist/photon',
outdir: `${browserDistDir}/photon`,
metafile: true,
plugins: [
generateHtmlPlugin({
Expand Down
2 changes: 1 addition & 1 deletion scripts/run-dev-server.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const argv = yargs(hideBin(process.argv))
startDevServer(mainBundleConfig, {
port,
host,
distDir: 'dist',
distDir: 'dist/browser',
cleanDist: true,
onServerStart: (profilerUrl) => {
const barAscii =
Expand Down
4 changes: 2 additions & 2 deletions scripts/run-photon-dev-server.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ const host = process.env.FX_PROFILER_PHOTON_HOST || 'localhost';
startDevServer(photonConfig, {
port,
host,
distDir: 'dist',
distDir: 'dist/browser',
fallback: 'photon/index.html',
cleanDist: false, // Don't clean the whole dist, just photon
cleanDist: false, // Don't clean the whole dist/browser, just photon
onServerStart: (url) => {
console.log(`> Photon styling is listening at: ${url}/photon/\n`);
},
Expand Down
6 changes: 3 additions & 3 deletions src/symbolicator-cli/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
* To use it it first needs to be built:
* yarn build-symbolicator-cli
*
* Then it can be run from the `dist` directory:
* node dist/symbolicator-cli.js --input <input profile> --output <symbolicated profile> --server <symbol server URL>
* Then it can be run from the `dist/node-tools` directory:
* node dist/node-tools/symbolicator-cli.js --input <input profile> --output <symbolicated profile> --server <symbol server URL>
*
* For example:
* node dist/symbolicator-cli.js --input samply-profile.json --output profile-symbolicated.json --server http://localhost:3000
* node dist/node-tools/symbolicator-cli.js --input samply-profile.json --output profile-symbolicated.json --server http://localhost:3000
*
*/

Expand Down
4 changes: 2 additions & 2 deletions workbox-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ module.exports = {
// convenient that we can just access it from a browser.
/^\/sw\.js/,
],
globDirectory: 'dist',
globDirectory: 'dist/browser',
globPatterns: ['**/*'],
globIgnores: [
// exclude user docs and photon from the cache
Expand All @@ -55,5 +55,5 @@ module.exports = {
// This is the service worker file name. It should never change if we want
// that the browser updates it. If this changes it will never be updated
// and the user will be stuck with an old version.
swDest: 'dist/sw.js',
swDest: 'dist/browser/sw.js',
};
Loading