Skip to content

Commit

Permalink
Merge pull request #166 from nook24/vitepress
Browse files Browse the repository at this point in the history
Refactor Naemon Website with VitePress
  • Loading branch information
nook24 authored Nov 25, 2024
2 parents bb50db8 + bf9feab commit 385243d
Show file tree
Hide file tree
Showing 471 changed files with 1,312 additions and 1,190 deletions.
2 changes: 2 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
VITE_RELEASE_VERSION=1.4.3
VITE_RELEASE_DATE=19 Nov 2024
49 changes: 45 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,45 @@
_site
.bundle
.gem
Gemfile.lock
# Thanks to CakePHP for the good .gitignore
# https://github.com/cakephp/cakephp/blob/33626a03197758f30a8ce8c2e0a75ed8ddbce40a/.gitignore

# VitePress files #
##################
node_modules
package-lock.json
.vitepress/cache
.vitepress/dist

# OS generated files #
######################
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
Icon?
ehthumbs.db
Thumbs.db
*Zone.Identifier

# Tool specific files #
#######################
# vim
*~
*.swp
*.swo
# sublime text & textmate
*.sublime-*
*.stTheme.cache
*.tmlanguage.cache
*.tmPreferences.cache
# Eclipse
.settings/*
/.project
/.buildpath
# JetBrains, aka PHPStorm, IntelliJ IDEA
.idea/*
# NetBeans
nbproject/*
# Visual Studio Code
.vscode


94 changes: 94 additions & 0 deletions .vitepress/config.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
import { defineConfig } from 'vitepress'


// https://vitepress.dev/reference/site-config
export default defineConfig({
lang: 'en-US',
title: "Naemon - Monitoring Suite",
description: "Naemon is the new monitoring suite that aims to be fast, stable and innovative while giving you a clear view of the state of your network and applications.",
head: [
['link', { rel: 'icon', href: '/favicon.ico' }]
],

// Can be removed as soon as the legacy content is removed
srcExclude: [ '**/legacy/**' ],

themeConfig: {

logo: '/images/svg/naemonlogo.svg',
siteTitle: false,

// https://vitepress.dev/reference/default-theme-config
nav: [
{ text: 'Home', link: '/' },
{ text: 'Download', link: '/download' },
{
text: 'Documentation',
activeMatch: `^/documentation/`,
items: [
{ text: 'Users Guide', link: '/documentation/usersguide/toc' },
{ text: 'Developers', link: '/documentation/developer/toc' },
{ text: 'FAQ', link: '/documentation/faq' },
]
},
{ text: 'Get involved', link: '/community' },
],

// show h2 and h3 in the outline menu (On this page)
// https://vitepress.dev/reference/default-theme-config#outline
outline: [2, 3],

sidebar: [
{
text: 'Examples',
items: [
{ text: 'Download', link: '/download' },
]
},
{
text: 'Documentation',
link: '/documentation',
collapsed: false,
items: [
{
text: 'Users Guide', link: '/documentation/usersguide/toc', items: [
{ text: 'What is Naemon', link: '/documentation/usersguide/about' },
{ text: 'What\'s New', link: '/documentation/usersguide/whatsnew' },
{ text: 'Naemon Logo', link: '/logo' }
]
},
{
text: 'Developers', link: '/documentation/developer/toc', items: [
{ text: 'Build Naemon From Scratch', link: '/documentation/developer/build' },
{ text: 'Worker Processes', link: '/documentation/developer/workers' },
{ text: 'Naemon Event Broker Modules (NEB)', link: '/documentation/developer/neb_broker' },
{ text: 'API Incompatibilities between Nagios 3', link: '/documentation/developer/api-incompat3to4' },
{ text: 'Query Handlers', link: '/documentation/developer/queryhandlers' },
{ text: 'Check Result Spoolfolder', link: '/documentation/developer/spoolfolder' },
{ text: 'Naemon Website', link: '/documentation/developer/website' }
]
},
{
text: 'FAQ', link: '/documentation/faq', items: [
{ text: 'Usersguide guidelines', link: '/documentation/faq/usersguide-guidelines' },
{ text: 'Markdown guide', link: '/documentation/faq/vitepress-markdown-guide' }
]
}
]
}
],

socialLinks: [
{ icon: 'github', link: 'https://github.com/naemon' },
{ icon: 'x', link: 'https://x.com/naemoncore' }
],

search: {
provider: 'local'
},

editLink: {
pattern: 'https://github.com/naemon/naemon.github.io/edit/main/:path'
}
}
})
16 changes: 16 additions & 0 deletions .vitepress/theme/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// .vitepress/theme/index.js
import type { Theme } from 'vitepress'
import DefaultTheme from 'vitepress/theme'
import '@fortawesome/fontawesome-free/css/all.css'
import './naemon.css'

export default {
extends: DefaultTheme,
enhanceApp({ app }) {

// Load global variables from .env file
// VITE_RELEASE_VERSION will become available as $RELEASE_VERSION in the Markdown files
app.config.globalProperties.$RELEASE_VERSION = import.meta.env.VITE_RELEASE_VERSION
app.config.globalProperties.$RELEASE_DATE = import.meta.env.VITE_RELEASE_DATE
}
} satisfies Theme
15 changes: 15 additions & 0 deletions .vitepress/theme/naemon.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/* Custom CSS for the Naemon web site
* see https://vitepress.dev/guide/extending-default-theme#customizing-css
* and https://github.com/vuejs/vitepress/blob/main/src/client/theme-default/styles/vars.css
*/
:root {
--vp-c-brand-1: #039BE5;
--vp-c-brand-2: #0277BD;
--vp-c-brand-3: #01579B;

--vp-home-hero-name-color: transparent;
--vp-home-hero-name-background: -webkit-linear-gradient(-45deg, #4FC3F7 50%, var(--vp-c-brand-1));

--vp-home-hero-image-background-image: linear-gradient(45deg, var(--vp-c-brand-2) 50%, var(--vp-c-brand-1) 50%);
--vp-home-hero-image-filter: blur(68px);
}
18 changes: 7 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
FROM alpine:3.19

# This is highly inspired from https://github.com/Starefossen/docker-github-pages
# Many thanks
# Also thanks to https://pmarinova.github.io/2023/10/10/running-github-pages-gem-locally-with-docker.html

RUN apk --update add --virtual build_deps \
build-base ruby-dev libc-dev linux-headers jekyll
RUN gem install --verbose --no-document github-pages bundler
FROM node:22-alpine

RUN mkdir -p /site

WORKDIR /site

EXPOSE 4000
COPY package.json /site/package.json

RUN npm install --verbose

EXPOSE 5173

CMD bundle install && bundle exec jekyll serve --watch --force_polling -H 0.0.0.0 -P 4000
CMD npm run docs:dev
56 changes: 44 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,59 @@
naemon.github.io
================
# Naemon Documentation

This repository contains the documentation and website of the Naemon project.

The naemon website.

Written for [Jekyll](http://jekyllrb.com/), and relying on [bootstrap](http://getbootstrap.com/).
Build with [VitePress](https://vitepress.dev/).

## Work in process

We are currently migrating the website from [Jekyll](http://jekyllrb.com/) to [VitePress](https://vitepress.dev/).
To do so, all old files got moved into the `legacy` folder using `git mv`. This will prevent to git history.

To migrate a page from Jekyll to VitePress, you have to use the `git mv` command, to move the file from the `legacy` folder into the
new VitePress project.

```
git mv legacy/README.md README.md
```

In the next step, edit the file, apply all the required changes and command your work.

Install locally
---------------
Read the online guide from github at:
https://help.github.com/articles/setting-up-your-github-pages-site-locally-with-jekyll/

## Run development server

Run locally using Docker
---------------
Please see the documentation of how to setup a local copy of the Naemon website.

First build the Docker image which will contain Ruby, Jekyll and all the required dependencies
[Run Naemon Website Locally ](./documentation/developer/website.md)

### In a nutshell
```
git clone https://github.com/naemon/naemon.github.io.git
cd naemon.github.io.git/
npm install
npm run docs:dev
```

### Using Docker
In case you do not want to install Nodejs to your system, you can also use Docker

First build the Docker image which will contain N Nodejs - thats all this documentation has no dependencies
```
docker build . -t naemon/docs
```

Now run the Docker container and navigate to `http://127.0.0.1:4000` in your browser.
Now run the Docker container and navigate to `http://127.0.0.1:5173` in your browser.
The container watches for file changes and will automatically regenerate the website if needed.

```
docker run --rm -it -v "$PWD":/site -p "4000:4000" naemon/docs:latest
docker run --rm -it -v "$PWD":/site -p "5173:5173" naemon/docs:latest
```

### Important for the Migration

1. Remove all HTML from the Markdown files. Probably in 99% it's not required and can be done using Markdown.
2. All headlines have to get reduced by one ( remove one hashtag `###` gets to `##`)
3. You can modify HTML anchors like so: `## What Is Naemon? {#whatis}`
4. Add code blocks `like this` for code instead of quotes 'like so'.
17 changes: 17 additions & 0 deletions community.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Get involved

We have several of the usual means of contact:

<!--@include: ./includes/contacts.md-->

We need our own [documentation](/documentation/) quite desperately. If you want to send us pull requests, or discuss how we should run the documentation project, get in touch.

We're in great need of people who like to write web content, draw logos, make things pretty, and general do all the things that at no point involve debugging linker errors. If that's your cup of tea, do help us out, will ya?

We would love more testers - fetch [development packages](/download#development_snapshot) and give us feedback. If you have ideas about how to do testing better, we would love that too.

Supposedly there are bugs as well, both in the [core](https://github.com/naemon/naemon-core/issues) and [base](https://github.com/naemon/naemon/issues) project. We love it for there to be fewer of those.

If you're interested in one of these things, or something else you'd like to us about, find us on IRC or send an email.

[Why Naemon?](/project)
24 changes: 0 additions & 24 deletions community/index.md

This file was deleted.

Loading

0 comments on commit 385243d

Please sign in to comment.