Merge pull request #2337 from bluewave-labs/develop

Develop -> Demo
This commit is contained in:
Alexander Holliday authored and GitHub committed 2025-05-26 16:12:42 -07:00
commit 8968d01781
43 files changed
+2005 -589

No files matched your search

@@ -11,9 +11,6 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
@@ -0,0 +1,44 @@
name: Distribution deploy - Monolithic Multiarch
on:
push:
branches: ["master"]
workflow_dispatch:
jobs:
docker-build-and-push-server:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push multi-arch Docker image
uses: docker/build-push-action@v5
with:
context: .
file: ./docker/dist-arm/server.Dockerfile
push: true
tags: ghcr.io/bluewave-labs/checkmate:backend-dist-mono-multiarch
platforms: linux/amd64,linux/arm64
labels: |
org.opencontainers.image.source=https://github.com/bluewave-labs/checkmate
# - name: Build Server Docker image
# run: |
# docker build \
# -t ghcr.io/bluewave-labs/checkmate:backend-dist-mono-multiarch \
# -f ./docker/dist-arm/server.Dockerfile \
# --label org.opencontainers.image.source=https://github.com/bluewave-labs/checkmate \
# .
# - name: Push Server Docker image
# run: docker push ghcr.io/bluewave-labs/checkmate:backend-dist-mono-multiarch
@@ -0,0 +1,30 @@
name: Distribution deploy - Monolithic
on:
push:
branches: ["master"]
workflow_dispatch:
jobs:
docker-build-and-push-server:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build Server Docker image
run: |
docker build \
-t ghcr.io/bluewave-labs/checkmate:backend-dist-mono \
-f ./docker/dist-mono/server.Dockerfile \
--label org.opencontainers.image.source=https://github.com/bluewave-labs/checkmate \
.
- name: Push Server Docker image
run: docker push ghcr.io/bluewave-labs/checkmate:backend-dist-mono
+1390 -505
View File
File diff suppressed because it is too large. Load diff
+7 -4
View File
@@ -15,21 +15,21 @@
"@emotion/styled": "^11.13.0",
"@fontsource/roboto": "^5.0.13",
"@hello-pangea/dnd": "^18.0.0",
"@mui/x-charts": "^7.5.1",
"@mui/x-data-grid": "7.29.0",
"@mui/x-date-pickers": "7.29.0",
"@mui/icons-material": "6.4.11",
"@mui/lab": "6.0.0-dev.240424162023-9968b4889d",
"@mui/material": "6.4.11",
"@mui/x-charts": "^7.5.1",
"@mui/x-data-grid": "7.29.0",
"@mui/x-date-pickers": "7.29.0",
"@reduxjs/toolkit": "2.7.0",
"axios": "^1.7.4",
"dayjs": "1.11.13",
"flag-icons": "7.3.2",
"jwt-decode": "^4.0.0",
"html2canvas": "^1.4.1",
"i18next": "^24.2.2",
"immutability-helper": "^3.1.1",
"joi": "17.13.3",
"jwt-decode": "^4.0.0",
"maplibre-gl": "5.3.1",
"mui-color-input": "^6.0.0",
"react": "18.3.1",
@@ -64,5 +64,8 @@
"eslint-plugin-react-refresh": "^0.4.6",
"prettier": "^3.3.3",
"vite": "^5.4.19"
},
"optionalDependencies": {
"@rollup/rollup-linux-arm64-musl": "4.41.0"
}
}
+3 -2
View File
@@ -14,7 +14,7 @@ import Dot from "../Dot";
* @param {number} params.percentage - The percentage to display.
* @returns {React.ElementType} Returns a div element with the host details.
*/
const Host = ({ url, title, percentageColor, percentage }) => {
const Host = ({ url, title, percentageColor, percentage, showURL }) => {
const theme = useTheme();
return (
<Stack>
@@ -40,7 +40,7 @@ const Host = ({ url, title, percentageColor, percentage }) => {
</>
)}
</Stack>
<span style={{ opacity: 0.6 }}>{url}</span>
{showURL && <span style={{ opacity: 0.6 }}>{url}</span>}
</Stack>
);
};
@@ -50,6 +50,7 @@ Host.propTypes = {
percentageColor: PropTypes.string,
percentage: PropTypes.string,
url: PropTypes.string,
showURL: PropTypes.bool,
};
export default Host;
@@ -155,6 +155,7 @@ const Search = ({
renderOption={(props, option) => {
const { key, ...optionProps } = props;
const hasSecondaryLabel = secondaryLabel && option[secondaryLabel] !== undefined;
const port = option["port"];
return (
<ListItem
key={key}
@@ -169,7 +170,9 @@ const Search = ({
}
>
{option[filteredBy] +
(hasSecondaryLabel ? ` (${option[secondaryLabel]})` : "")}
(hasSecondaryLabel
? ` (${option[secondaryLabel]}${port ? `: ${port}` : ""})`
: "")}
</ListItem>
);
}}
@@ -65,7 +65,9 @@ const MonitorDetailsControlHeader = ({
color="secondary"
loading={isSending}
startIcon={<EmailIcon />}
onClick={sendTestEmail}
onClick={() => {
sendTestEmail();
}}
>
{t("sendTestEmail")}
</Button>
+5
View File
@@ -20,6 +20,7 @@ const initialState = {
collapsed: false,
},
mode: initialMode,
showURL: false,
greeting: { index: 0, lastUpdate: null },
timezone: "America/Toronto",
distributedUptimeEnabled: false,
@@ -46,6 +47,9 @@ const uiSlice = createSlice({
setMode: (state, action) => {
state.mode = action.payload;
},
setShowURL: (state, action) => {
state.showURL = action.payload;
},
setGreeting(state, action) {
state.greeting.index = action.payload.index;
state.greeting.lastUpdate = action.payload.lastUpdate;
@@ -67,6 +71,7 @@ export const {
setRowsPerPage,
toggleSidebar,
setMode,
setShowURL,
setGreeting,
setTimezone,
setDistributedUptimeEnabled,
+12 -1
View File
@@ -1,6 +1,8 @@
import { useCallback } from "react";
import { useTheme } from "@mui/material";
const useMonitorUtils = () => {
const getMonitorWithPercentage = useCallback((monitor, theme) => {
let uptimePercentage = "";
let percentageColor = "";
@@ -36,7 +38,16 @@ const useMonitorUtils = () => {
return monitor?.status == true ? "up" : "down";
}, []);
return { getMonitorWithPercentage, determineState };
const theme = useTheme();
const statusColor = {
up: theme.palette.success.lowContrast,
down: theme.palette.error.lowContrast,
paused: theme.palette.warning.lowContrast,
pending: theme.palette.warning.lowContrast,
};
return { getMonitorWithPercentage, determineState, statusColor };
};
export { useMonitorUtils };
+20 -4
View File
@@ -10,24 +10,40 @@ const useSendTestEmail = () => {
const user = useSelector((state) => state.auth.user);
const { t } = useTranslation();
const sendTestEmail = async () => {
/**
* Send a test email with optional email configuration
* @param {Object} emailConfig - Optional email configuration parameters
*/
const sendTestEmail = async (emailConfig = null) => {
try {
setIsSending(true);
setError(null);
const response = await networkService.sendTestEmail({ to: user.email });
// Send the test email with or without configuration
const response = await networkService.sendTestEmail({
to: user.email,
emailConfig
});
if (typeof response?.data?.data?.messageId !== "undefined") {
createToast({
body: t("emailSent"),
body: t("settingsTestEmailSuccess", "Test email sent successfully"),
});
} else {
throw new Error(t("failedToSendEmail"));
throw new Error(response?.data?.error || t("settingsTestEmailFailed", "Failed to send test email"));
}
} catch (error) {
createToast({
body: t("failedToSendEmail"),
});
setError(error);
createToast({
body: t("settingsTestEmailFailedWithReason", "Failed to send test email: {{reason}}", {
reason: error.message || t("settingsTestEmailUnknownError", "Unknown error")
}),
variant: "error"
});
} finally {
setIsSending(false);
}
@@ -137,7 +137,7 @@ const CreateMaintenance = () => {
const response = await networkService.getMonitorsByTeamId({
teamId: user.teamId,
limit: null,
types: ["http", "ping", "pagespeed"],
types: ["http", "ping", "pagespeed", "port"],
});
const monitors = response.data.data.monitors;
setMonitors(monitors);
+31 -3
View File
@@ -11,6 +11,7 @@ import { useState } from "react";
import { useTranslation } from "react-i18next";
import { PasswordEndAdornment } from "../../Components/Inputs/TextInput/Adornments";
import { useSendTestEmail } from "../../Hooks/useSendTestEmail";
import { createToast } from "../../Utils/toastUtils";
const SettingsEmail = ({
isAdmin,
@@ -29,7 +30,7 @@ const SettingsEmail = ({
const [hasBeenReset, setHasBeenReset] = useState(false);
// Network
const [isSending, error, sendTestEmail] = useSendTestEmail();
const [isSending, , sendTestEmail] = useSendTestEmail(); // Using empty placeholder for unused error variable
// Handlers
const handlePasswordChange = (e) => {
@@ -40,6 +41,33 @@ const SettingsEmail = ({
});
};
/**
* Handle sending test email with current form values
*/
const handleSendTestEmail = () => {
// Collect current form values
const emailConfig = {
systemEmailHost: settingsData?.settings?.systemEmailHost,
systemEmailPort: settingsData?.settings?.systemEmailPort,
systemEmailUser: settingsData?.settings?.systemEmailUser,
systemEmailAddress: settingsData?.settings?.systemEmailAddress,
systemEmailPassword: password || settingsData?.settings?.systemEmailPassword,
systemEmailConnectionHost: settingsData?.settings?.systemEmailConnectionHost
};
// Basic validation
if (!emailConfig.systemEmailHost || !emailConfig.systemEmailPort) {
createToast({
body: t("settingsEmailRequiredFields", "Email host and port are required"),
variant: "error"
});
return;
}
// Send test email with current form values
sendTestEmail(emailConfig);
};
if (!isAdmin) {
return null;
}
@@ -136,9 +164,9 @@ const SettingsEmail = ({
variant="contained"
color="accent"
loading={isSending}
onClick={sendTestEmail}
onClick={handleSendTestEmail}
>
Send test e-mail
{t("settingsTestEmail", "Send test e-mail")}
</Button>
</Box>
</Stack>
+43
View File
@@ -0,0 +1,43 @@
import Box from "@mui/material/Box";
import Stack from "@mui/material/Stack";
import Typography from "@mui/material/Typography";
import ConfigBox from "../../Components/ConfigBox";
import Select from "../../Components/Inputs/Select";
// Utils
import { useTheme } from "@emotion/react";
import { PropTypes } from "prop-types";
import { useTranslation } from "react-i18next";
const SettingsURL = ({ HEADING_SX, handleChange, showURL }) => {
const { t } = useTranslation();
const theme = useTheme();
return (
<ConfigBox>
<Box>
<Typography component="h1">{t("settingsURLTitle")}</Typography>
<Typography sx={HEADING_SX}>{t("settingsURLDescription")}</Typography>
</Box>
<Stack gap={theme.spacing(20)}>
<Select
name="showURL"
label={t("settingsURLSelectTitle")}
value={showURL}
onChange={handleChange}
items={[
{ _id: true, name: t("settingsURLEnabled") },
{ _id: false, name: t("settingURLDisabled") },
]}
></Select>
</Stack>
</ConfigBox>
);
};
SettingsURL.propTypes = {
HEADING_SX: PropTypes.object,
handleChange: PropTypes.func,
showURL: PropTypes.bool,
};
export default SettingsURL;
+12 -2
View File
@@ -3,6 +3,7 @@ import Typography from "@mui/material/Typography";
import Breadcrumbs from "../../Components/Breadcrumbs";
import SettingsTimeZone from "./SettingsTimeZone";
import SettingsUI from "./SettingsUI";
import SettingsURL from "./SettingsURL";
import SettingsPagespeed from "./SettingsPagespeed";
import SettingsDemoMonitors from "./SettingsDemoMonitors";
import SettingsAbout from "./SettingsAbout";
@@ -15,7 +16,7 @@ import { useState } from "react";
import { useTheme } from "@emotion/react";
import { useTranslation } from "react-i18next";
import { useSelector, useDispatch } from "react-redux";
import { setTimezone, setMode, setLanguage } from "../../Features/UI/uiSlice";
import { setTimezone, setMode, setLanguage, setShowURL } from "../../Features/UI/uiSlice";
import SettingsStats from "./SettingsStats";
import {
deleteMonitorChecksByTeamId,
@@ -31,7 +32,7 @@ const BREADCRUMBS = [{ name: `Settings`, path: "/settings" }];
const Settings = () => {
// Redux state
const { mode, language, timezone } = useSelector((state) => state.ui);
const { mode, language, timezone, showURL } = useSelector((state) => state.ui);
const { user } = useSelector((state) => state.auth);
// Local state
@@ -85,6 +86,10 @@ const Settings = () => {
dispatch(setMode(value));
}
if (name === "showURL") {
dispatch(setShowURL(value));
}
if (name === "language") {
dispatch(setLanguage(value));
i18n.changeLanguage(value);
@@ -164,6 +169,11 @@ const Settings = () => {
setSettingsData={setSettingsData}
isApiKeySet={settingsData?.pagespeedKeySet ?? false}
/>
<SettingsURL
HEADING_SX={HEADING_SX}
handleChange={handleChange}
showURL={showURL}
/>
<SettingsStats
isAdmin={isAdmin}
HEADING_SX={HEADING_SX}
@@ -15,7 +15,7 @@ const useMonitorsFetch = () => {
const response = await networkService.getMonitorsByTeamId({
teamId: user.teamId,
limit: null, // donot return any checks for the monitors
types: ["http"], // status page is available only for the uptime type
types: ["http", "ping"], // status page is available for uptime and ping monitors
});
setMonitors(response.data.data.monitors);
} catch (error) {
@@ -8,9 +8,15 @@ import { StatusLabel } from "../../../../../Components/Label";
import { useTheme } from "@mui/material/styles";
import useUtils from "../../../../Uptime/Monitors/Hooks/useUtils";
import PropTypes from "prop-types";
import { useSelector } from "react-redux";
const MonitorsList = ({ isLoading = false, shouldRender = true, monitors = [] }) => {
const theme = useTheme();
const { determineState } = useUtils();
const { showURL } = useSelector((state) => state.ui);
return (
<>
{monitors?.map((monitor) => {
@@ -27,6 +33,7 @@ const MonitorsList = ({ isLoading = false, shouldRender = true, monitors = [] })
title={monitor.name}
percentageColor={monitor.percentageColor}
percentage={monitor.percentage}
showURL={showURL}
/>
<Stack
direction="row"
@@ -19,6 +19,7 @@ import { useState } from "react";
import { useParams } from "react-router-dom";
import { useNavigate } from "react-router-dom";
import { useTranslation } from "react-i18next";
const PublicStatus = () => {
const { url } = useParams();
+33 -15
View File
@@ -34,6 +34,10 @@ import SkeletonLayout from "./skeleton";
import "./index.css";
import Dialog from "../../../Components/Dialog";
import NotificationIntegrationModal from "../../../Components/NotificationIntegrationModal/Components/NotificationIntegrationModal";
import { usePauseMonitor } from "../../../Hooks/useMonitorControls";
import PauseOutlinedIcon from "@mui/icons-material/PauseOutlined";
import PlayArrowOutlinedIcon from "@mui/icons-material/PlayArrowOutlined";
import { useMonitorUtils } from "../../../Hooks/useMonitorUtils";
/**
* Parses a URL string and returns a URL object.
@@ -83,11 +87,19 @@ const Configure = () => {
include: "ok",
};
const [trigger, setTrigger] = useState(false);
const triggerUpdate = () => {
setTrigger(!trigger);
};
const [pauseMonitor, isPausing, error] = usePauseMonitor({
monitorId: monitor?._id,
triggerUpdate,
});
useEffect(() => {
const fetchMonitor = async () => {
try {
const action = await dispatch(getUptimeMonitorById({ monitorId }));
if (getUptimeMonitorById.fulfilled.match(action)) {
const monitor = action.payload.data;
setMonitor(monitor);
@@ -100,7 +112,7 @@ const Configure = () => {
}
};
fetchMonitor();
}, [monitorId, navigate]);
}, [monitorId, navigate, trigger]);
const handleChange = (event, name) => {
let { checked, value, id } = event.target;
@@ -202,17 +214,7 @@ const Configure = () => {
setIsNotificationModalOpen(false);
};
const statusColor = {
true: theme.palette.success.main,
false: theme.palette.error.main,
undefined: theme.palette.warning.main,
};
const statusMsg = {
true: "Your site is up.",
false: "Your site is down.",
undefined: "Pending...",
};
const { determineState, statusColor } = useMonitorUtils();
const { t } = useTranslation();
@@ -257,7 +259,7 @@ const Configure = () => {
gap={theme.spacing(2)}
>
<Tooltip
title={statusMsg[monitor?.status ?? undefined]}
title={t(`statusMsg.${[determineState(monitor)]}`)}
disableInteractive
slotProps={{
popper: {
@@ -273,7 +275,7 @@ const Configure = () => {
}}
>
<Box>
<PulseDot color={statusColor[monitor?.status ?? undefined]} />
<PulseDot color={statusColor[determineState(monitor)]} />
</Box>
</Tooltip>
<Typography
@@ -307,11 +309,27 @@ const Configure = () => {
</Stack>
</Box>
<Box
justifyContent="space-between"
sx={{
alignSelf: "flex-end",
ml: "auto",
display: "flex",
gap: theme.spacing(2),
}}
>
<Button
variant="contained"
color="secondary"
loading={isPausing}
startIcon={
monitor?.isActive ? <PauseOutlinedIcon /> : <PlayArrowOutlinedIcon />
}
onClick={() => {
pauseMonitor();
}}
>
{monitor?.isActive ? t("pause") : t("resume")}
</Button>
<Button
loading={isLoading}
variant="contained"
+20 -3
View File
@@ -1157,11 +1157,28 @@ class NetworkService {
}
// ************************************
// Send tes t email
// Send test email
// ************************************
async sendTestEmail(config) {
const { to } = config;
return this.axiosInstance.post(`/monitors/test-email`, { to });
// Extract recipient and email configuration
const { to, emailConfig } = config;
// If emailConfig is provided, use the new endpoint with direct parameters
if (emailConfig) {
return this.axiosInstance.post(`/settings/test-email`, {
to,
systemEmailHost: emailConfig.systemEmailHost,
systemEmailPort: emailConfig.systemEmailPort,
systemEmailAddress: emailConfig.systemEmailAddress,
systemEmailPassword: emailConfig.systemEmailPassword,
// Only include these if they are present
...(emailConfig.systemEmailConnectionHost && { systemEmailConnectionHost: emailConfig.systemEmailConnectionHost }),
...(emailConfig.systemEmailUser && { systemEmailUser: emailConfig.systemEmailUser })
});
}
// Fallback to original behavior for backward compatibility
return this.axiosInstance.post(`/settings/test-email`, { to });
}
}
+1
View File
@@ -277,6 +277,7 @@ const settingsValidation = joi.object({
}),
pagespeedApiKey: joi.string().allow("").optional(),
language: joi.string().required(),
showURL: joi.bool().required(),
systemEmailHost: joi.string().allow(""),
systemEmailPort: joi.number().allow(null, ""),
systemEmailAddress: joi.string().allow(""),
+22 -7
View File
@@ -75,6 +75,11 @@
"settingsThemeModeLight": "Light",
"settingsThemeModeDark": "Dark",
"settingsLanguage": "Language",
"settingsURLTitle": "Monitor IP/URL on Status Page",
"settingsURLDescription": "Display the IP address or URL of monitor on the public Status page. If it's disabled, only the monitor name will be shown to protect sensitive information.",
"settingsURLSelectTitle": "Display IP/URL on status page",
"settingsURLEnabled": "Enabled",
"settingURLDisabled": "Disabled",
"settingsDistributedUptime": "Distributed uptime",
"settingsDistributedUptimeDescription": "Enable/disable distributed uptime monitoring.",
"settingsEnabled": "Enabled",
@@ -112,15 +117,21 @@
"settingsFailedToAddDemoMonitors": "Failed to add demo monitors",
"settingsMonitorsDeleted": "Successfully deleted all monitors",
"settingsFailedToDeleteMonitors": "Failed to delete all monitors",
"settingsEmail": "Email settings",
"settingsEmailDescription": "Configure email settings",
"settingsEmail": "Email",
"settingsEmailDescription": "Configure the email settings for your system. This is used to send notifications and alerts.",
"settingsEmailHost": "Email host - Hostname or IP address of the SMTP server",
"settingsEmailPort": "Email port - Port to connect to",
"settingsEmailUser": "Email user - Username for authentication, overrides email address if specified",
"settingsEmailAddress": "Email address - Used for authentication",
"settingsEmailPassword": "Email password - Password for authentication",
"settingsEmailUser": "Email user - Username for authentication, overrides email address if specified",
"settingsEmailFieldResetLabel": "Password is set. Click Reset to change it.",
"settingsEmailConnectionHost": "Email connection host - Hostname to use in the HELO/EHLO greeting",
"settingsTestEmail": "Send test e-mail",
"settingsTestEmailSuccess": "Test email sent successfully",
"settingsTestEmailFailed": "Failed to send test email",
"settingsTestEmailFailedWithReason": "Failed to send test email: {{reason}}",
"settingsTestEmailUnknownError": "Unknown error",
"settingsEmailRequiredFields": "Email host and port are required",
"settingsEmailFieldResetLabel": "Password is set. Click Reset to change it.",
"backendUnreachable": "Server Connection Error",
"backendUnreachableMessage": "We're unable to connect to the server. Please check your internet connection or verify your deployment configuration if the problem persists.",
"backendUnreachableError": "Cannot connect to the server. Please try again later.",
@@ -522,8 +533,6 @@
"logOut": "Log out"
},
"navControls": "Controls",
"statusBreadCrumbsStatusPages": "Status Pages",
"statusBreadCrumbsDetails": "Details",
"incidentsPageTitle": "Incidents",
"passwordPanel": {
"passwordChangedSuccess": "Your password was changed successfully.",
@@ -539,5 +548,11 @@
"uptimeCreateSelectURL": "Enter the URL or IP to monitor (e.g., https://example.com/ or 192.168.1.100) and add a clear display name that appears on the dashboard.",
"sendTestEmail": "Send test email",
"emailSent": "Email sent successfully",
"failedToSendEmail": "Failed to send email"
"failedToSendEmail": "Failed to send email",
"statusMsg" : {
"paused": "Monitoring is paused.",
"up": "Your site is up.",
"down": "Your site is down.",
"pending": "Pending..."
}
}
+24 -1
View File
@@ -89,6 +89,11 @@
"settingsThemeModeLight": "Светлая",
"settingsThemeModeDark": "Тёмная",
"settingsLanguage": "Язык",
"settingsURLTitle": "Отображать IP/URL на странице статуса",
"settingsURLDescription": "Отображать IP-адрес или URL-адрес монитора на общедоступной странице статуса. Если отключено, будет отображаться только имя монитора для защиты конфиденциальной информации.",
"settingsURLSelectTitle": "Показать IP/URL на странице статуса",
"settingsURLEnabled": "Включено",
"settingURLDisabled": "Отключено",
"settingsDistributedUptime": "Distributed uptime",
"settingsDistributedUptimeDescription": "Включить/выключить distributed uptime monitoring.",
"settingsEnabled": "Включено",
@@ -115,6 +120,21 @@
"settingsRemoveAllMonitorsDialogConfirm": "Да, удалить все мониторы",
"settingsWallet": "Кошелёк",
"settingsWalletDescription": "Подключите свой кошелек здесь. Это необходимо для того, чтобы монитор Distributed Uptime мог подключиться к нескольким узлам по всему миру.",
"settingsEmail": "Настройки электронной почты",
"settingsEmailDescription": "Настройте параметры электронной почты",
"settingsEmailHost": "Хост электронной почты - имя хоста или IP-адрес SMTP-сервера",
"settingsEmailPort": "Порт электронной почты - порт для подключения",
"settingsEmailAddress": "Адрес электронной почты - используется для аутентификации",
"settingsEmailPassword": "Пароль электронной почты - пароль для аутентификации",
"settingsEmailUser": "Пользователь электронной почты - имя пользователя для аутентификации, переопределяет адрес электронной почты, если указан",
"settingsEmailFieldResetLabel": "Пароль установлен. Нажмите «Сбросить», чтобы изменить его.",
"settingsEmailConnectionHost": "Хост подключения электронной почты - имя хоста, используемое в приветствии HELO/EHLO",
"settingsTestEmail": "Отправить тестовое письмо",
"settingsTestEmailSuccess": "Тестовое письмо успешно отправлено",
"settingsTestEmailFailed": "Не удалось отправить тестовое письмо",
"settingsTestEmailFailedWithReason": "Не удалось отправить тестовое письмо: {{reason}}",
"settingsTestEmailUnknownError": "Неизвестная ошибка",
"settingsEmailRequiredFields": "Требуются хост и порт электронной почты",
"settingsAbout": "О",
"settingsDevelopedBy": "Developed by Bluewave Labs.",
"settingsSave": "Сохранить",
@@ -152,7 +172,6 @@
"http": "HTTP",
"monitor": "монитор",
"aboutus": "О Нас",
"now": "Сейчас",
"delete": "Удалить",
"configure": "Настроить",
@@ -409,6 +428,10 @@
"pageSpeedWarning": "Предупреждение: Вы не добавили ключ API Google PageSpeed. Без него монитор PageSpeed не будет работать.",
"pageSpeedLearnMoreLink": "Нажмите здесь, чтобы узнать",
"pageSpeedAddApiKey": "как добавить ваш ключ API.",
"pageSpeedApiKeyFieldTitle": "Ключ Google PageSpeed API",
"pageSpeedApiKeyFieldLabel": "Ключ PageSpeed API",
"pageSpeedApiKeyFieldDescription": "Введите свой ключ Google PageSpeed API, чтобы включить мониторинг скорости страниц. Нажмите «Сбросить», чтобы обновить ключ.",
"pageSpeedApiKeyFieldResetLabel": "Ключ API установлен. Нажмите «Сбросить», чтобы изменить его.",
"createNew": "Создать новый",
"greeting": {
"prepend": "Привет",
+23 -3
View File
@@ -73,6 +73,11 @@
"settingsThemeModeLight": "Açık",
"settingsThemeModeDark": "Koyu",
"settingsLanguage": "Dil",
"settingsURLTitle": "Durum Sayfasında IP/URL'yi Göster",
"settingsURLDescription": "Monitörün IP adresini veya URL'sini genel Durum sayfasında göster. Devre dışı bırakıldığında, hassas bilgileri korumak için yalnızca monitör adı gösterilecektir.",
"settingsURLSelectTitle": "Durum sayfasında IP/URL'yi göster",
"settingsURLEnabled": "Etkin",
"settingURLDisabled": "Devre Dışı",
"settingsDistributedUptime": "Dağıtılmış çalışma süresi",
"settingsDistributedUptimeDescription": "Dağıtılmış çalışma süresi izlemeyi etkinleştirin/devre dışı bırakın.",
"settingsEnabled": "Etkin",
@@ -99,6 +104,20 @@
"settingsRemoveAllMonitorsDialogConfirm": "Evet, tüm monitörleri kaldır",
"settingsWallet": "Cüzdan",
"settingsWalletDescription": "Cüzdanınızı buradan bağlayın. Bu, Dağıtılmış Çalışma Süresi monitörünün küresel olarak birden çok düğüme bağlanması için gereklidir.",
"settingsTestEmail": "Test e-postası gönder",
"settingsTestEmailSuccess": "Test e-postası başarıyla gönderildi",
"settingsTestEmailFailed": "Test e-postası gönderilemedi",
"settingsTestEmailFailedWithReason": "Test e-postası gönderilemedi: {{reason}}",
"settingsTestEmailUnknownError": "Bilinmeyen hata",
"settingsEmail": "E-posta",
"settingsEmailDescription": "Sisteminiz için e-posta ayarlarını yapılandırın. Bu, bildirim ve uyarıları göndermek için kullanılır.",
"settingsEmailHost": "E-posta sunucusu - SMTP sunucusunun ana bilgisayar adı veya IP adresi",
"settingsEmailPort": "E-posta portu - Bağlanılacak port",
"settingsEmailUser": "E-posta kullanıcısı - Kimlik doğrulama için kullanıcı adı, belirtilirse e-posta adresini geçersiz kılar",
"settingsEmailAddress": "E-posta adresi - Kimlik doğrulama için kullanılır",
"settingsEmailPassword": "E-posta şifresi - Kimlik doğrulama için şifre",
"settingsEmailConnectionHost": "E-posta bağlantı sunucusu - HELO/EHLO selamlamasında kullanılacak ana bilgisayar adı",
"settingsEmailRequiredFields": "E-posta sunucusu ve port gereklidir",
"settingsAbout": "Hakkında",
"settingsDevelopedBy": "Bluewave Labs tarafından geliştirilmiştir.",
"settingsSave": "Kaydet",
@@ -124,7 +143,6 @@
"http": "HTTP",
"monitor": "monitör",
"aboutus": "Hakkımızda",
"now": "Şimdi",
"delete": "Sil",
"configure": "Yapılandır",
@@ -397,7 +415,9 @@
"pageSpeedWarning": "Uyarı: Google PageSpeed API anahtarı eklemediniz. Bu olmadan, PageSpeed monitörü çalışmayacaktır.",
"pageSpeedLearnMoreLink": "Daha fazla bilgi için tıklayın",
"pageSpeedAddApiKey": "API anahtarınızı nasıl ekleyeceğinizi öğrenin.",
"pageSpeedApiKeyFieldDescription": "Sayfa hızı izlemeyi etkinleştirmek için Google PageSpeed API anahtarınızı girin. Anahtarı güncellemek için Sıfırla'ya tıklayın.",
"pageSpeedApiKeyFieldTitle": "Google PageSpeed API anahtarı",
"pageSpeedApiKeyFieldLabel": "PageSpeed API anahtarı",
"pageSpeedApiKeyFieldDescription": "PageSpeed izlemeyi etkinleştirmek için Google PageSpeed API anahtarınızı girin. Anahtarı güncellemek için Sıfırla'ya tıklayın.",
"pageSpeedApiKeyFieldResetLabel": "API anahtarı ayarlandı. Değiştirmek için Sıfırla'ya tıklayın.",
"reset": "Sıfırla",
"invalidFileFormat": "",
@@ -513,4 +533,4 @@
"saving": "Kaydediliyor..."
},
"uptimeCreateSelectURL": "İzlenecek URL veya IP adresini girin (örn. https://example.com/ veya 192.168.1.100) ve kontrol panelinde görünecek net bir görüntü adı ekleyin."
}
}
+1
View File
@@ -4,6 +4,7 @@ import svgr from "vite-plugin-svgr";
// https://vitejs.dev/config/
export default defineConfig({
base: "/",
plugins: [svgr(), react()],
optimizeDeps: {
include: ["@mui/material/Tooltip", "@emotion/styled"],
+2 -1
View File
@@ -8,5 +8,6 @@ dist/redis/data/*
prod/mongo/data/*
prod/redis/data/*
dist/docker-compose-test.yaml
/dist-mono/mongo/data/*
/dist-mono/redis/data/*
*.env
prod/certbot/*
+44
View File
@@ -0,0 +1,44 @@
#!/bin/bash
set -e # Exit on error
# Change directory to root Server directory for correct Docker Context
cd "$(dirname "$0")"
cd ../..
# Ensure buildx builder exists and is used
if ! docker buildx inspect mybuilder &>/dev/null; then
docker buildx create --name mybuilder --use
else
docker buildx use mybuilder
fi
# Define service names and Dockerfiles
services=("mono_server_arm")
dockerfiles=(
"./docker/dist-arm/server.Dockerfile"
)
# Static image name for GitHub Container Registry (GHCR)
image="ghcr.io/bluewave-labs/checkmate:backend-dist-multi-arch"
platforms="linux/amd64,linux/arm64"
repo_url="https://github.com/bluewave-labs/checkmate"
# Loop through each service and build
for i in "${!services[@]}"; do
service="${services[$i]}"
dockerfile="${dockerfiles[$i]}"
echo "🚀 Building multi-arch image for $service..."
docker buildx build \
--platform "$platforms" \
-f "$dockerfile" \
-t "$image" \
--label "org.opencontainers.image.source=$repo_url" \
--push \
.
echo "✅ $image pushed for platforms: $platforms"
done
echo "🎉 All multi-arch images built and pushed successfully"
+54
View File
@@ -0,0 +1,54 @@
version: "3.8"
services:
server:
image: ghcr.io/bluewave-labs/checkmate:backend-dist-mono-multiarch
restart: always
ports:
- "52345:52345"
environment:
- UPTIME_APP_API_BASE_URL=http://localhost:52345/api/v1
- UPTIME_APP_CLIENT_HOST=http://localhost
- DB_CONNECTION_STRING=mongodb://mongodb:27017/uptime_db?replicaSet=rs0
- REDIS_URL=redis://redis:6379
- CLIENT_HOST=http://localhost
- JWT_SECRET=my_secret
depends_on:
- redis
- mongodb
redis:
image: redis:7
container_name: checkmate-redis
ports:
- "6379:6379"
volumes:
- ./redis/data:/data
restart: unless-stopped
mongodb:
image: mongo:4.4.18
container_name: checkmate-mongodb
restart: always
command: ["mongod", "--replSet", "rs0", "--bind_ip_all"]
ports:
- "27017:27017"
volumes:
- ./mongo/data:/data/db
mongo-init:
image: mongo:4.4.18
depends_on:
- mongodb
entrypoint: >
bash -c "
echo 'Waiting for MongoDB to be ready...' &&
until mongo --host mongodb --eval 'db.adminCommand(\"ping\")' > /dev/null 2>&1; do
sleep 2
done &&
echo 'MongoDB is up. Initiating replica set...' &&
mongo --host mongodb --eval '
rs.initiate({
_id: \"rs0\",
members: [{ _id: 0, host: \"mongodb:27017\" }]
})
' || echo 'Replica set may already be initialized.'
"
+25
View File
@@ -0,0 +1,25 @@
FROM node:20-alpine AS frontend-build
WORKDIR /app/client
COPY client/package*.json ./
RUN npm ci
COPY client ./
RUN npm run build
FROM node:20-alpine AS backend
WORKDIR /app/server
COPY server ./
COPY --from=frontend-build /app/client/dist ./public
RUN npm ci
RUN chmod +x ./scripts/inject-vars.sh
EXPOSE 52345
CMD ./scripts/inject-vars.sh && node ./index.js
+29
View File
@@ -0,0 +1,29 @@
#!/bin/bash
# Change directory to root Server directory for correct Docker Context
cd "$(dirname "$0")"
cd ../..
# Define service names and their corresponding Dockerfiles in parallel arrays
services=("mono_mongo" "mono_redis" "mono_server")
dockerfiles=(
"./docker/dist-mono/mongoDB.Dockerfile"
"./docker/dist-mono/redis.Dockerfile"
"./docker/dist-mono/server.Dockerfile"
)
# Loop through each service and build the corresponding image
for i in "${!services[@]}"; do
service="${services[$i]}"
dockerfile="${dockerfiles[$i]}"
docker build -f "$dockerfile" -t "$service" .
# Check if the build succeeded
if [ $? -ne 0 ]; then
echo "Error building $service image. Exiting..."
exit 1
fi
done
echo "All images built successfully"
+40
View File
@@ -0,0 +1,40 @@
services:
server:
image: ghcr.io/bluewave-labs/checkmate:backend-dist-mono
restart: always
ports:
- "52345:52345"
environment:
- UPTIME_APP_API_BASE_URL=http://localhost:52345/api/v1
- UPTIME_APP_CLIENT_HOST=http://localhost
- DB_CONNECTION_STRING=mongodb://mongodb:27017/uptime_db?replicaSet=rs0
- REDIS_URL=redis://redis:6379
- CLIENT_HOST=http://localhost
- JWT_SECRET=my_secret
depends_on:
- redis
- mongodb
redis:
image: ghcr.io/bluewave-labs/checkmate:redis-dist
restart: always
volumes:
- ./redis/data:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 30s
timeout: 10s
retries: 5
start_period: 5s
mongodb:
image: ghcr.io/bluewave-labs/checkmate:mongo-dist
restart: always
command: ["mongod", "--quiet", "--replSet", "rs0", "--bind_ip_all"]
volumes:
- ./mongo/data:/data/db
healthcheck:
test: echo "try { rs.status() } catch (err) { rs.initiate({_id:'rs0',members:[{_id:0,host:'mongodb:27017'}]}) }" | mongosh --port 27017 --quiet
interval: 5s
timeout: 30s
start_period: 0s
start_interval: 1s
retries: 30
+3
View File
@@ -0,0 +1,3 @@
FROM mongo
EXPOSE 27017
CMD ["mongod"]
+2
View File
@@ -0,0 +1,2 @@
FROM redis
EXPOSE 6379
+25
View File
@@ -0,0 +1,25 @@
FROM node:20-alpine AS frontend-build
WORKDIR /app/client
COPY client/package*.json ./
RUN npm install
COPY client ./
RUN npm run build
FROM node:20-alpine AS app
WORKDIR /app/server
COPY server ./
COPY --from=frontend-build /app/client/dist ./public
RUN npm install
RUN chmod +x ./scripts/inject-vars.sh
EXPOSE 52345
CMD ./scripts/inject-vars.sh && node ./index.js
+2
View File
@@ -2,8 +2,10 @@ node_modules
.env
*.log
*.sh
!scripts/inject-vars.sh
.nyc_output
coverage
.clinic
node_modules
.vscode/*
public
@@ -490,6 +490,7 @@ const buildMonitorsByTeamIdPipeline = ({ matchStage, field, order }) => {
_id: 1,
name: 1,
type: 1,
port: 1,
},
},
];
+18 -1
View File
@@ -99,6 +99,8 @@ const openApiSpec = JSON.parse(
fs.readFileSync(path.join(__dirname, "openapi.json"), "utf8")
);
const frontendPath = path.join(__dirname, "public");
let server;
const shutdown = async () => {
@@ -308,6 +310,7 @@ const startApp = async () => {
const notificationRoutes = new NotificationRoutes(notificationController);
const diagnosticRoutes = new DiagnosticRoutes(diagnosticController);
// Middleware
app.use(express.static(frontendPath));
app.use(responseHandler);
app.use(
cors({
@@ -318,7 +321,17 @@ const startApp = async () => {
})
);
app.use(express.json());
app.use(helmet());
app.use(
helmet({
hsts: false,
contentSecurityPolicy: {
useDefaults: true,
directives: {
upgradeInsecureRequests: null,
},
},
})
);
app.use(
compression({
level: 6,
@@ -353,6 +366,10 @@ const startApp = async () => {
status: "OK",
});
});
// FE routes
app.get("*", (req, res) => {
res.sendFile(path.join(frontendPath, "index.html"));
});
app.use(handleErrors);
};
+7
View File
@@ -0,0 +1,7 @@
for i in $(env | grep UPTIME_APP_)
do
key=$(echo $i | cut -d '=' -f 1)
value=$(echo $i | cut -d '=' -f 2-)
echo $key=$value
find ./public/assets -type f \( -name '*.js' -o -name '*.css' \) -exec sed -i "s|${key}|${value}|g" '{}' +
done
+6 -11
View File
@@ -143,10 +143,11 @@ class JobQueueHelper {
});
worker.on("failed", (job, error, prev) => {
this.logger.warn({
message: `Worker ${queueName} is failed with msg: ${error}`,
service: SERVICE_NAME,
method: "createWorker:failed",
this.logger.error({
message: `Worker ${queueName} is failed with msg: ${error.message}`,
service: error?.service ?? SERVICE_NAME,
method: error?.method ?? "createWorker:failed",
stack: error?.stack,
});
});
@@ -293,13 +294,7 @@ class JobQueueHelper {
await job.updateProgress(100);
return true;
} catch (error) {
this.logger.error({
message: error.message,
service: error.service ?? SERVICE_NAME,
method: error.method ?? "createJobHandler",
details: `Error processing job ${job.id}: ${error.message}`,
stack: error.stack,
});
await job.updateProgress(100);
throw error;
}
};
+1 -2
View File
@@ -92,11 +92,10 @@ class EmailService {
buildAndSendEmail = async (template, context, to, subject, transportConfig) => {
// TODO - Consider an update transporter method so this only needs to be recreated when smtp settings change
let config;
if (typeof transportConfig !== "undefined") {
config = transportConfig;
} else {
config = this.settingsService.getDBSettings();
config = await this.settingsService.getDBSettings();
}
const {
-6
View File
@@ -437,12 +437,6 @@ class NetworkService {
throw new Error(response.data.message);
}
} catch (error) {
this.logger.error({
message: "Error in requestDistributedHttp",
service: this.SERVICE_NAME,
method: "requestDistributedHttp",
stack: error.stack,
});
error.service = this.SERVICE_NAME;
error.method = "requestDistributedHttp";
throw error;
+7 -11
View File
@@ -121,10 +121,10 @@ class StatusService {
try {
const { monitorId, status, code } = networkResponse;
const monitor = await this.db.getMonitorById(monitorId);
// Update running stats
this.updateRunningStats({ monitor, networkResponse });
// No change in monitor status, return early
if (monitor.status === status)
return {
@@ -134,7 +134,7 @@ class StatusService {
code,
timestamp: new Date().getTime(),
};
// Monitor status changed, save prev status and update monitor
this.logger.info({
service: this.SERVICE_NAME,
@@ -144,11 +144,11 @@ class StatusService {
prevStatus: monitor.status,
newStatus: status,
});
const prevStatus = monitor.status;
monitor.status = status;
await monitor.save();
return {
monitor,
statusChanged: true,
@@ -157,12 +157,8 @@ class StatusService {
timestamp: new Date().getTime(),
};
} catch (error) {
this.logger.error({
service: this.SERVICE_NAME,
message: error.message,
method: "updateStatus",
stack: error.stack,
});
error.service = this.SERVICE_NAME;
error.method = "updateStatus";
throw error;
}
};
+1
View File
@@ -427,6 +427,7 @@ const updateAppSettingsBodyValidation = joi.object({
checkTTL: joi.number().allow(""),
pagespeedApiKey: joi.string().allow(""),
language: joi.string().allow(""),
showURL: joi.bool().required(),
systemEmailHost: joi.string().allow(""),
systemEmailPort: joi.number().allow(""),
systemEmailAddress: joi.string().allow(""),