Skip to content
Merged
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
14 changes: 14 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
node_modules/
.nuxt/
.output/
.wrangler/
dist/
.git/
.github/
.idea/
.eslintcache
.env
.env.*
!.env*.example
coverage/
test/
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ config/local*
.vscode/
.nuxt/
.output/
.wrangler/
dist
test/e2e/globalping-dash-directus/
.claude/
Expand Down
43 changes: 43 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
FROM node:24-slim AS build

WORKDIR /app

RUN corepack enable

COPY package.json pnpm-lock.yaml ./
COPY patches ./patches

RUN pnpm install --frozen-lockfile --prod=false

COPY . .

RUN pnpm exec nuxt prepare \
&& pnpm build

FROM node:24-slim

WORKDIR /app

RUN corepack enable

RUN apt-get update \
&& apt-get install -y --no-install-recommends curl \
&& rm -rf /var/lib/apt/lists/*

COPY package.json pnpm-lock.yaml ./
COPY patches ./patches

RUN pnpm install --prod --frozen-lockfile --ignore-scripts \
&& pnpm store prune

COPY --from=build --chown=node:node /app/elastic-apm-node.cjs /app/elastic-apm-utils.cjs ./
COPY --from=build --chown=node:node /app/.output ./.output

ENV NODE_ENV=production \
ELASTIC_APM_CONFIG_FILE=elastic-apm-node.cjs

USER node

EXPOSE 13010

CMD [ "node", "--experimental-loader", "elastic-apm-node/loader.mjs", "-r", "./elastic-apm-utils.cjs", "-r", "elastic-apm-node/start.js", ".output/server/index.mjs" ]
12 changes: 12 additions & 0 deletions elastic-apm-node.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
const { version } = require('./package.json');

module.exports = {
active: process.env.NODE_ENV === 'production',
serviceName: 'globalping-dash',
serviceVersion: process.env.SOURCE_COMMIT || version,
logLevel: 'fatal',
centralConfig: false,
captureErrorLogStackTraces: 'always',
ignoreUrls: [ '/favicon.ico' ],
transactionSampleRate: .1,
};
3 changes: 3 additions & 0 deletions elastic-apm-utils.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
const apmUtils = require('elastic-apm-utils');

apmUtils.apm.useConstrainedMemory();
18 changes: 13 additions & 5 deletions nuxt.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const productionBranch = process.env.CLOUDFLARE_PRODUCTION_BRANCH || 'master';
const cloudflareDeploymentBranch = process.env.WORKERS_CI_BRANCH;
const isCloudflarePreview = process.env.ROBOTS_DISALLOW_ALL === '1'
|| Boolean(cloudflareDeploymentBranch && cloudflareDeploymentBranch !== productionBranch);
const productionBranch = process.env.COOLIFY_PRODUCTION_BRANCH || 'master';
const coolifyDeploymentBranch = process.env.COOLIFY_BRANCH;
const isCoolifyPreview = process.env.ROBOTS_DISALLOW_ALL === '1'
|| Boolean(coolifyDeploymentBranch && coolifyDeploymentBranch !== productionBranch);

const robotsDisallowedRoutes = [
'/authorize',
Expand Down Expand Up @@ -74,10 +74,18 @@ export default defineNuxtConfig({
groups: [
{
userAgent: '*',
disallow: isCloudflarePreview ? [ '/' ] : robotsDisallowedRoutes,
disallow: isCoolifyPreview ? [ '/' ] : robotsDisallowedRoutes,
},
],
},
routeRules: {
'/favicon.ico': {
headers: { 'cache-control': 'public, max-age=3600' },
},
'/**': {
headers: { 'cache-control': 'no-cache, no-store' },
},
},
css: [ 'primeicons/primeicons.css', '~/assets/css/base.css', '~/assets/css/global.css' ],
primevue: {
options: {
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"type": "module",
"scripts": {
"build": "nuxt build",
"build:workers": "NITRO_PRESET=cloudflare_module nuxt build",
"dev": "nuxt dev",
"generate": "nuxt generate",
"lint": "pnpm lint:css && pnpm lint:js",
Expand All @@ -14,9 +13,9 @@
"lint:js": "eslint --cache --max-warnings=0 .",
"lint:js:fix": "eslint --cache --max-warnings=0 --fix .",
"preview": "nuxt preview",
"preview:workers": "pnpm build:workers && wrangler dev",
"postinstall": "nuxt prepare",
"prepare": "husky || echo 'Failed to install husky'",
"start": "node --experimental-loader elastic-apm-node/loader.mjs -r ./elastic-apm-utils.cjs -r elastic-apm-node/start.js .output/server/index.mjs",
Comment thread
MartinKolarik marked this conversation as resolved.
"test:e2e": "pnpm run test:e2e:build:directus && pnpm run test:e2e:build:dash && pnpm run test:e2e:run",
"test:e2e:build:directus": "./scripts/build-directus.sh",
"test:e2e:build:dash": "dotenv -e test/e2e/globalping-dash-directus/.env.scripts.e2e -- pnpm build",
Expand All @@ -33,6 +32,8 @@
"@vueuse/core": "^14.3.0",
"@vueuse/nuxt": "^14.3.0",
"chart.js": "^4.5.1",
"elastic-apm-node": "^4.15.0",
"elastic-apm-utils": "^4.4.0",
"lodash": "^4.18.1",
"nuxt": "^4.4.5",
"nuxt3-interpolation": "^1.0.16",
Expand Down Expand Up @@ -63,8 +64,7 @@
"stylelint-config-tailwindcss": "^1.0.1",
"typescript": "^5.9.3",
"vite": "^7.3.3",
"vue-tsc": "^3.2.9",
"wrangler": "^4.92.0"
"vue-tsc": "^3.2.9"
},
"lint-staged": {
"*.{css,less,vue}": "stylelint --fix --config .stylelintrc",
Expand Down
Loading
Loading