switch to use Fastly for deploying

This commit is contained in:
Neil Hanlon 2024-08-16 00:00:55 -04:00
parent 4d462f3d75
commit 7b6be30ae3
Signed by untrusted user: neil
GPG Key ID: 705BC21EC3C70F34
17 changed files with 2326 additions and 36 deletions

View File

@ -11,31 +11,31 @@ jobs:
image: docker.io/rockylinux:9 image: docker.io/rockylinux:9
steps: steps:
- name: Install deps - name: Install deps
run: dnf -y install git python3 python3-pip
- name: setup ssh
env:
SSH_KEY: "${{ secrets.SSH_KEY }}"
run: | run: |
mkdir -p ~/.ssh/ dnf -y upgrade
echo "$SSH_KEY" > ~/.ssh/id_rsa dnf -y install git python3 python3-pip cairo-devel
chmod 0700 ~/.ssh/
chmod 0600 ~/.ssh/id_rsa
- name: checkout - name: checkout
env:
GIT_SSH_COMMAND: "ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"
run: run:
git clone https://git.resf.org/$GITHUB_REPOSITORY.git $GITHUB_WORKSPACE git clone https://git.resf.org/$GITHUB_REPOSITORY.git $GITHUB_WORKSPACE
- name: Install python requirements - name: Install python requirements
run: python3 -m pip install -r requirements.txt run: python3 -m pip install -r requirements.txt
- name: Build
run: |
python3 -m mkdocs build
- name: Install fastly CLI
run: |
dnf -y install \
npm \
https://github.com/fastly/cli/releases/download/v10.13.3/fastly_10.13.3_linux_amd64.rpm
- name: Deploy - name: Deploy
env: env:
GIT_SSH_COMMAND: "ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" FASTLY_API_TOKEN: "${{ secrets.FASTLY_API_TOKEN }}"
GIT_AUTHOR_NAME: "Rocky Bot"
GIT_AUTHOR_EMAIL: "auto@rockylinux.org"
run: | run: |
git remote set-url origin ssh://git@git.resf.org:22220/$GITHUB_REPOSITORY.git pushd compute-js
python3 -m mkdocs gh-deploy --force npm install
fastly compute publish

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/site

4
compute-js/.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
/node_modules
/bin
/pkg
/static-publisher

2
compute-js/.publish-id Normal file
View File

@ -0,0 +1,2 @@
# Generated by @fastly/compute-js-static-publish.
2U3RUindKvK1F6Sb7AEHXZ

12
compute-js/fastly.toml Normal file
View File

@ -0,0 +1,12 @@
# This file describes a Fastly Compute package. To learn more visit:
# https://www.fastly.com/documentation/reference/compute/fastly-toml
authors = ["sig-altarch@rocky.page"]
description = "SIG/AltArch Wiki"
language = "javascript"
manifest_version = 2
name = "sig-altarch.rocky.page"
service_id = "vvJfk2GYOVZGX7FPrEHEa5"
[scripts]
build = "npm run build"

2051
compute-js/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

23
compute-js/package.json Normal file
View File

@ -0,0 +1,23 @@
{
"name": "sig-altarch.rocky.page",
"version": "0.1.0",
"description": "SIG/Altarch Wiki",
"author": "sig-altarch@rocky.page",
"type": "module",
"devDependencies": {
"@fastly/compute-js-static-publish": "^6.0.3"
},
"dependencies": {
"@fastly/js-compute": "^3.20.0"
},
"engines": {
"node": ">=18.0.0"
},
"license": "UNLICENSED",
"private": true,
"scripts": {
"deploy": "fastly compute deploy",
"prebuild": "npx @fastly/compute-js-static-publish --build-static",
"build": "js-compute-runtime ./src/index.js ./bin/main.wasm"
}
}

18
compute-js/src/index.js Normal file
View File

@ -0,0 +1,18 @@
/// <reference types="@fastly/js-compute" />
import { getServer } from '../static-publisher/statics.js';
const staticContentServer = getServer();
// eslint-disable-next-line no-restricted-globals
addEventListener("fetch", (event) => event.respondWith(handleRequest(event)));
async function handleRequest(event) {
const response = await staticContentServer.serveRequest(event.request);
if (response != null) {
return response;
}
// Do custom things here!
// Handle API requests, serve non-static responses, etc.
return new Response('Not found', { status: 404 });
}

View File

