diff --git a/config/monitors.example.yaml b/config/monitors.example.yaml new file mode 100644 index 00000000..00234241 --- /dev/null +++ b/config/monitors.example.yaml @@ -0,0 +1,19 @@ +- name: OkBookmarks + description: A free bookmark manager that lets you save and search your bookmarks in the cloud. + tag: "frogment" + image: "https://okbookmarks.com/assets/img/extension_icon128.png" + api: + method: GET + url: https://okbookmarks.com +- name: Earth + description: Our blue planet + tag: "earth" + defaultStatus: "UP" + image: "/earth.png" +- name: Frogment + description: A free openAPI spec editor and linter that breaks down your spec into fragments to make editing easier and more intuitive. Visit https://www.frogment.com + tag: "frogment" + image: "/frogment.png" + api: + method: GET + url: https://www.frogment.com diff --git a/config/site.example.yaml b/config/site.example.yaml new file mode 100644 index 00000000..fa73fdcd --- /dev/null +++ b/config/site.example.yaml @@ -0,0 +1,44 @@ +title: "Kener" +home: "/" +logo: "/logo.png" +github: + owner: "rajnandan1" + repo: "kener" + incidentSince: 48 +metaTags: + description: "Kener: Open-source modern looking Node.js status page tool, designed to make service monitoring and incident handling a breeze. It offers a sleek and user-friendly interface that simplifies tracking service outages and improves how we communicate during incidents. And the best part? Kener integrates seamlessly with GitHub, making incident management a team effort—making it easier for us to track and fix issues together in a collaborative and friendly environment." + keywords: "Node.js status page, Incident management tool, Service monitoring, Service outage tracking, Real-time status updates, GitHub integration for incidents, Open-source status page, Node.js monitoring application, Service reliability, User-friendly incident management, Collaborative incident resolution, Seamless outage communication, Service disruption tracker, Real-time incident alerts, Node.js status reporting" + og:description: "Kener: Open-source Node.js status page tool, designed to make service monitoring and incident handling a breeze. It offers a sleek and user-friendly interface that simplifies tracking service outages and improves how we communicate during incidents. And the best part? Kener integrates seamlessly with GitHub, making incident management a team effort—making it easier for us to track and fix issues together in a collaborative and friendly environment." + og:image: "https://kener.ing/ss.png" + og:title: "Kener - Open-Source and Modern looking Node.js Status Page for Effortless Incident Management" + og:type: "website" + og:site_name: "Kener" + twitter:card: "summary_large_image" + twitter:site: "@_rajnandan_" + twitter:creator: "@_rajnandan_" + twitter:image: "https://kener.ing/ss.png" + twitter:title: "Kener: Open-Source and Modern looking Node.js Status Page for Effortless Incident Management" + twitter:description: "Kener: Open-source Node.js status page tool, designed to make service monitoring and incident handling a breeze. It offers a sleek and user-friendly interface that simplifies tracking service outages and improves how we communicate during incidents. And the best part? Kener integrates seamlessly with GitHub, making incident management a team effort—making it easier for us to track and fix issues together in a collaborative and friendly environment." +nav: + - name: "Documentation" + url: "/docs" + - name: "Github" + url: "https://github.com/rajnandan1/kener" +hero: + title: Kener is a Open-Source Status Page System + subtitle: Let your users know what's going on. +footerHTML: | + Made using + + Kener + + an open source status page system built with Svelte and TailwindCSS. +i18n: + defaultLocale: "en" + locales: + en: "English" + hi: "हिन्दी" + zh-CN: "中文" + ja: "日本語" + vi: "Tiếng Việt" +theme: dark diff --git a/docker-compose.yml b/docker-compose.yml index 9a253ff6..d33da656 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,22 +1,27 @@ version: '3.7' services: kener: - build: - context: . - dockerfile: Dockerfile - container_name: kener - env_file: .env + image: rajnandan1/kener:release-candidate-0.0.16 # assuming this is final namespace/image + container_name: kener-rc + #env_file: .env #uncomment this, if you are using .env file environment: - TZ=Etc/GMT - - PUID=911 - - PGID=911 + #- GH_TOKEN= + #- API_TOKEN= + #- API_IP= + #- API_IP_REGEX= + #- KENER_BASE_PATH= + + # If running on a LINUX HOST and not podman rootless these MUST BE SET + # run "id $user" from command line and replace numbers below with output from command + #- PUID=1000 # gid + #- PGID=1000 # uid + + ### Most likely DO NOT need to change anything below this ### + + #- PORT=3000 Port app listens on IN CONTAINER ports: - - "3001:3001" + - '3000:3000/tcp' volumes: - - ./database:/app/database:rw - restart: unless-stopped - healthcheck: - test: ["CMD", "wget", "--spider", "http://localhost:3001"] - interval: 30s - timeout: 30s - retries: 3 \ No newline at end of file + - './database:/app/database:rw' + - './config:/app/config' diff --git a/docs/deployment.md b/docs/deployment.md index cccf228e..5cd65384 100644 --- a/docs/deployment.md +++ b/docs/deployment.md @@ -1,33 +1,31 @@ -# Deployment - -```shell -export NODE_ENV=production -npm i -npm run build -npm run serve -``` +--- +title: Kener Deployment - From Source or Docker +description: Kener can be deployed in multiple ways. You can use the pre-built docker image or build from source. +--- -It also needs 2 yaml files to work +# Deployment -- site.yaml: Contains information about the site -- monitors.yaml: Contains your monitors and their related specifications +Kener can be deployed in multiple ways. You can use the pre-built docker image or build from source. -By default these are present in `config/`. However you can use different location either passing them as argument or having the path as enviorment variable +## Prerequisites -## Add as Environment variables +Make sure you have the following installed: -```shell -export MONITOR_YAML_PATH=/your/path/monitors.yaml -export SITE_YAML_PATH=/your/path/site.yaml -``` +- [Node.js](https://nodejs.org/en/download/) +- [npm](https://www.npmjs.com/get-npm) +- [config/site.yaml](/docs/customize-site) Contains information about the site +- [config/monitors.yaml](/docs/monitors) Contains your monitors and their related specifications +- [Set up Environment Variables](/docs/environment-vars) -## Add as argument to prod.js +## Source ```shell -npm run serve -- --monitors /your/path/monitors.yaml --site /your/path/site.yaml +npm i +npm run build +npm run prod ``` -## Install using Docker +## Docker [Dockerhub](https://hub.docker.com/r/rajnandan1/kener) @@ -41,12 +39,26 @@ docker.io/rajnandan1/kener:latest ghcr.io/rajnandan1/kener:latest ``` -You should mount a host directory to persist your configuration and expose the web port. [Environmental variables](https://rajnandan1.github.io/kener-docs/docs/environment-vars) can be passed with `-e` An example `docker run` command: +You should mount two host directories to persist your configuration and database. [Environmental variables](https://rajnandan1.github.io/kener-docs/docs/environment-vars) can be passed with `-e` An example `docker run` command: + +```shell +docker run \ + -v $(pwd)/database:/app/database \ + -v $(pwd)/config:/app/config \ + -p 3000:3000 \ + -e "GH_TOKEN=1234" \ + rajnandan1/kener +``` -Make sure you have a `/static` folder inside your config folder +You can also use a .env file ```shell -docker run -d -v /path/on/host/config:/config -p 3000:3000 -e "GH_TOKEN=1234" rajnandan1/kener +docker run \ + -v $(pwd)/database:/app/database \ + -v $(pwd)/config:/app/config \ + --env-file .env \ + -p 3000:3000 \ + rajnandan1/kener ``` Or use **Docker Compose** with the example [docker-compose.yaml](https://raw.githubusercontent.com/rajnandan1/kener/main/docker-compose.yml) @@ -71,4 +83,8 @@ Then add to your docker command like so: docker run -d ... -e "PUID=1000" -e "PGID=1000" ... rajnandan1/kener ``` -or substitute them in [docker-compose.yml](https://raw.githubusercontent.com/rajnandan1/kener/main/docker-compose.yml) \ No newline at end of file +or substitute them in [docker-compose.yml](https://raw.githubusercontent.com/rajnandan1/kener/main/docker-compose.yml) + +## Base path + +By default kener runs on `/` but you can change it to `/status` or any other path. Read more about it [here](/docs/environment-vars/#kener-base-path) diff --git a/docs/environment-vars.md b/docs/environment-vars.md index 791690bf..66194649 100644 --- a/docs/environment-vars.md +++ b/docs/environment-vars.md @@ -57,3 +57,16 @@ By default kener runs on `/` but you can change it to `/status` or any other pat ```shell export KENER_BASE_PATH=/status ``` + +## Using .env + +You can also use a `.env` file to set these variables. Create a `.env` file in the root of the project and add the variables like below + +```shell +PORT=4242 +GH_TOKEN=your-github-token +API_TOKEN=sometoken +API_IP= +API_IP_REGEX= +KENER_BASE_PATH=/status +``` diff --git a/docs/home.md b/docs/home.md index 38e3bb3f..cc92c659 100644 --- a/docs/home.md +++ b/docs/home.md @@ -1,4 +1,4 @@ -# Kener - Status Page System +# Kener - A Sveltekit NodeJS Status Page System
@@ -19,7 +19,7 @@ #### 👉 Visit a live server [here](https://kener.ing) -#### 👉 Quick Start [here](https://rajnandan1.github.io/kener-docs/docs/quick-start) +#### 👉 Quick Start [here](/docs/quick-start) Kener: Open-source Node.js status page tool, designed to make service monitoring and incident handling a breeze. It offers a sleek and user-friendly interface that simplifies tracking service outages and improves how we communicate during incidents. And the best part? Kener integrates seamlessly with GitHub, making incident management a team effort—making it easier for us to track and fix issues together in a collaborative and friendly environment. @@ -36,7 +36,7 @@ It uses files to store the data. Other adapters are coming soon - Cron-based scheduling for monitors. Minimum per minute - Flexible monitor configuration using YAML. Define your own parsing for monitor being UP/DOWN/DEGRADED - Construct complex API Polls - Chain, Secrets etc -- Supports a Default Status for Monitors. Example defaultStatus=DOWN if you dont hit API per minute with Status UP +- Supports a Default Status for Monitors. Example defaultStatus=DOWN if you don't hit API per minute with Status UP - Supports base path for hosting in k8s - Pre-built docker image for easy deployment @@ -71,13 +71,6 @@ It uses files to store the data. Other adapters are coming soon - [Upptime](https://upptime.js.org/) -## Roadmap - -- [x] Add api to create incident -- [x] Add docker file -- [ ] Add notification -- [ ] Add Mysql adapter - ## Support Me If you are using Kener and want to support me, you can do so by sponsoring me on GitHub or buying me a coffee. diff --git a/docs/how-it-works.md b/docs/how-it-works.md index 60ed6d95..ffcd9a5c 100644 --- a/docs/how-it-works.md +++ b/docs/how-it-works.md @@ -22,8 +22,8 @@ Kener has two parts. ## Site.yaml -This is the configuration file for your site. This is where you define the name of your site, the look and feel of your site etc +This is the configuration file for your site. This is where you define the name of your site, the look and feel of your site etc. Read more about it [here](/docs/customize-site) ## Monitors.yaml -This is the configuration file for your monitors. This is where you define the monitors you want to show on your site. +This is the configuration file for your monitors. This is where you define the monitors you want to show on your site. Read more about it [here](/docs/monitors) diff --git a/docs/i18n.md b/docs/i18n.md index 97d0650a..7fb23145 100644 --- a/docs/i18n.md +++ b/docs/i18n.md @@ -1,6 +1,6 @@ # i18n -You can add translations to your site. By default it is set to `en`. Available translations are present in `locales/` folders in the root directory. You can add more translations by adding a new file in the `locales` folder. +You can add translations to your site. By default it is set to `en`. Available translations are present in `/src/lib/locales/` folders in the root directory. You can add more translations by adding a new file in the `/src/lib/locales` folder. ## How to enable a translation @@ -18,22 +18,19 @@ i18n: > **_defaultLocale:_** The default locale to be used. This will be the language used when a user visits the site for the first time. It is important to note that the default locale json file should be present in the locales folder. - ## Variables There are few variables that you you should not change, -- %hours : This will be replaced by the hours -- %minutes : This will be replaced by the minutes -- %minute : This will be replaced by the minute -- %status : This will be replaced by the status - -> **locales:_** A list of locales that you want to enable. The key is the locale code and the value is the name of the language. The locale code should be the same as the json file name in the locales folder. `en` means `en.json` should be present in the locales folder. - +- %hours : This will be replaced by the hours +- %minutes : This will be replaced by the minutes +- %minute : This will be replaced by the minute +- %status : This will be replaced by the status +> **locales:\_** A list of locales that you want to enable. The key is the locale code and the value is the name of the language. The locale code should be the same as the json file name in the locales folder. `en` means `en.json` should be present in the locales folder. Adding more than one locales will enable a dropdown in the navbar to select the language. Selected languages are stored in cookies and will be used when the user visits the site again. -There is no auto detection of the language. The user has to manually select the language. \ No newline at end of file +There is no auto detection of the language. The user has to manually select the language. diff --git a/docs/quick-start.md b/docs/quick-start.md index 8f91aa72..bd7bb624 100644 --- a/docs/quick-start.md +++ b/docs/quick-start.md @@ -21,8 +21,8 @@ npm install - Rename `config/monitors.example.yaml` -> `config/monitors.yaml` ```shell -mv src/lib/server/config/site.example.yaml src/lib/server/config/site.yaml -mv src/lib/server/config/monitors.example.yaml src/lib/server/config/monitors.yaml +mv config/site.example.yaml config/site.yaml +mv config/monitors.example.yaml config/monitors.yaml ``` ## Start Kener Development Server diff --git a/package.json b/package.json index c8ffb51e..d0372ef2 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,9 @@ "schedule": "node src/lib/server/startup.js", "development": "vite dev", "dev": "npm-run-all --parallel schedule development", - "prettify": "prettier --write ." + "prettify": "prettier --write .", + "start": "node main.js", + "prod": "npm-run-all --parallel schedule start" }, "devDependencies": { "@sveltejs/adapter-auto": "^2.0.0", diff --git a/src/docs.css b/src/docs.css new file mode 100644 index 00000000..6acc41b5 --- /dev/null +++ b/src/docs.css @@ -0,0 +1,3 @@ +code:not([class^="language-"]) { + @apply rounded bg-gray-100 px-1.5 py-0.5 font-mono text-sm text-xs dark:bg-gray-800; +} diff --git a/src/lib/components/monitor.svelte b/src/lib/components/monitor.svelte index 29ef9071..5e671ea1 100644 --- a/src/lib/components/monitor.svelte +++ b/src/lib/components/monitor.svelte @@ -354,7 +354,11 @@ on:click={copyDotStandard} > {#if !copiedBadgeDotStandard} - + {l(lang, "monitor.standard")} @@ -371,7 +375,11 @@ on:click={copyDotPing} > {#if !copiedBadgeDotPing} - + {l(lang, "monitor.pinging")} diff --git a/src/lib/server/startup.js b/src/lib/server/startup.js index af483830..6e3c3840 100644 --- a/src/lib/server/startup.js +++ b/src/lib/server/startup.js @@ -23,7 +23,6 @@ let monitors = []; let site = {}; const envSecrets = []; const DATABASE_PATH = "./database"; -console.log(process.env); const Startup = async () => { const FOLDER_MONITOR_JSON = DATABASE_PATH + "/monitors.json"; const monitors = fs.readJSONSync(FOLDER_MONITOR_JSON); diff --git a/src/routes/(docs)/+layout.svelte b/src/routes/(docs)/+layout.svelte index 4db0d91b..b968911f 100644 --- a/src/routes/(docs)/+layout.svelte +++ b/src/routes/(docs)/+layout.svelte @@ -1,6 +1,7 @@