Try it
A site on your own machine in a few minutes: a folder of YAML, one command, a browser. Nothing else to run: no database, no broker, no sign-in server.
1. Get portal
Download the newest portal-v1.…tar.gz from the
releases: 1.0.0 or
later. A 0.x release has none of what this page uses.
Unpack it into a folder of its own:
mkdir portal && tar xzf portal-v1.*.tar.gz -C portal && cd portal
It holds portal, iris (the lint), bratac and learn, the
site/ folder portal serves its pages’ scripts and styles from, and
a whole example site (examples/).
Or build it from this repo: cargo leptos build --release gives
target/release/portal and target/site.
2. Write a site
A folder with a page, a thank-you, and what becomes of what people
send, is a site. Make it beside the portal folder:
my-site/
site.yaml
aggregates.yaml
questions/
index.yaml
thanks.yaml
# my-site/site.yaml
title: The allotment
# my-site/questions/index.yaml
name: What brings you here?
alternatives:
- name: Ask for a plot
description: We have twelve; say what you would grow.
record_as: requests
action: /thanks
features:
- name: About you
requirements:
- { name: name, label: Your name }
- { name: email, label: Your email, type: email }
- { name: crops, label: What you would grow, type: textarea }
# my-site/questions/thanks.yaml: where a visitor lands after sending
name: Thank you
followup: true
description: The board reads every request and writes back within a week.
# my-site/aggregates.yaml: the requests, and who answers them
aggregates:
- bucket: requests
initial: new
attended_by: the board
states:
new: { event: received, text: New }
Check it the way a site’s CI does:
./iris check --path ../my-site/questions
The lint says what is wrong in plain words, or that it is ready.
3. Run it
From the unpacked release:
CONTENT_DIR=../my-site PORTAL_STORE=../my-site.redb ./portal
Open http://127.0.0.1:3010 (LEPTOS_SITE_ADDR moves it). Every
request sent is a record in my-site.redb, with its history; restart,
and it is all still there.
Change a page and restart to see it.
Or start from a whole site
examples/machine-hire in the release (docs/examples in the repo) is
a machine hire: a front door, machines narrowed to the days a visitor
asks for, a booking that holds its machine, a confirmation mail with a
calendar entry, and a counter desk with a calendar of who has which
machine when. Bring its machines in, then run
it:
E=examples/machine-hire
PORTAL_STORE=hire.redb ./portal import --path $E/questions $E/import/machines.yaml
CONTENT_DIR=$E PORTAL_STORE=hire.redb ./portal
Book a machine, then try to book it again over the same days.
The hires land on the counter’s desk, /counter, which is for the
counter group. There is no sign-in to run here, so give yourself a
session in that group:
-
Stop the site.
-
Run:
PORTAL_STORE=hire.redb ./portal session --as Kari --groups counter -
Start the site again, and paste the line step 2 printed into the browser’s console on the site.
This is for trying a site out: where a sign-in provider is set,
portal session refuses, and people sign in.
Where next
- Give the requests somewhere to go: a desk for the people who answer them, and the stages a request goes through (State machines).
- Let people sign in: Kanidm or any OpenID provider, and the groups that decide who sees what (Bringing your people in).
- Mail, payments, search, chat: the programs beside a site (Operations).
- Put it online: a content repo, a release pinned in its CI, and a host (Operations).
- Every key a page may use: Content reference.