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
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @pnpavlov
25 changes: 25 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
version: 2
updates:
# Enable version updates for npm
- package-ecosystem: "npm"
# Look for `package.json` and `lock` files in the `root` directory
directory: "/"
# Check the npm registry for updates every day (weekdays)
schedule:
interval: "weekly"

# Enable version updates for Docker
- package-ecosystem: "docker"
# Look for a `Dockerfile` in the `root` directory
directory: "/"
# Check for updates once a week
schedule:
interval: "weekly"

# Enable version updates for GitHub Actions
- package-ecosystem: "github-actions"
# Workflow files stored in the default location of `.github/workflows`
# You don't need to specify `/.github/workflows` for `directory`. You can use `directory: "/"`.
directory: "/"
schedule:
interval: "weekly"
98 changes: 98 additions & 0 deletions .github/workflows/release-to-container.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
name: Release Container

# Based on https://vitepress.dev/guide/deploy#github-pages
# Enables automatic publishing of the website to GitHub Pages from main branch.
env:
platforms: linux/amd64,linux/arm64
on:
# run the workflow only for main branch or PRs
push:
branches:
- main
pull_request:
release:
types:
- released
# Allows you to run this workflow manually from the Actions tab for debugging purposes
workflow_dispatch:

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: container
cancel-in-progress: false