@ -0,0 +1,34 @@
/*
* Copyright Fastly, Inc.
* Licensed under the MIT license. See LICENSE file for details.
*/
// Commented items are defaults, feel free to modify and experiment!
// See README for a detailed explanation of the configuration options.
/** @type {import('@fastly/compute-js-static-publish').StaticPublisherConfig} */
const config = {
rootDir: "../site",
staticContentRootDir: "./static-publisher",
// kvStoreName: false,
// excludeDirs: [ './node_modules' ],
// excludeDotFiles: true,
// includeWellKnown: true,
// contentAssetInclusionTest: (filename) => true,
// contentCompression: [ 'br', 'gzip' ], // For this config value, default is [] if kvStoreName is null.
// moduleAssetInclusionTest: (filename) => false,
// contentTypes: [
// { test: /.custom$/, contentType: 'application/x-custom', text: false },
// ],
server: {
publicDirPrefix: "",
staticItems: ["/assets/"],
// compression: [ 'br', 'gzip' ],
spaFile: false,
notFoundPageFile: "/404.html",
autoExt: [],
autoIndex: ["index.html","index.htm"],
},
};
export default config;

33
docs/assets/extra.css Normal file
View File

@ -0,0 +1,33 @@
:root {
@media screen and (max-width: 76.234375em) {
.md-nav__title[for="__drawer"] {
background: linear-gradient(135deg, #10b981 0%, #1055b9 100%);
}
}
}
[data-md-color-scheme="resf"] {
--md-accent-fg-color: #0e7391;
--md-primary-fg-color--dark: #107fa1;
--md-primary-fg-color--light: #FFFFFF;
--md-primary-fg-color: #107fa1;
--md-typeset-a-color: #107fa1;
}
[data-md-color-scheme="resf-dark"] {
color-scheme: dark;
--md-default-fg-color: #FFFFFF;
--md-default-bg-color: rgb(30, 33, 41);
--md-primary-fg-color: #107fa1;
--md-primary-bg-color: #FFFFFF;
--md-primary-fg-color--dark: #107fa1;
--md-accent-fg-color: #0e7391;
--md-default-fg-color--light: rgba(226, 228, 233, 0.56);
--md-typeset-table-color: rgba(240, 241, 244, 0.12);
--md-typeset-color: rgba(226, 228, 233, 0.82);
--md-typeset-a-color: #107fa1;
}

View File

@ -0,0 +1,3 @@
<svg width="4096" height="4096" viewBox="0 0 192 192" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M186.658 127.658C190.119 117.746 192 107.093 192 96C192 42.9807 149.019 0 96 0C42.9807 0 0 42.9807 0 96C0 122.234 10.523 146.011 27.5783 163.338L124.958 65.9584L149 90L186.658 127.658ZM169.122 158.205L124.958 114.042L55.7978 183.202C68.0268 188.849 81.6455 192 96 192C125.288 192 151.514 178.884 169.122 158.205Z" fill="white"/>
</svg>

After

Width:  |  Height:  |  Size: 487 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 381 KiB

BIN
docs/assets/resf-icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

View File

@ -0,0 +1,63 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="44.450001mm"
height="44.450001mm"
viewBox="0 0 44.450001 44.450001"
version="1.1"
id="svg1"
inkscape:version="1.3.2 (091e20ef0f, 2023-11-25)"
sodipodi:docname="resf-white.svg"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<sodipodi:namedview
id="namedview1"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:showpageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#d1d1d1"
inkscape:document-units="mm"
inkscape:zoom="1.624662"
inkscape:cx="105.86818"
inkscape:cy="665.36917"
inkscape:window-width="1440"
inkscape:window-height="3356"
inkscape:window-x="0"
inkscape:window-y="52"
inkscape:window-maximized="1"
inkscape:current-layer="layer1" />
<defs
id="defs1" />
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(-2.5796834,-3.8748417)">
<path
d="M 2.5796834,3.8748417 H 47.029686 V 31.39389 l -6.87626,-6.876256 -5.13556,5.135562 -10.27113,-10.271125 -5.13556,5.135298 -10.2710976,-10.271045 -6.760395,6.760289 z"
fill="#ffffff"
id="path3"
style="stroke-width:0.264583" />
<path
d="m 40.153426,32.220977 -16.10386,16.103865 h 22.98012 v -9.227609 z"
fill="#ffffff"
id="path4"
style="stroke-width:0.264583" />
<path
d="M 24.746736,27.085415 31.166056,33.505 16.346271,48.324842 H 3.5072594 Z"
fill="#ffffff"
id="path5"
style="stroke-width:0.264583" />
<path
d="m 9.3400784,21.949588 -6.760395,6.760633 V 41.549127 L 15.759558,28.369173 Z"
fill="#ffffff"
id="path6"
style="stroke-width:0.264583" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

@ -1,3 +1,5 @@
# SIG/AltArch meeting 2024-08-23
## Attendees ## Attendees
* Neil Hanlon * Neil Hanlon

View File

@ -11,24 +11,23 @@ repo_name: sig_altarch/wiki
edit_uri: _edit/main/docs/ edit_uri: _edit/main/docs/
# Copyright # Copyright
copyright: Copyright &copy; 2023 Rocky Enterprise Software Foundation copyright: Copyright &copy; 2024 Rocky Enterprise Software Foundation
extra_css:
- assets/extra.css
# Configuration # Configuration
theme: theme:
name: material name: material
logo: assets/icon-white.svg logo: assets/resf-white.svg
palette: palette:
- media: "(prefers-color-scheme: light)" - media: "(prefers-color-scheme: light)"
scheme: default scheme: resf
primary: teal
accent: teal
toggle: toggle:
icon: material/weather-night icon: material/weather-night
name: Switch to dark mode name: Switch to dark mode
- media: "(prefers-color-scheme: dark)" - media: "(prefers-color-scheme: dark)"
scheme: slate scheme: resf-dark
primary: teal
accent: teal
toggle: toggle:
icon: material/weather-sunny icon: material/weather-sunny
name: Switch to light mode name: Switch to light mode
@ -54,6 +53,7 @@ theme:
# Plugins # Plugins
plugins: plugins:
- autolinks - autolinks
- social
- awesome-pages - awesome-pages
- git-revision-date-localized: - git-revision-date-localized:
type: date type: date
@ -69,8 +69,8 @@ markdown_extensions:
- meta - meta
- pymdownx.details # this allows collapsible attributions - pymdownx.details # this allows collapsible attributions
- pymdownx.emoji: - pymdownx.emoji:
emoji_index: !!python/name:materialx.emoji.twemoji emoji_index: !!python/name:material.extensions.emoji.twemoji
emoji_generator: !!python/name:materialx.emoji.to_svg emoji_generator: !!python/name:material.extensions.emoji.to_svg
- pymdownx.superfences - pymdownx.superfences
- pymdownx.tabbed: - pymdownx.tabbed:
alternate_style: true alternate_style: true

View File

@ -1,7 +1,51 @@
mkdocs babel==2.16.0
mkdocs-autolinks-plugin bracex==2.5
mkdocs-awesome-pages-plugin cairocffi==1.7.1
mkdocs-git-revision-date-localized-plugin CairoSVG==2.7.1
mkdocs-macros-plugin certifi==2024.7.4
mkdocs-material cffi==1.17.0
mkdocs-windmill charset-normalizer==3.3.2
click==8.1.7
colorama==0.4.6
cssselect2==0.7.0
defusedxml==0.7.1
ghp-import==2.1.0
gitdb==4.0.11
GitPython==3.1.43
idna==3.8
Jinja2==3.1.4
Markdown==3.7
MarkupSafe==2.1.5
mergedeep==1.3.4
mkdocs==1.6.0
mkdocs-autolinks-plugin==0.7.1
mkdocs-awesome-pages-plugin==2.9.3
mkdocs-get-deps==0.2.0
mkdocs-git-revision-date-localized-plugin==1.2.7
mkdocs-macros-plugin==1.0.5
mkdocs-material==9.5.33
mkdocs-material-extensions==1.3.1
mkdocs-windmill==1.0.5
natsort==8.4.0
packaging==24.1
paginate==0.5.6
pathspec==0.12.1
pillow==10.4.0
platformdirs==4.2.2
pycparser==2.22
Pygments==2.18.0
pymdown-extensions==10.9
python-dateutil==2.9.0.post0
pytz==2024.1
PyYAML==6.0.2
pyyaml_env_tag==0.1
regex==2024.7.24
requests==2.32.3
six==1.16.0
smmap==5.0.1
termcolor==2.4.0
tinycss2==1.3.0
urllib3==2.2.2
watchdog==4.0.2
wcmatch==9.0
webencodings==0.5.1