Webpage anatomy

This webpage uses only core Janet libraries, e.g. spork, and libraries from this project.

You can find the source code in Source Hut repo.

Structure

Content

The content source documents are using the Mendoza .mdz format stored in the content/ directory of the project root. The layout is in the Temple format stored in the templates/ directory of the project root. Static assets you can find in the static/ directory of the project root.

Shawn

The main driver of the application is Shawn. Its envelope contains the configuration of the environments and its acts are the whole app's driving force. The concern separates the acts :

  • acts.janet with the high-level acts for environment initialization, monitoring and these used by the webserver.
  • acts/shared with the helper acts used by other acts.
  • acts/static with acts to deal with the static assets
  • acts/content with acts dealing with content sources
  • acts/blog with acts dealing with the blog sources
  • acts/pkgs with acts dealing with the packages information
  • acts/web with act running web server.

Webserver

Another part of the application is the Chidi, serving rendered HTML and static assets when run in the dev mode. It runs as a cocoon. Webserver definition is in the app/init . It serves the /__dashboard and facilities for editing and rendering content and updating the packages from the web interface. It also server the static content for development purposes.

Websockets

The last part (for now at least) is the freshly minted Trevor providing the websockets for the development server. For now, it means only alerting about the packages cloned and rendered and dynamic refresh of the packages list, but the plan is to become the primary means of communication in development.

Running

The application is run by the gp bin script in the root of the project. The script takes one argument with the environment:

  • dev gets all packages, renders all content, copies the static files, and starts the development HTTP server. Development is the default environment.
  • prod gets all packages, renders all content, copies the static files and finishes
  • rel connects to the remote server, pull the latest version from git and build with prod

Flow

Development

When you run the application in the dev environment, the flow is:

  1. Log the presence.
  2. Copy all static files.
  3. Start of the webserver.
  4. Start of the websocket server.
  5. Get and render packages information.
  6. Rendering initialization and first render of all.
  7. Start of the monitoring.
    • Monitor Mendoza content and blog source files and rerender individual files on the change.
    • Monitor Temple source files and rerender all the content files on template change.

Production

When you run the application in the prod environment, the flow is:

  1. Log the presence.
  2. Copy all static files.
  3. Get and render packages information.
  4. Rendering initialization and first render of all.
  5. Log the finish

Release

When you run the application in the rel environment, it just ssh to the server, pull the latest git version, run gp prod there, and copy it to Nginx's directory.

Good Place 2021 All rights rejected