arcology-fastapi/arcology.org

49 lines
4.3 KiB
Org Mode

:PROPERTIES:
:ID: arcology/readme
:ROAM_ALIASES: "Arcology README"
:END:
#+TITLE: Arcology FastAPI + Org Site Engine
#+AUTO_TANGLE: t
#+filetags: :Arcology:Development:
#+ARCOLOGY_KEY: arcology/index
#+ARCOLOGY_ALLOW_CRAWL: t
* Arcology in Brief
[[id:1d917282-ecf4-4d4c-ba49-628cbb4bb8cc][The Arcology Project]] is one of [[id:ryan_rix][my]] "forever projects" -- a system for refining and publishing the ideas in my [[id:60f710b2-6a1f-44be-bc13-dfe01e46d4e3][Concept Operating System]] or a programming project to build a small web-server for my org-mode files.
This current iteration is [[https://engine.arcology.garden][self-hosted]], implemented in a [[id:cce/python][Python]] 3 "batteries-included" webserver package called [[https://fastapi.tiangolo.com/][FastAPI]]. The database is, rather unfortunately, generated by Emacs still as there is not a good enough parser for Org Mode which can extract the required metadata, in Python or any other language. This is handled by another piece of abstraction scaffolding in my [[id:60f710b2-6a1f-44be-bc13-dfe01e46d4e3][Concept Operating System]] called [[id:arroyo/arroyo][Arroyo Systems Management]].
This version of the Arcology is the most well-defined yet, I feel like I am boiling this down to something which could be executed in most programming languages, and that is good.
* Table of Contents
- Arcology is [[id:arcology/poetry][built with Poetry]]. =poetry2nix= turns the =pyproject.toml= file in to a set of Nix derivations that can provide a dev shell and deploy to a NixOS [[id:20211120T220054.226284][Wobserver]].
- Arcology uses a databases generated with Arroyo: [[id:arcology/arroyo-page][Arroyo Arcology Generator]] containing:
- [[id:arcology/arroyo][An Arroyo Module]] which extracts metadata from my org-mode files and persists them in a SQLite database
- [[id:arcology/arroyo/sqlmodel][SQLModels]] for the metadata tables in the Arroyo database centered around the [[id:arcology/arroyo/page][Arcology Page which]] represents a single org-mode document with an Arcology publishing keyword.
- Arcology can [[id:arcology/atom-gen][Generate and Expose Atom Feeds]] for pages' date-stamped headlines
- Arcology queries the metadata and prints HTML presentations of the documents with a [[id:arcology/fastapi][FastAPI server]] and a somewhat hacky encapsulation of the [[id:arcology/routing][Routing Logic]] including Pandoc HTML generation and post-processing.
- An Arcology presents multiple [[id:20211219T144255.001827][Sites]], each with their own design language and content themes.
- Arroyo's database is encoded with s-expressions, so [[id:20210922T085933.741529][=sexpdata= python package]] is used to parse these
- [[id:20211218T222408.578567][=inotify= and a watchdog service]] will be used to wait for files to be sent to the [[id:20211120T220054.226284][Wobserver]] via [[id:cce/syncthing][Syncthing]]
* Developing the Arcology
In The Arcology, the org-mode documents which it renders is meant to be the source code. It fits in to the author's personal emacs development paradigm -> [[id:arroyo/arroyo][Arroyo Systems Management]].
Like Arroyo and [[id:cce/cce][The Complete Computing Environment]], this system is not really designed to be used by others right now. Over the next few years, I plan to make this system reproduceable, a system and documentation to bootstrap new [[id:arroyo/arroyo][Arroyo Systems]] with an Arcology running within it. Until then, [[id:20211219T184243.333209][Hey Smell This]].
The author's development environment consists of:
- A customized [[id:cce/emacs][Emacs]] distribution with the [[id:arroyo/arroyo][Arroyo Systems Management]] scripts installed
- [[id:cce/emacs_and_the_language_server_protocol][LSP]] + [[id:cce/python][=lsp-pyright=]]
- =lsp-org=
- [[id:c75d20e6-8888-4c5a-ac97-5997e2f1c711][Nix]] package management for ease of local development and of system deployment on [[id:c75d20e6-8888-4c5a-ac97-5997e2f1c711][NixOS]]
- =nix-shell= will build the dependencies and application and place =PATH= in their way
- [[id:45fc2a02-fcd0-40c6-a29e-897c0ee7b1c7][direnv]] can load this environment in to the editor
* Running the Arcology
- direnv or nix-shell
- Run the [[id:20211218T222408.578567][Arcology Automated Database Builder]]: [[shell:python -m arcology.inotify &]]
- Run the [[id:arcology/fastapi][Arcology FastAPI]] webserver: [[shell:uvicorn arcology.server:app --reload &]]