migrate to fastly for hosting
Some checks failed
mkdocs build / build (push) Successful in 25s
Deploy mkdocs based site / deploy (push) Has been cancelled

This commit is contained in:
Neil Hanlon 2025-03-05 09:49:27 -05:00
commit 1fff09f692
Signed by: neil
GPG key ID: 705BC21EC3C70F34
10 changed files with 2553 additions and 0 deletions

63
compute-js/.github/workflows/deploy.yml vendored Normal file
View file

@ -0,0 +1,63 @@
name: Deploy mkdocs based site
on:
push:
branches: [main]
paths-ignore:
- 'README.md'
- LICENSE
jobs:
deploy:
runs-on: ubuntu-latest
environment: Production
steps:
- uses: actions/checkout@v3
- name: Set up Fastly CLI
uses: fastly/compute-actions/setup@v11
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: install dependencies
run: pip install -r requirements.txt
- name: build site
run: mkdocs build
- name: install fastly-compute-js
run: npm install @fastly/js-compute @fastly/compute-js-static-publish
- name: Build Compute Package
uses: fastly/compute-actions/build@v11
with:
project_directory: compute-js
- name: Deploy Compute Package
uses: fastly/compute-actions/deploy@v11
with:
project_directory: compute-js
comment: "Deployed via Forgejo Actions for ${{ github.head_ref }}.${{ github.sha }}"
env:
FASTLY_API_TOKEN: ${{ secrets.FASTLY_API_TOKEN }}
# NOTE(neil): disable notifications for now
# - name: Notify documentation channel about deployment Success
# uses: mattermost/action-mattermost-notify@master
# if: success() && !cancelled()
# with:
# MATTERMOST_WEBHOOK_URL: ${{ secrets.MM_WEBHOOK_URL }}
# MATTERMOST_CHANNEL: web
# TEXT: |
# [join.rockylinux.org Deployment](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) was completed :white_check_mark:
# MATTERMOST_USERNAME: "Github"
#
# - name: Notify documentation channel about deployment Failure
# uses: mattermost/action-mattermost-notify@master
# if: failure() && !cancelled()
# with:
# MATTERMOST_WEBHOOK_URL: ${{ secrets.MM_WEBHOOK_URL }}
# MATTERMOST_CHANNEL: web
# TEXT: |
# [join.rockylinux.org Deployment](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) failed :x:
# MATTERMOST_USERNAME: "Github"

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.
4dz6UJp8DdPN4bB38cLY5B

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 = ["infrastructure@rockylinux.org"]
description = "Rocky Linux SIG/Security Wiki"
language = "javascript"
manifest_version = 2
name = "sig-security.rocky.page"
service_id = "kH85PxHe4Um4gq8hnVIsB4"
[scripts]
build = "npm run build"

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

File diff suppressed because it is too large Load diff

25
compute-js/package.json Normal file
View file

@ -0,0 +1,25 @@
{
"name": "sig-cloud.rocky.page",
"version": "0.1.0",
"description": "Rocky Linux SIG/Cloud Wiki",
"author": "infrastructure@rockylinux.org",
"type": "module",
"devDependencies": {
"@fastly/cli": "^10.14.0",
"@fastly/compute-js-static-publish": "6.2.0"
},
"dependencies": {
"@fastly/js-compute": "^3.0.0"
},
"engines": {
"node": ">=18.0.0"
},
"license": "UNLICENSED",
"private": true,
"scripts": {
"start": "fastly compute serve",
"deploy": "fastly compute publish",
"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;