diff --git a/.gitignore b/.gitignore index 20197b7b96832f4acae4700e60600e737a8c9629..62601940c8c478df7813d1d153a28d874c37bddf 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,4 @@ node_modules/ resources/ .vercel/ auth.json +.vercel diff --git a/README.md b/README.md index 27294dcf0d29471119b20baf20e14c392cb102e4..c735274e74a652497ea9cc224e339e809966e4d0 100644 --- a/README.md +++ b/README.md @@ -1,62 +1,127 @@ -## Generate Activity Pub key +## Trigger post deploy -```bash -npm install ts-node typescript '@types/node' -./node_modules/.bin/ts-node --esm generateKeys.mts ``` +curl -G -X POST --data-urlencode token="<token>" https://<your domain>/send-note +``` + +# License + +This project (excluding post content itself) is released under the Apache License v2 + +# Fresh install + +## Update /hugo.toml +This is the main configuration file. All of the setting in this file need to be +set. There are other settings, the defaults, set in /config/hugo.toml, there is +no need to touch this file, only the settings int he configuration at the root. -## Setup firebase +For some of the values in this file you can leave the defaults, but for most +the values will need to be updated to match your site. -Setup the things +The file is commented to help understand the various variables. + +## Setup Firebase + +First go to Firebase and sign up for an account here: +https://console.firebase.google.com/ + +Then go to create new project, select a unique project name, follow the prompts +and it will generate a project space for you. The only service you care about +though is Firebase so from the dashboard select Firebase and then click the +"create database" button. When prompted make sure you choose production server +and not test. Withing a few minutes you should have a Firebase instance ready. + +Next all that is left is to get your API access info which we will use later. + +To start go to your `project settings` and under the `General` tab you should +see a field labeled `Project ID`. Save this for later. + +Next go to the `Service Accounts` tab and select `Generate new private key`. +This will download a json file containing your keys. In the json open it up and +find the value of the `private_key` field, and the `client_email` field These +will be used later. + +Firebase should now be ready to go! You can come back here to see the DB +populate once the app starts running. ## Setup Vercel -Setup the things +First go to the vercel website and create a team to use when deploying if you'd +like. This will be used in the next step during linking, be sure to use this +team. -## Trigger post deploy +Then frrom the root of the project run the following: +```bash +vercel login +vercel link ``` -curl -G -X POST --data-urlencode token="<token>" https://flear.org/send-note + +When asked to "link to existing project" select no since this is your first time +deploying. + +This will then build and upload your project. It may take a few minutes. You may +see the following error in the ened `Error: Failed to detect project settings. +Please try again`. If you see it but there are no other errors then it probably +worked. Check your dashboard at vercel.com and you should see an empty project +was created. + +### Populate Vercel Env Variables + +Next go to your Vercel dashboard then navigate to to your new project. In the +settings tab there should be an `Environment Variables` section. Here is where +we will populate those. + +First generate your public and private keys used for ActivityPub. It is important you dont loose these as they identify your site. So save them. + +```bash +npm install ts-node typescript '@types/node' +./node_modules/.bin/ts-node --esm generateKeys.mts ``` -# License +We will use these keys to set the values in the next step. -This project (excluding post content itself) is released under the Apache License v2 +Now lets set the environment values to be used in vercel (this mostly only effect the stuff under /api). + +* POLL_MILLISECONDS: Set to 250000 or higher. This sets the minimum wait time between calls to the send-note endpoint. You may wish to adjust the cronjob in vercel.json as well. +* ACTIVITYPUB_PRIVATE_KEY: Get this value from generating the keys in the previous step. +* ACTIVITYPUB_PUBLIC_KEY: Get this value from generating the keys in the previous step. +* FIREBASE_PRIVATE_KEY: The value from earlier when setting up Firebase contained in the json. This is **not** the same as the ACTIVITYPUB_PRIVATE_KEY we generated a moment ago. +* FIREBASE_CLIENT_EMAIL: The value from earlier when setting up Firebase contained in the json +* NEXT_PUBLIC_FIREBASE_PROJECT_ID: The value shown in Firebase from the easlier step. +* ACTIVITYPUB_URL: This should be the same as the BaseURL setting for your sight. For example `https://fedipage.com/`. The trailing slash is very important dont forget it. +* ACTIVITYPUB_USER: The username of the ActivityPub user. This can have any capitalization you want and will be made lower when needed. +* ACTIVITYPUB_ALIAS: Optional if you dont want to set it. This should be a url to a fediverse account you want to designate as an alias. For example `https://qoto.org/@fedipage` +* ACTIVITYPUB_NAME: The full display name of the ActivityPub user. It can contain spacing and punctuation. +* ACTIVITYPUB_SUMMARY: The ActivityPub summary for the user. It appears right under their handle usually + +Finally open the `/vercel.json` file and find the line that has `/fedipage` on it and change that to the name of your user ActivityPub username (apUser), but in all lowercase. -# Notes to reconcile later - -* Set configuration in /hugo.toml (defaults are in /config/* dont touch) -* Set Gitlab CI ENV variables: -** VERCEL_ORG_ID -** VERCEL_PROJECT_ID -** VERCEL_TOKEN (mask this and make it availible to only protected) -** VERCEL_SCOPE (set to vercel team id, find with `vercel team ls` after creating) -* Set vercel environment variables (vercel.com > project > Settings > Environment Variables) (set on production only usually) -** POLL_MILLISECONDS (set to 250000 or higher) -** ACTIVITYPUB_PRIVATE_KEY (get this value from generating the keys in the pervious step) -** ACTIVITYPUB_PUBLIC_KEY (get this value from generating the keys in the pervious step) -** FIREBASE_PRIVATE_KEY -** FIREBASE_CLIENT_EMAIL -** NEXT_PUBLIC_FIREBASE_PROJECT_ID -** ACTIVITYPUB_URL -** ACTIVITYPUB_USER -** ACTIVITYPUB_ALIAS (optional) -** ACTIVITYPUB_NAME -** ACTIVITYPUB_SUMMARY +### Configure domains + +In the project settings go to the Domains section. Here you can add custom domains and it shows you how to configure them. These steps shouldnt effect the source code. + +## Setup Gitlab CI + +First look at the content of the `/.vercel/project.json` file, this was created earlier from the `vercel link` command. This contains the org id and project id values. We will set these in GitLab's CI. + +Go to your GitLab project and find the settings on CI/CD and under there you will find variables. Here we will add a few relevant variables. + +* VERCEL_ORG_ID: Get this from `/.vercel/project.json` under orgId +* VERCEL_PROJECT_ID: Get this from `/.vercel/project.json` under projectId +* VERCEL_TOKEN: This can be generated under your vercel's account settings under the token submenu. Mask this and make it availible to only protected. +* VERCEL_SCOPE: Set to vercel team id you want to use, find with `vercel team ls` after the team is created, or if it already exists. + +## Customize your content + +* Delete the existing content +* Change the /content/_index.md to suite your needs * Modify /layouts/partials/top_list_* to represent the section titles you want to use. -* Update package.json -** Update name field -** update description field -* Update manifest.json -** name -** short_name -** description -* Update robots.txt to point to the full URL of this site -* Modify vercel.json -** Find the line where source is set to "/flear" and update it to point to your apUser name (all lowercase even if variable has case). -* Go through the /api and manually change references (this step will either be explained later or not needed soon, just a reminder placeholder) - -The above steps might be reduced by using template processing on otherwise unprocessed files (normally not part of hugo). See the following for more info https://vercel.com/docs/functions/serverless-functions/runtimes/node-js -NOTE: Once we move the project over to a dedicated git, change the node info under api and track the version -NOTE: And the source link in the footer -NOTE: And package.json + +## Final steps + +All that is left now is to push your code to your GitLab repo. At that point the .gitlab-ci.yaml file should automatically do the rest. After a few minutes you should have a running static site with full ActivityPub support. Enjoy. + +# Development notes + +Here is some information about how to do some processing on the serverless functions in the /api folder: https://vercel.com/docs/functions/serverless-functions/runtimes/node-js diff --git a/api/nodeinfo/2.1.ts b/api/nodeinfo/2.1.ts index d1e14bb9910f5b492280a6f229c578fc9c633b0f..86d1cfdefbcaeb3bf65d5e4981feb11da32489a8 100644 --- a/api/nodeinfo/2.1.ts +++ b/api/nodeinfo/2.1.ts @@ -6,9 +6,9 @@ export default function (req: VercelRequest, res: VercelResponse) { res.json({ "version": "2.1", "software": { - "name": "flear.org", - "repository": "https://git.qoto.org/flear/flear-site", - "homepage": "https://flear.org/", + "name": "Fedipage", + "repository": "https://git.qoto.org/fedipage/fedipage", + "homepage": "https://fedipage.com/", "version": "0.0.1" }, "protocols": [ diff --git a/content/_index.md b/content/_index.md index 59d2d84743b046e36934fa4146ab9bef6f76f0ad..80c9eb16c481e7e0795503304bf11a09346b3eb9 100644 --- a/content/_index.md +++ b/content/_index.md @@ -4,7 +4,7 @@ title: Welcome draft: false --- -{{< titled-side "FLEAR" "Free and Libre Engineers for Amateur Radio" "Learn More" "/about" "Follow our GitLab →" "https://git.qoto.org/flear" >}} +{{< titled-side "Fedipage" "Hugo based static page genedator and blog with ActivityPub support" "Learn More" "/about" "Follow our GitLab →" "https://git.qoto.org/fedipage/fedipage" >}} {{< example "This is the title for the example" >}} {{< highlight bash >}} console.log("hello tabs"); @@ -86,9 +86,9 @@ draft: false {{< / card-row >}} {{< card-row >}} {{<card "APEX" "https://git.qoto.org/digipex/apex" "@digipex/apex" "1" "*" >}} - An APRS and APXP implementation in Pythong + An APRS and APXP implementation in Python {{< / card >}} {{< / card-row >}} {{< / cards >}} -{{< info-buttons "Learn More" "/about" "Follow our GitLab →" "https://git.qoto.org/flear" >}} +{{< info-buttons "Learn More" "/about" "Follow our GitLab →" "https://git.qoto.org/fedipage/fedipage" >}} diff --git a/content/resource/qoto.md b/content/resource/qoto.md index d05412ee88c06f0e89048ccd3e2729d9f1426d88..680161aeecd433b9daa7cb483a120a28d4a94851 100644 --- a/content/resource/qoto.md +++ b/content/resource/qoto.md @@ -1,5 +1,5 @@ --- -title: QOTO Incubator Available for FLEAR +title: QOTO Incubator Available for Fedipage date: '2023-10-07T23:27:52+00:00' slug: qoto-incubator-available type: resource @@ -10,7 +10,4 @@ For the time being we will use [https://qoto.org](https://qoto.org) to provide generic resources such as git, web hosting, and other services. They are an open-source community servicing the entire STEM community. -As we slowly ramp up we may begin to move services over to our own domain and -servers. Stay tuned. - See more about [QOTO here](../entry/qoto). diff --git a/generateKeys.mts b/generateKeys.mts index 21fd62e6e52b3b06625b6b324acbd1d9105ad0e2..6e47d2db674372e56c7103d8115b0e2a6fef512b 100644 --- a/generateKeys.mts +++ b/generateKeys.mts @@ -15,6 +15,6 @@ const pair = await generateKeyPairAsync('rsa', { } }) -console.log(pair.publicKey); +console.log(pair.publicKey.toString().replaceAll('\n', '\\n')); -console.log(pair.privateKey); \ No newline at end of file +console.log(pair.privateKey.toString().replaceAll('\n', '\\n')); diff --git a/hugo.toml b/hugo.toml index ff0832a71938f96dfd00bce68a635396032b69d8..89365ab23186e749831a2a89700a2b08d0d97663 100644 --- a/hugo.toml +++ b/hugo.toml @@ -1,6 +1,6 @@ -baseurl = "https://flear.org/" +baseurl = "https://fedipage.com/" languageCode = "en-us" -title = "Free and Libre Engineers for Amateur Radio" +title = "Hugo based static page genedator and blog with ActivityPub support" paginate = 20 pygmentsCodeFences = true @@ -11,23 +11,34 @@ defaultContentLanguageInSubdir = false # Author displayed on posts, the current template doesnt actually render this [author] -name = "FLEAR" -email = "flear@flear.org" +name = "Fedipage" +email = "fedipage@fedipage.com" # Custom site variables used when rendering the template [params] -siteName="FLEAR" -siteTagLine="Free & Libre Engineers for Amateur Radio" +siteName="Fedipage" +siteTagLine="An ActivityPub supporting static page generator." # Do not include the @ -twitterUser="FLEAR_radio" -siteDescription="FLEAR is an open-source and open-standards incubator for Ham Radio" -# this is the user name of the ActivityPub account. It will be the first part of your handle as @apUSer@domain -apUser="FLEAR" +twitterUser="fedipage" +siteDescription="Fedipage is a Hugo based static page genedator and blog with ActivityPub support" +# this is the user name of the ActivityPub account. It will be the first part of +# your handle as @apUser@domain. Please use whatever capitalization styling you +# want. It will be changed to lowercase for your handle itself. Only include +# letters. +apUser="Fedipage" +# This is where you run an alternative mastodon based account. This will be +# setup to be an alias for this account. secondaryApHost="https://qoto.org" +# This shouldnt include the @ secondaryApUser="FLEAR" -repoUrl="https://git.qoto.org/flear" -siteRepoUrl="https://git.qoto.org/flear/flear-site" -siteEmail="flear@flear.org" -postHashtags=["HamRadio", "AmateurRadio", "Ham", "RF", "ElectricalEngineering", "EE"] +# The repo use for the repo url button in the navigation menu and other places. +# This can be any git repor that contains your project code, not the code for +# this website usually but it can be. +repoUrl="https://git.qoto.org/fedipage/fedipage" +# The url to where the source code for this website will be. +siteRepoUrl="https://git.qoto.org/fedipage/fedipage" +# The email of the site's webmaster or whoever will receive comms +siteEmail="the@jeffreyfreeman.me" +postHashtags=["Fediverse", "ActivityPub", "MastoAdmin"] renderDefaultHashtags=true renderArticleHashtags=true diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html index 2e90c2c28e38333f61240b1adc220afffc56015d..fe92e7bb50c509d727083f5ab79f7fd0efcb739e 100644 --- a/layouts/partials/footer.html +++ b/layouts/partials/footer.html @@ -10,7 +10,7 @@ <strong>Jeffrey Phillips Freeman</strong> © 2023 to present </p> <p> - <a href='https://git.qoto.org/flear/flear-site'>Get source</a> by <a href='https://jeffreyfreeman.me'>Jeffrey Phillips Freeman</a> + <a href='https://git.qoto.org/fedipage/fedipage'>Get the source</a> by <a href='https://jeffreyfreeman.me'>Jeffrey Phillips Freeman</a> </p> </div> </div> diff --git a/layouts/partials/top_list_generic.html b/layouts/partials/top_list_generic.html index 33a648257eee3afa2ae47fe58fb498fa6a3defb2..104f07c8430951313bbae1f1fc423eb8e1da355e 100644 --- a/layouts/partials/top_list_generic.html +++ b/layouts/partials/top_list_generic.html @@ -5,7 +5,7 @@ <div class="main-wrapper"> <header class='subheader'> <div class='container'> - <h2 class='page-title'> FLEAR <small>Free & Libre Engineers for Amateur Radio</small> + <h2 class='page-title'> Fedipage <small>Hugo based static page genedator and blog with ActivityPub suppor</small> </h2> </div> </header> diff --git a/layouts/partials/top_list_news.html b/layouts/partials/top_list_news.html index c0efd7a81047e5b385f4479655ec2516ca3f86da..ead589c0065423d9c44d3aeece732079507241a0 100644 --- a/layouts/partials/top_list_news.html +++ b/layouts/partials/top_list_news.html @@ -5,7 +5,7 @@ <div class="main-wrapper"> <header class='subheader'> <div class='container'> - <h2 class='page-title'> News <small>For current events in FLEAR and its projects. You can follow this page on the fediverse at @flear@flear.org.</small> + <h2 class='page-title'> News <small>For current events related to Fedipage. You can follow this page on the fediverse at @fedipage@fedipage.com.</small> </h2> </div> </header> diff --git a/layouts/partials/top_list_projects.html b/layouts/partials/top_list_projects.html index 61c1b594e4ac81058d79e3a73eda0c49b2789212..298731e9bb0129ae84f92d956cfd072d6b9d8824 100644 --- a/layouts/partials/top_list_projects.html +++ b/layouts/partials/top_list_projects.html @@ -5,7 +5,7 @@ <div class="main-wrapper"> <header class='subheader'> <div class='container'> - <h2 class='page-title'> Projects <small>Open source projects past of our incubator for Ham Radio.</small> + <h2 class='page-title'> Projects <small>Open source projects related to the fedipage project.</small> </h2> </div> </header> diff --git a/layouts/partials/top_list_resource.html b/layouts/partials/top_list_resource.html index 2da29c6393c103abdfe067402795b489d883e85e..336fd1c8e13a1500120cad1e88d93a88c455940a 100644 --- a/layouts/partials/top_list_resource.html +++ b/layouts/partials/top_list_resource.html @@ -5,7 +5,7 @@ <div class="main-wrapper"> <header class='subheader'> <div class='container'> - <h2 class='page-title'> Resources <small>services, assistance, information, and other resources to assist the FLOSS Ham community.</small> + <h2 class='page-title'> Resources <small>services, assistance, information, and other resources to assist in contributing to the Fedipage project.</small> </h2> </div> </header> diff --git a/package.json b/package.json index b968170cae20df3037ee4e91708a9bf3987f6f5b..f0d13c709f845d57fbce4c49cd20c68071e43ada 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { - "name": "flear.org", - "description": "FLEAR (Free and Libre Engineers for Amateur Radio)", + "name": "fedipage", + "description": "Hugo based static page genedator and blog with ActivityPub support", "dependencies": { "@firebase/app-types": "^0.9.0", "@polymath-ai/client": "*", diff --git a/vercel.json b/vercel.json index 3b3fe208a69f4a2028d482b04ba808887291760e..231d0635469d5ad63bdd406ef82e7991d42171c6 100644 --- a/vercel.json +++ b/vercel.json @@ -37,7 +37,7 @@ "destination": "/api/activitypub/authorize_interaction.ts" }, { - "source": "/flear", + "source": "/fedipage", "destination": "/api/activitypub/actor.js" }, {