Configured variables for Fedipage

This commit is contained in:
Jeffrey Phillips Freeman 2023-10-11 01:08:12 -04:00
parent bfbbb64bdf
commit f8c1659cdb
No known key found for this signature in database
GPG key ID: AD914585C9406B6A
14 changed files with 158 additions and 84 deletions

1
.gitignore vendored
View file

@ -17,3 +17,4 @@ node_modules/
resources/
.vercel/
auth.json
.vercel

165
README.md
View file

@ -1,62 +1,127 @@
## Generate Activity Pub key
```bash
npm install ts-node typescript '@types/node'
./node_modules/.bin/ts-node --esm generateKeys.mts
```
## Setup firebase
Setup the things
## Setup Vercel
Setup the things
## Trigger post deploy
```
curl -G -X POST --data-urlencode token="<token>" https://flear.org/send-note
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
# Notes to reconcile later
# Fresh install
* 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
## 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.
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.
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
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.
Then frrom the root of the project run the following:
```bash
vercel login
vercel link
```
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
```
We will use these keys to set the values in the next step.
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.
### 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

View file

@ -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": [

View file

@ -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" >}}

View file

@ -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).

View file

@ -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);
console.log(pair.privateKey.toString().replaceAll('\n', '\\n'));

View file

@ -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

View file

@ -10,7 +10,7 @@
<strong>Jeffrey Phillips Freeman</strong> &copy; 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>

View file

@ -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>

View file

@ -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>

View file

@ -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>

View file

@ -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>

View file

@ -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": "*",

View file

@ -37,7 +37,7 @@
"destination": "/api/activitypub/authorize_interaction.ts"
},
{
"source": "/flear",
"source": "/fedipage",
"destination": "/api/activitypub/actor.js"
},
{