Skip to content

Commit

Permalink
feat(production): use port 3001
Browse files Browse the repository at this point in the history
  • Loading branch information
dargmuesli committed May 25, 2023
1 parent f97b271 commit c61e8a6
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -233,4 +233,4 @@ RUN apk update && apk upgrade --no-cache
COPY --from=collect /srv/app/ ./

CMD [".output/server/index.mjs"]
HEALTHCHECK --interval=10s CMD wget -O /dev/null http://localhost:3000/api/healthcheck || exit 1
HEALTHCHECK --interval=10s CMD wget -O /dev/null http://localhost:3001/api/healthcheck || exit 1
2 changes: 1 addition & 1 deletion src/Dockerfile.arm64-v8
Original file line number Diff line number Diff line change
Expand Up @@ -242,4 +242,4 @@ RUN apk update && apk upgrade --no-cache
COPY --from=collect /srv/app/ ./

CMD [".output/server/index.mjs"]
HEALTHCHECK --interval=10s CMD wget -O /dev/null http://localhost:3000/api/healthcheck || exit 1
HEALTHCHECK --interval=10s CMD wget -O /dev/null http://localhost:3001/api/healthcheck || exit 1
4 changes: 3 additions & 1 deletion src/nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ for (const exclusion of SITEMAP_EXCLUSIONS) {
const BASE_URL =
'https://' +
(process.env.NUXT_PUBLIC_STACK_DOMAIN ||
`${process.env.HOST || 'localhost'}:3000`)
`${process.env.HOST || 'localhost'}:${
process.env.NODE_ENV === 'development' ? '3000' : '3001'
}`)

export default defineNuxtConfig({
app: {
Expand Down
2 changes: 1 addition & 1 deletion src/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"scripts": {
"dev": "nuxt dev",
"build": "nuxt build",
"start": "node .output/server/index.mjs",
"start": "PORT=3001 node .output/server/index.mjs",
"test": "vitest",
"test:e2e": "./tests/e2e/screenshots/test.sh",
"test:e2e:dev": "cross-env NUXT_PUBLIC_IS_TESTING=1 WAIT_ON_TIMEOUT=100000 pnpm test:e2e",
Expand Down
14 changes: 8 additions & 6 deletions src/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ import { defineConfig, devices } from '@playwright/test'
*/
// require('dotenv').config();

const baseUrl =
process.env.NODE_ENV === 'development'
? 'http://127.0.0.1:3000'
: 'http://127.0.0.1:3001'

/**
* See https://playwright.dev/docs/test-configuration.
*/
Expand Down Expand Up @@ -74,7 +79,7 @@ export default defineConfig({
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
/* Base URL to use in actions like `await page.goto('/')`. */
baseURL: 'http://127.0.0.1:3000',
baseURL: baseUrl,

/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: 'on-first-retry',
Expand All @@ -85,11 +90,8 @@ export default defineConfig({
command:
process.env.NODE_ENV === 'development'
? 'pnpm run dev'
: 'PORT=3001 pnpm run start',
url:
process.env.NODE_ENV === 'development'
? 'http://127.0.0.1:3000'
: 'http://127.0.0.1:3001',
: 'pnpm run start',
url: baseUrl,
reuseExistingServer: !process.env.CI,
},

Expand Down
2 changes: 1 addition & 1 deletion todo/server.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ describe('headers middleware', () => {
}).then((resp) => {
expect(resp.headers['content-security-policy']).to.equal(
Cypress.env('NODE_ENV') === 'production'
? "connect-src 'self' blob: https://localhost:3000 https://postgraphile.localhost:3000 https://tusd.localhost:3000 https://*.google-analytics.com https://*.analytics.google.com https://*.googletagmanager.com https://localhost:3000/cdn-cgi/rum;base-uri 'none';default-src 'none';font-src 'self';form-action 'self';frame-ancestors 'none';frame-src https://challenges.cloudflare.com;img-src 'self' blob: data: https://tusd.localhost:3000 https://*.google-analytics.com https://*.googletagmanager.com https://www.gravatar.com/avatar/;manifest-src 'self';media-src 'none';object-src 'none';prefetch-src 'self';report-uri https://dargmuesli.report-uri.com/r/d/csp/enforce;script-src blob: 'self' https://challenges.cloudflare.com https://static.cloudflareinsights.com https://*.googletagmanager.com 'unsafe-inline' 'unsafe-eval';style-src 'self' 'unsafe-inline';"
? "connect-src 'self' blob: https://localhost:3001 https://postgraphile.localhost:3001 https://tusd.localhost:3001 https://*.google-analytics.com https://*.analytics.google.com https://*.googletagmanager.com https://localhost:3001/cdn-cgi/rum;base-uri 'none';default-src 'none';font-src 'self';form-action 'self';frame-ancestors 'none';frame-src https://challenges.cloudflare.com;img-src 'self' blob: data: https://tusd.localhost:3001 https://*.google-analytics.com https://*.googletagmanager.com https://www.gravatar.com/avatar/;manifest-src 'self';media-src 'none';object-src 'none';prefetch-src 'self';report-uri https://dargmuesli.report-uri.com/r/d/csp/enforce;script-src blob: 'self' https://challenges.cloudflare.com https://static.cloudflareinsights.com https://*.googletagmanager.com 'unsafe-inline' 'unsafe-eval';style-src 'self' 'unsafe-inline';"
: "connect-src 'self' blob: https://maev.si https://postgraphile.maev.si https://tusd.maev.si https://*.google-analytics.com https://*.analytics.google.com https://*.googletagmanager.com http://localhost:24678/_nuxt/ https://localhost:24678/_nuxt/ ws://localhost:24678/_nuxt/ wss://localhost:24678/_nuxt/;base-uri 'none';default-src 'none';font-src 'self';form-action 'self';frame-ancestors 'none';frame-src https://challenges.cloudflare.com;img-src 'self' blob: data: https://tusd.maev.si https://*.google-analytics.com https://*.googletagmanager.com https://www.gravatar.com/avatar/;manifest-src 'self';media-src 'none';object-src 'none';prefetch-src 'self';report-uri https://dargmuesli.report-uri.com/r/d/csp/enforce;script-src blob: 'self' https://challenges.cloudflare.com https://static.cloudflareinsights.com https://*.googletagmanager.com 'unsafe-inline' 'unsafe-eval';style-src 'self' 'unsafe-inline';"
)
})
Expand Down

0 comments on commit c61e8a6

Please sign in to comment.