feat: docker and nomad config

This commit is contained in:
2026-04-03 14:46:27 +02:00
parent 576af715bd
commit f082a30b7f
7 changed files with 271 additions and 38 deletions

View File

@@ -12,6 +12,48 @@ router = APIRouter()
PAGES_DIR = Path(os.environ.get("PAGES_DIR", "/data/pages"))
SOURCES_DIR = Path(os.environ.get("SOURCES_DIR", "/data/sources"))
DEFAULT_INDEX_SOURCE = '''\
page "Welcome" 60
bigtitle "uFrame" thin
box rounded "Micronomicon"
align center
text "Decentralized Page Server"
text "Powered by @bold{Reticulum} and @bold{NomadNet}"
spacer
heading 2 "Pages"
text "This node is serving pages built with the uFrame DSL."
text "Use the web IDE to create and publish new pages."
spacer
divider light
label "Node" "Micronomicon"
label "Engine" "uFrame v1"
status "Node" online
'''
def ensure_default_pages():
"""Create a default index page if none exists."""
PAGES_DIR.mkdir(parents=True, exist_ok=True)
SOURCES_DIR.mkdir(parents=True, exist_ok=True)
index_mu = PAGES_DIR / "index.mu"
index_src = SOURCES_DIR / "index.uf"
if not index_mu.is_file():
# Compile and publish the default index
result = uframe.compile(DEFAULT_INDEX_SOURCE)
index_mu.write_text(result.micron, encoding="utf-8")
index_mu.chmod(0o644)
if not index_src.is_file():
index_src.write_text(DEFAULT_INDEX_SOURCE, encoding="utf-8")
class PageMeta(BaseModel):
name: str