jobs:
# Build job
build-web:
name: Build
# Specify runner + deployment step
runs-on: ubuntu-latest
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
packages: write
steps:
# Check out the branch
- name: Checkout
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
# Fix "Corepack must currently be enabled by running corepack enable in your terminal."
- name: Enable Corepack
run: corepack enable
# Setup Node.js with yarn support
- name: Setup Node
uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444
with:
node-version: "lts/*" # Ensures the latest LTS version is used
cache: yarn # npm / pnpm / yarn
# Install javascript dependencies with yarn
- name: Install dependencies
run: yarn install # or pnpm install / yarn install / bun install
# Build the website
- name: Build with VitePress
run: yarn run build # or pnpm docs:build / yarn docs:build / bun run docs:build
# # Publish as container
# publish-as-container:
# permissions:
# contents: read
# packages: write
# name: Build Container Image
# runs-on: ubuntu-latest
# # Add a dependency to the build job
# needs: build-web
# steps:
- name: Log in to GHCR
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Collect metadata
uses: docker/metadata-action@c1e51972afc2121e065aed6d45c65596fe445f3f
id: meta
with:
images: |
ghcr.io/${{ github.repository}}
tags: |
type=semver,pattern={{version}}
type=ref,event=branch
type=ref,event=tag
type=ref,event=pr
type=sha
flavor: |
latest=${{ startsWith(github.ref, 'refs/tags/') }}
- name: Set up QEMU
uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392
with:
platforms: ${{ env.platforms }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435
- name: Build and push Docker image
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83
with:
context: .
platforms: ${{ env.platforms }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
file: Containerfile
push: true
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
name: Deploy VitePress site to Pages
name: Release GitHub Page

# Based on https://vitepress.dev/guide/deploy#github-pages
# Enables automatic publishing of the website to GitHub Pages from main branch.
# Enables automatic publishing of the website to GitHub Pages from main branch.

on:
# Runs on pushes targeting the `main` branch. Change this to `master` if you're
# using the `master` branch as the default branch.
push:
branches: [main]
# push:
# branches: [main]

# Allows you to run this workflow manually from the Actions tab for debugging purposes
workflow_dispatch:
Expand All @@ -17,9 +17,9 @@ permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: pages
cancel-in-progress: false
Expand All @@ -34,16 +34,14 @@ jobs:
# Check out the branch
- name: Checkout
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
with:
fetch-depth: 0
# Fix "Corepack must currently be enabled by running corepack enable in your terminal."
- name: Enable Corepack
run: corepack enable
# Setup Node.js with yarn support
- name: Setup Node
uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444
with:
node-version: 'lts/*' # Ensures the latest LTS version is used
node-version: "lts/*" # Ensures the latest LTS version is used
cache: yarn # npm / pnpm / yarn
# Configure GitHub Pages
- name: Setup Pages
Expand All @@ -53,7 +51,7 @@ jobs:
run: yarn install # or pnpm install / yarn install / bun install
# Build the website
- name: Build with VitePress
run: yarn run docs:build # or pnpm docs:build / yarn docs:build / bun run docs:build
run: yarn run build # or pnpm docs:build / yarn docs:build / bun run docs:build
# Upload the artefact to GitHub Pages
- name: Upload artifact
uses: actions/upload-pages-artifact@7b1f4a764d45c48632c6b24a0339c27f5614fb0b
Expand All @@ -65,7 +63,7 @@ jobs:
# Execute deployment only from master branch
if: github.ref == 'refs/heads/main'
name: Deploy
runs-on: ubuntu-latest
runs-on: ubuntu-latest
# Add a dependency to the build job
needs: build
# Deploy to the github-pages environment
Expand Down
9 changes: 6 additions & 3 deletions .pnp.cjs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Containerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
FROM nginx:1-alpine-slim
COPY ./web/.vitepress/dist /usr/share/nginx/html
30 changes: 27 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@

## Run locally

### Prerequisites
### Local development

**TLDR:** If you have already Node.JS and yarn, you can start locally with `yarn dev`. If you don't - you can install them on MacOS via `./bin/prepare.sh`. The script follows the steps below:

1. Node.js is required. Recommendation is to manage it over [NVM](https://github.com/nvm-sh/nvm?tab=readme-ov-file#installing-and-updating). Can be as simple as
```bash
# Run latest https://github.com/nvm-sh/nvm?tab=readme-ov-file#install--update-script
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash
# Install latest Node.js LTS version
nvm install --lts
nvm install --lts --latest-npm
nvm use --lts
```

Expand All @@ -24,9 +26,31 @@
3. After Node.js and yarn are configured, you can run the app locally as described in the scripts section of package.json.

```bash
yarn docs:dev
yarn dev
```

### Running in container

You can the generated website in with prefered websever via podman or docker.
```bash
# build the website
yarn build
# run with podman, docker or your prefered container environment
podman run --rm -v ./web/.vitepress/dist:/usr/share/nginx/html:ro -it nginx:1.29-alpine-slim
```

### Building a container

```bash
# build the website
yarn build
# build your container
podman build -t ghcr.io/gardenlinux/website:local .
# run the image
podman run --rm -it -p 8080:80 ghcr.io/gardenlinux/website:local
```


## Bootstrap decisions

### Package manager
Expand Down
14 changes: 14 additions & 0 deletions bin/prepare.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash
set -euo pipefail

# solve nvm: command not found
. ~/.nvm/nvm.sh

# use latest lts nodejs & npm
nvm install --lts --latest-npm
nvm use --lts

# prepare yarn
npm install -g corepack
yarn set version stable
yarn install
88 changes: 88 additions & 0 deletions deployment/k8s/website.dev.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
apiVersion: v1
kind: Namespace
metadata:
annotations:
linkerd.io/inject: enabled
name: website
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: website
name: website
namespace: website
spec:
replicas: 1
selector:
matchLabels:
app: website
template:
metadata:
annotations:
linkerd.io/inject: enabled
labels:
app: website
spec:
containers:
- image: ghcr.io/gardenlinux/website:latest
name: http-echo
ports:
- containerPort: 80
resources:
limits:
cpu: 250m
memory: 256Mi
requests:
cpu: 125m
memory: 128Mi
---
apiVersion: v1
kind: Service
metadata:
labels:
app: website
name: website
namespace: website
spec:
ports:
- port: 80
protocol: TCP
targetPort: 80
selector:
app: website
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: website
namespace: website
annotations:
# Let Gardener manage external DNS records for this Ingress.
dns.gardener.cloud/dnsnames: dev.gardenlinux.org # Use "*" to collects domains names from .spec.rules[].host
dns.gardener.cloud/ttl: "300"
dns.gardener.cloud/class: garden
# If you are delegating the certificate management to Gardener, uncomment the following line
cert.gardener.cloud/purpose: managed
# If you're using a load balancer on AWS and expect the creation of both `A` and `AAAA` records, uncomment the following line
dns.gardener.cloud/ip-stack: dual-stack
spec:
ingressClassName: nginx
rules:
- host: dev.gardenlinux.org
http:
paths:
- pathType: Prefix
path: "/"
backend:
service:
name: website
port:
number: 80
# Uncomment the following part if you are delegating the certificate management to Gardener
tls:
- hosts:
- dev.gardenlinux.org
secretName: dev-gl-org
---

Loading