SShortSingh.
Back to feed

How ORAG Structures Its Go API Startup: Config, Logging, and Error Handling

0
·1 views

ORAG, a Go-based API project, manages its server startup through a dedicated run function kept separate from the main entry point in cmd/orag-api/main.go. The startup sequence follows a strict order: configuration is loaded first, followed by logger creation, application initialization, and finally HTTP server startup via the Hertz framework. If any stage fails — such as a missing configuration or a broken app builder — the function logs the error and returns exit code 1 without proceeding further. The application builder and server starter are injected as function dependencies, making the failure paths unit-testable without spinning up a real HTTP server. This design keeps the full initialization lifecycle visible in one place, making it easier to trace and modify individual stages as the project evolves.

Read the full story at DEV Community

This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)

Log in to join the discussion and vote.

Log in

Related stories

0
ProgrammingDEV Community ·

How to Deploy ImgProxy for On-the-Fly Image Processing on Ubuntu

ImgProxy is an open-source image-processing server that resizes, converts, and transforms images dynamically through URL parameters, making it suitable as a caching layer before a CDN or web application. A technical guide published on DEV Community details how to build ImgProxy from source on Ubuntu using Go and libvips, then run it as a systemd background service. The setup involves placing Nginx as a reverse proxy in front of ImgProxy and securing the connection with a TLS certificate via Certbot. Key configuration options include tuning worker count to match available CPU cores, setting preferred output formats such as WebP and AVIF, and optionally applying watermarks. The guide also covers securing the installation with signed URLs to prevent unauthorized image-processing requests.

0
ProgrammingDEV Community ·

MCP Server Audit Log Fix Created a Log That Never Persists Across Environments

A developer patched a silent-overwrite bug in an MCP server tool called update_article, which could overwrite live DEV.to posts with no record if given a wrong article ID. The fix introduced a JSONL audit log designed to capture before-and-after state on every write. However, the logs/ directory has never existed in the repository and has no history across all 50 commits, because the tool runs on a local machine while the publishing workflow runs in a separate, ephemeral container. The audit log file is therefore never committed or shared between environments, defeating its purpose of providing durable traceability. A drift-checking script already in the repo also fails to catch this gap, as it only scans for Python and shell files in three specific directories.

0
ProgrammingDEV Community ·

How to Deploy VS Code in a Browser on Ubuntu 24.04 Using Docker and Traefik

Code-server is an open-source tool that runs a full VS Code environment on a remote server, making it accessible through any web browser. A step-by-step guide outlines how to deploy it on Ubuntu 24.04 using Docker Compose, with Traefik serving as a reverse proxy to handle automatic HTTPS via Let's Encrypt. The setup requires a server with at least 1GB RAM and 2 vCPUs, a registered domain pointed to the server, and Docker installed. Code-server runs under the host user's UID and GID to avoid file permission issues, while Traefik manages SSL certificates through the ACME HTTP-01 challenge and redirects all HTTP traffic to HTTPS. Once deployed, users can install VS Code extensions directly from the browser, and optionally add an authentication proxy like Authelia for single sign-on support.

0
ProgrammingDEV Community ·

How to Deploy a Gradio Face-Restoration App on Ubuntu 22.04 with Nginx and TLS

A new technical guide details how to build and deploy a face-restoration web app using the Gradio Python library and GFPGAN on an Ubuntu 22.04 server. The setup combines GFPGAN and Real-ESRGAN models to accept a face image as input and return two enhanced outputs through a browser-based interface. The application is configured to run persistently as a systemd service, ensuring it restarts automatically on failure or reboot. Nginx is then set up as a reverse proxy to route public web traffic to the Gradio app running locally on port 8080. The guide requires a GPU-enabled server, a registered domain name, and sudo access as baseline prerequisites.