gno icon indicating copy to clipboard operation
gno copied to clipboard

Serve homepage from local .md using --alias=/ and dynamic sync from r/gnoland/home

Open moul opened this issue 7 months ago • 2 comments

Note: I remember writing about a similar issue, but I can't find it anymore. If anyone finds it, please feel free to share the link.

Use --alias=/=./home.md (feature by @aeddi) for the homepage, synced from r/gnoland/home. This avoids bricked contracts, supports overrides, and makes updates safer.

Plan

  1. write this script
# misc/deployments/update-home.sh

# if this file exists, it means we want to bypass the script behavior and just manage the homepage manually.
if [ -f home-override.md ]; then
  cp home-override.md home.md
  exit 0
fi

# tries to query r/gnoland/home.
if gnokey query ... > out.md; then
  # eventually patch the page to add things like the newsletter html form
  echo "<!-- extra blocks -->" >> out.md
  mv out.md home.md
else
  echo "warn: failed to update"
fi
  1. configure docker-compose/kube to periodically run this script

  2. configure docker-compose/kube to use the --alias=/:./home.md

moul avatar Jun 16 '25 16:06 moul

Refers to https://github.com/gnolang/gno/pull/4252

sw360cab avatar Jun 25 '25 14:06 sw360cab

@moul

  • where are home.md or home-override.md supposed to be located?
    • Are they provided externally from the binary or included in the binary itself (like examples/ folder)
  • how are the things to be patched defined, is it another text file?

sw360cab avatar Jun 25 '25 14:06 sw360cab

  • script is to be published on the monorepo
  • home.md is to be generated by the script on the server
  • home.override.md to be manually added on the server

moul avatar Jun 30 '25 18:06 moul

  • script is to be published on the monorepo

    • home.md is to be generated by the script on the server

    • home.override.md to be manually added on the server

I have one last doubt. Can we bundle echo "<!-- extra blocks --> into another file that is eventually present in the FS (as it may be for home-override.md).

Or in order to add this, we should each time push an edit to the script itself?

sw360cab avatar Jul 04 '25 11:07 sw360cab

We should focus on a script on the monorepo. This script may (or not) look for files on the FS.

moul avatar Jul 06 '25 18:07 moul

@moul

I am currently having this scripting issue. If we want to add extra blocks, using this

# tries to query r/gnoland/home.
if gnokey query ... > out.md; then

will it work if gnoweb is running with --aliases=/=static:<path to home.md> already (forget home-override for now)?

Because gnokey would query the RPC directly and skip the aliased home. So extra block will be applied to the original home rather than the aliased_home. Is that the behavior we want?

sw360cab avatar Aug 14 '25 09:08 sw360cab

It should be fine because the alias is for /, and the query targets /r/gnoland/home. Even if the alias for / is set up, /r/gnoland/home should not be replaced by the static file.

moul avatar Aug 20 '25 08:08 moul

It should be fine because the alias is for /, and the query targets /r/gnoland/home. Even if the alias for / is set up, /r/gnoland/home should not be replaced by the static file.

I think I understand correctly then

sw360cab avatar Aug 20 '25 19:08 sw360cab