Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Getting Started

This section launches the server locally using only the components in this repository. Prompt generation, attribute derivation and series logic reside in the separate trueblocks-dalle library—refer to its book for deeper internals.

Prerequisites

  • Go 1.21+ (check with go version)
  • (Optional) An OpenAI API key for real enhancement + image generation. Without it the server automatically switches to mock/skip mode (still exercising progress + caching paths).

Clone & Enter

git clone https://github.com/TrueBlocks/trueblocks-dalleserver.git
cd trueblocks-dalleserver

Environment Setup

Copy and edit an env file:

cp .env.example .env

Populate at minimum (fish shell example):

set -x OPENAI_API_KEY "sk-..."  # optional; omit to run in skip image mode

You can also export at runtime or rely on your shell profile. The minimal config for a mock run is literally nothing—absence of OPENAI_API_KEY implies skip image.

Run

make run

Output (abridged):

[status] reporter started (interval=2s)
Starting server on :8080

Visit:

Forcing Regeneration

Remove a cached annotated image by adding ?remove=1 then re‑issuing ?generate=1.

Graceful Shutdown

Ctrl+C sends SIGINT. The server initiates a 10s timeout graceful shutdown (http.Server.Shutdown) after which it force closes.

Next

Proceed to Running the Server for flags, port overrides and data directory details.