Skip to content

Commit

Permalink
feat: init
Browse files Browse the repository at this point in the history
  • Loading branch information
neurosnap committed Jan 9, 2024
0 parents commit 82f9799
Show file tree
Hide file tree
Showing 34 changed files with 3,148 additions and 0 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: release
on:
push:
branches:
- main
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set outputs
id: vars
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- uses: actions/setup-go@v4
with:
go-version: '1.21'
- name: build docs site
run: make ssg
- name: publish to pgs
uses: picosh/pgs-action@v3
with:
user: hey
key: ${{ secrets.PRIVATE_KEY }}
src: './public/'
project: "docs-${{ steps.vars.outputs.sha_short }}"
promote: "docs-prod"
retain: "docs-"
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
public/*
!public/.gitkeep
*.swp
*.log
.DS_Store
13 changes: 13 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
clean:
rm -rf ./public/*
echo "" > ./public/.gitkeep
.PHONY: clean

ssg:
go run ./main.go
cp ./static/* ./public
.PHONY: ssg

dev: ssg
rsync -vr ./public/ [email protected]:/docs-local
.PHONY: dev
15 changes: 15 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
module github.com/picosh/docs

go 1.21.5

require github.com/picosh/pdocs v0.0.0-20240108145604-582bbd2bcc23

require (
github.com/alecthomas/chroma v0.10.0 // indirect
github.com/dlclark/regexp2 v1.4.0 // indirect
github.com/yuin/goldmark v1.6.0 // indirect
github.com/yuin/goldmark-highlighting v0.0.0-20220208100518-594be1970594 // indirect
github.com/yuin/goldmark-meta v1.1.0 // indirect
go.abhg.dev/goldmark/anchor v0.1.1 // indirect
gopkg.in/yaml.v2 v2.3.0 // indirect
)
31 changes: 31 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
github.com/alecthomas/chroma v0.10.0 h1:7XDcGkCQopCNKjZHfYrNLraA+M7e0fMiJ/Mfikbfjek=
github.com/alecthomas/chroma v0.10.0/go.mod h1:jtJATyUxlIORhUOFNA9NZDWGAQ8wpxQQqNSB4rjA/1s=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dlclark/regexp2 v1.4.0 h1:F1rxgk7p4uKjwIQxBs9oAXe5CqrXlCduYEJvrF4u93E=
github.com/dlclark/regexp2 v1.4.0/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc=
github.com/picosh/pdocs v0.0.0-20240108145604-582bbd2bcc23 h1:gnUGSuxipJYPRyJlvgKOxWEgKDPkCWvF5b9duXJTxBM=
github.com/picosh/pdocs v0.0.0-20240108145604-582bbd2bcc23/go.mod h1:rh8n5EosoD8svAbVPUEuXWfcWBsGj3GPeG/8D/0Az3c=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk=
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/yuin/goldmark v1.4.5/go.mod h1:rmuwmfZ0+bvzB24eSC//bk1R1Zp3hM0OXYv/G2LIilg=
github.com/yuin/goldmark v1.6.0 h1:boZcn2GTjpsynOsC0iJHnBWa4Bi0qzfJjthwauItG68=
github.com/yuin/goldmark v1.6.0/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
github.com/yuin/goldmark-highlighting v0.0.0-20220208100518-594be1970594 h1:yHfZyN55+5dp1wG7wDKv8HQ044moxkyGq12KFFMFDxg=
github.com/yuin/goldmark-highlighting v0.0.0-20220208100518-594be1970594/go.mod h1:U9ihbh+1ZN7fR5Se3daSPoz1CGF9IYtSvWwVQtnzGHU=
github.com/yuin/goldmark-meta v1.1.0 h1:pWw+JLHGZe8Rk0EGsMVssiNb/AaPMHfSRszZeUeiOUc=
github.com/yuin/goldmark-meta v1.1.0/go.mod h1:U4spWENafuA7Zyg+Lj5RqK/MF+ovMYtBvXi1lBb2VP0=
go.abhg.dev/goldmark/anchor v0.1.1 h1:NUH3hAzhfeymRqZKOkSoFReZlEAmfXBZlbXEzpD2Qgc=
go.abhg.dev/goldmark/anchor v0.1.1/go.mod h1:zYKiaHXTdugwVJRZqInVdmNGQRM3ZRJ6AGBC7xP7its=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU=
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
108 changes: 108 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
package main

import (
"github.com/picosh/pdocs"
)

func main() {
pager := pdocs.Pager("./posts")
sitemap := []*pdocs.Sitemap{
{
Text: "Marketing",
Href: "/",
Page: pager("marketing.md"),
},
{
Text: "Getting Started",
Href: "/getting-started",
Page: pager("getting-started.md"),
},
{
Text: "How it Works",
Href: "/how-it-works",
Page: pager("how-it-works.md"),
},
{
Text: "File Uploads",
Href: "/file-uploads",
Page: pager("file-uploads.md"),
},
{
Text: "Custom Domains",
Href: "/custom-domains",
Page: pager("custom-domains.md"),
},
{
Text: "Pages",
Href: "/pgs",
Page: pager("pgs.md"),
},
{
Text: "Prose",
Href: "/prose",
Page: pager("prose.md"),
},
{
Text: "Pastes",
Href: "/pastes",
Page: pager("pastes.md"),
},
{
Text: "Images",
Href: "/imgs",
Page: pager("imgs.md"),
},
{
Text: "Feeds",
Href: "/feeds",
Page: pager("feeds.md"),
},
{
Text: "Lists",
Href: "/lists",
Page: pager("lists.md"),
},
{
Text: "Tunnels",
Href: "/tuns",
Page: pager("tuns.md"),
},
{
Text: "Community",
Href: "/comms",
Page: pager("comms.md"),
},
{
Text: "FAQ",
Href: "/faq",
Page: pager("faq.md"),
},
{
Text: "Plain Text Lists",
Href: "/plain-text-lists",
Page: pager("plain-text-lists.md"),
},
{
Text: "Operations",
Href: "/ops",
Page: pager("ops.md"),
},
{
Text: "Privacy Policy",
Href: "/privacy",
Page: pager("privacy.md"),
},
}

config := &pdocs.DocConfig{
Sitemap: sitemap,
Out: "./public",
Tmpl: "./tmpl",
PageTmpl: "post.page.tmpl",
}

err := config.GenSite()
if err != nil {
panic(err)
}
}
53 changes: 53 additions & 0 deletions posts/comms.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
---
title: Community
description: How we interact with our users
keywords: [pico, irc, bouncer]
---

All of our realtime communication happens through IRC at #pico.sh @ libera.chat.

We are also excited to announce that we have a hosted IRC bouncer and web client
that all pico users can use.

- [soju man page](https://soju.im/doc/soju.1.html)
- [bouncer: ircs://irc.pico.sh:6697](ircs://irc.pico.sh:6697)
- [web client: chat.pico.sh](https://chat.pico.sh)

## Generate a login token for bouncer

![pico-token-menu](https://hey.imgs.sh/pico-token-menu.png)

- SSH into a pico service CMS (e.g. `ssh prose.sh`)
- Select "tokens" submenu
- Type "n" to generate a new token
- Save token someplace safe

## Log into [chat.pico.sh](https://chat.pico.sh)

- You'll be redirected to [auth.pico.sh](https://auth.pico.sh) which implements
a fake oauth2 service
- Enter the token from above
- Click submit

## Back to [chat.pico.sh](https://chat.pico.sh)

![irc-remember-me](https://hey.imgs.sh/irc-remember-me/x500)

- Click "remember me" (this is important)
- You'll see an error "Cannot interact with channels and users on the bouncer
connection. Did you mean to use a specific network?" that's okay
- Message `BouncerServ` (`/msg BouncerServ help`) to configure the bouncer

## Connecting to `irc.libera.chat/#pico.sh`

- `/msg BouncerServ help`
- `network create -addr irc.libera.chat -name libera -nick <user> -enabled false`
- `sasl set-plain -network libera <user> <pass>`
- `network update libera -enabled true`
- `/j #pico.sh`
- Join any other channels or networks using the same method!

# Acknowledgments

- [soju (bouncer)](https://git.sr.ht/~emersion/soju)
- [gamja (web client)](https://git.sr.ht/~emersion/gamja)
96 changes: 96 additions & 0 deletions posts/custom-domains.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
---
title: Custom Domains
description: A guide to setting up your domain to point to pico services
keywords: [pico, custom, domain]
---

All of our services support custom domains and they all work the exact same way.
The way it works is you provide a `CNAME` record and a corresponding `TXT`
record. Then when any of our web services receives traffic from that domain, we
check the `TXT` record to figure out what content to serve the user.

HTTPS will be automatically enabled and a certificate will be retrieved from
Let's Encrypt. In order for this to work, 2 DNS records need to be created:

`CNAME` for the domain to the pico service (subdomains or DNS hosting with CNAME
flattening) or `A` record.

## For prose.sh

```
CNAME subdomain.yourcustomdomain.com -> prose.sh
```

Resulting in:

```
subdomain.yourcustomdomain.com. 300 IN CNAME prose.sh.
```

And a `TXT` record to tell Prose what blog is hosted on that domain at the
subdomain entry `_prose`

```
TXT _prose.subdomain.yourcustomdomain.com -> yourproseusername
```

Resulting in:

```
_prose.subdomain.yourcustomdomain.com. 300 IN TXT "hey"
```

Depending on your DNS, this could take some time to fully switch over. We have
an endpoint to check whether or not custom domains are setup:

```
curl -vvvv https://prose.sh/check?domain=xxx
```

## For pgs.sh

[pgs.sh](https://pgs.sh) is a little different in that we allow the user to
configure custom domains per project so it's a little different.

And a `TXT` record to tell pgs what project is hosted on that domain at the
subdomain entry `_pgs`.

```
subdomain.yourcustomdomain.com. 300 IN CNAME pgs.sh.
_pgs.subdomain.yourcustomdomain.com. 300 IN TXT
"{user}-{project}"
```

### Example: top-level domain

- Custom domain `erock.io`
- User `erock`
- Project `kittens`

Resulting in:

```
erock.io. 300 IN CNAME pgs.sh.
_pgs.erock.io. 300 IN TXT "erock-kittens"
```

### Example: subdomain

- Custom domain `meow.erock.io`
- User `erock`
- Project `kittens`

Resulting in:

```
meow.erock.io. 300 IN CNAME pgs.sh.
_pgs.meow.erock.io. 300 IN TXT "erock-kittens"
```

## My DNS does **not** support CNAME flattening

In that case, you need to get the IP address of the service you want to point to
and then use that as an `A` record.

> WARNING: We make no gaurentees that our IP addresses will stay the same. Use
> at your own risk!
Loading

0 comments on commit 82f9799

Please sign in to comment.