chore: rename project from gosearch to kafka
A search engine named after a man who proved answers don't exist. Renamed everywhere user-facing: - Brand name, UI titles, OpenSearch description, CSS filename - Docker service name, NixOS module (services.kafka) - Cache key prefix (kafka:), User-Agent strings (kafka/0.1) - README, config.example.toml, flake.nix descriptions Kept unchanged (internal): - Go module path: github.com/ashie/gosearch - Git repository URL: git.ashisgreat.xyz/penal-colony/gosearch - Binary entrypoint: cmd/searxng-go
This commit is contained in:
parent
be7ba66a09
commit
e5295fa69d
16 changed files with 55 additions and 55 deletions
10
Dockerfile
10
Dockerfile
|
|
@ -11,17 +11,17 @@ RUN go mod download
|
|||
|
||||
# Copy source and build
|
||||
COPY . .
|
||||
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o /gosearch ./cmd/searxng-go
|
||||
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o /kafka ./cmd/searxng-go
|
||||
|
||||
# Runtime stage
|
||||
FROM alpine:3.21
|
||||
|
||||
RUN apk add --no-cache ca-certificates tzdata
|
||||
|
||||
COPY --from=builder /gosearch /usr/local/bin/gosearch
|
||||
COPY config.example.toml /etc/gosearch/config.example.toml
|
||||
COPY --from=builder /kafka /usr/local/bin/kafka
|
||||
COPY config.example.toml /etc/kafka/config.example.toml
|
||||
|
||||
EXPOSE 8080
|
||||
|
||||
ENTRYPOINT ["gosearch"]
|
||||
CMD ["-config", "/etc/gosearch/config.toml"]
|
||||
ENTRYPOINT ["kafka"]
|
||||
CMD ["-config", "/etc/kafka/config.toml"]
|
||||
|
|
|
|||
20
README.md
20
README.md
|
|
@ -1,4 +1,4 @@
|
|||
# gosearch
|
||||
# kafka
|
||||
|
||||
A privacy-respecting, open metasearch engine written in Go. SearXNG-compatible API with an HTML frontend, designed to be fast, lightweight, and deployable anywhere.
|
||||
|
||||
|
|
@ -12,7 +12,7 @@ A privacy-respecting, open metasearch engine written in Go. SearXNG-compatible A
|
|||
- **Valkey cache** — optional Redis-compatible caching with configurable TTL
|
||||
- **Rate limiting** — three layers: per-IP, burst, and global (all disabled by default)
|
||||
- **CORS** — configurable origins for browser-based clients
|
||||
- **OpenSearch** — browsers can add gosearch as a search engine from the address bar
|
||||
- **OpenSearch** — browsers can add kafka as a search engine from the address bar
|
||||
- **Graceful degradation** — individual engine failures don't kill the whole search
|
||||
- **Docker** — multi-stage build, ~20MB runtime image
|
||||
- **NixOS** — native NixOS module with systemd service
|
||||
|
|
@ -23,7 +23,7 @@ A privacy-respecting, open metasearch engine written in Go. SearXNG-compatible A
|
|||
|
||||
```bash
|
||||
git clone https://git.ashisgreat.xyz/penal-colony/gosearch.git
|
||||
cd gosearch
|
||||
cd kafka
|
||||
go build ./cmd/searxng-go
|
||||
./searxng-go -config config.toml
|
||||
```
|
||||
|
|
@ -41,28 +41,28 @@ docker compose up -d
|
|||
Add to your flake inputs:
|
||||
|
||||
```nix
|
||||
inputs.gosearch.url = "git+https://git.ashisgreat.xyz/penal-colony/gosearch.git";
|
||||
inputs.kafka.url = "git+https://git.ashisgreat.xyz/penal-colony/gosearch.git";
|
||||
```
|
||||
|
||||
Enable in your configuration:
|
||||
|
||||
```nix
|
||||
imports = [ inputs.gosearch.nixosModules.default ];
|
||||
imports = [ inputs.kafka.nixosModules.default ];
|
||||
|
||||
services.gosearch = {
|
||||
services.kafka = {
|
||||
enable = true;
|
||||
openFirewall = true;
|
||||
baseUrl = "https://search.example.com";
|
||||
# config = "/etc/gosearch/config.toml"; # default
|
||||
# config = "/etc/kafka/config.toml"; # default
|
||||
};
|
||||
```
|
||||
|
||||
Write your config:
|
||||
|
||||
```bash
|
||||
sudo mkdir -p /etc/gosearch
|
||||
sudo cp config.example.toml /etc/gosearch/config.toml
|
||||
sudo $EDITOR /etc/gosearch/config.toml
|
||||
sudo mkdir -p /etc/kafka
|
||||
sudo cp config.example.toml /etc/kafka/config.toml
|
||||
sudo $EDITOR /etc/kafka/config.toml
|
||||
```
|
||||
|
||||
Deploy:
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
# gosearch configuration
|
||||
# kafka configuration
|
||||
# Copy to config.toml and adjust as needed.
|
||||
# Environment variables are used as fallbacks when a config field is empty/unset.
|
||||
|
||||
|
|
@ -10,7 +10,7 @@ port = 8080
|
|||
http_timeout = "10s"
|
||||
|
||||
# Public base URL for OpenSearch XML (env: BASE_URL)
|
||||
# Set this so browsers can add gosearch as a search engine.
|
||||
# Set this so browsers can add kafka as a search engine.
|
||||
# Example: "https://search.example.com"
|
||||
base_url = ""
|
||||
|
||||
|
|
|
|||
|
|
@ -1,16 +1,16 @@
|
|||
# Docker Compose for gosearch + Valkey
|
||||
# Docker Compose for kafka + Valkey
|
||||
#
|
||||
# Usage:
|
||||
# cp config.example.toml config.toml # edit as needed
|
||||
# docker compose up -d
|
||||
|
||||
services:
|
||||
gosearch:
|
||||
kafka:
|
||||
build: .
|
||||
ports:
|
||||
- "8080:8080"
|
||||
volumes:
|
||||
- ./config.toml:/etc/gosearch/config.toml:ro
|
||||
- ./config.toml:/etc/kafka/config.toml:ro
|
||||
depends_on:
|
||||
valkey:
|
||||
condition: service_healthy
|
||||
|
|
|
|||
30
flake.nix
30
flake.nix
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
description = "gosearch — privacy-respecting, open metasearch engine";
|
||||
description = "kafka — privacy-respecting, open metasearch engine";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
||||
|
|
@ -17,7 +17,7 @@
|
|||
in
|
||||
{
|
||||
default = pkgs.buildGoModule {
|
||||
pname = "gosearch";
|
||||
pname = "kafka";
|
||||
version = "0.1.0";
|
||||
src = ./.;
|
||||
|
||||
|
|
@ -32,7 +32,7 @@
|
|||
|
||||
meta = with pkgs.lib; {
|
||||
description = "Privacy-respecting, open metasearch engine";
|
||||
homepage = "https://git.ashisgreat.xyz/penal-colony/gosearch";
|
||||
homepage = "https://git.ashisgreat.xyz/penal-colony/kafka";
|
||||
license = licenses.mit;
|
||||
platforms = platforms.linux ++ platforms.darwin;
|
||||
};
|
||||
|
|
@ -41,16 +41,16 @@
|
|||
|
||||
nixosModules.default = { config, lib, pkgs, ... }:
|
||||
let
|
||||
cfg = config.services.gosearch;
|
||||
cfg = config.services.kafka;
|
||||
in
|
||||
{
|
||||
options.services.gosearch = {
|
||||
enable = lib.mkEnableOption "gosearch metasearch engine";
|
||||
options.services.kafka = {
|
||||
enable = lib.mkEnableOption "kafka metasearch engine";
|
||||
|
||||
package = lib.mkOption {
|
||||
type = lib.types.package;
|
||||
default = self.packages.${pkgs.system}.default;
|
||||
description = "gosearch package to use.";
|
||||
description = "kafka package to use.";
|
||||
};
|
||||
|
||||
port = lib.mkOption {
|
||||
|
|
@ -73,41 +73,41 @@
|
|||
|
||||
config = lib.mkOption {
|
||||
type = lib.types.path;
|
||||
default = "/etc/gosearch/config.toml";
|
||||
default = "/etc/kafka/config.toml";
|
||||
description = "Path to config.toml file.";
|
||||
};
|
||||
|
||||
user = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "gosearch";
|
||||
default = "kafka";
|
||||
description = "System user to run as.";
|
||||
};
|
||||
|
||||
group = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "gosearch";
|
||||
default = "kafka";
|
||||
description = "System group to run as.";
|
||||
};
|
||||
|
||||
stateDir = lib.mkOption {
|
||||
type = lib.types.path;
|
||||
default = "/var/lib/gosearch";
|
||||
default = "/var/lib/kafka";
|
||||
description = "State directory.";
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
users.users.${cfg.user} = lib.mkIf (cfg.user == "gosearch") {
|
||||
users.users.${cfg.user} = lib.mkIf (cfg.user == "kafka") {
|
||||
isSystemUser = true;
|
||||
group = cfg.group;
|
||||
home = cfg.stateDir;
|
||||
createHome = true;
|
||||
};
|
||||
|
||||
users.groups.${cfg.group} = lib.mkIf (cfg.group == "gosearch") { };
|
||||
users.groups.${cfg.group} = lib.mkIf (cfg.group == "kafka") { };
|
||||
|
||||
systemd.services.gosearch = {
|
||||
description = "gosearch metasearch engine";
|
||||
systemd.services.kafka = {
|
||||
description = "kafka metasearch engine";
|
||||
after = [ "network.target" ];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
|
||||
|
|
|
|||
6
internal/cache/cache.go
vendored
6
internal/cache/cache.go
vendored
|
|
@ -81,7 +81,7 @@ func (c *Cache) Get(ctx context.Context, key string) (contracts.SearchResponse,
|
|||
return contracts.SearchResponse{}, false
|
||||
}
|
||||
|
||||
fullKey := "gosearch:" + key
|
||||
fullKey := "kafka:" + key
|
||||
|
||||
data, err := c.client.Get(ctx, fullKey).Bytes()
|
||||
if err != nil {
|
||||
|
|
@ -113,7 +113,7 @@ func (c *Cache) Set(ctx context.Context, key string, resp contracts.SearchRespon
|
|||
return
|
||||
}
|
||||
|
||||
fullKey := "gosearch:" + key
|
||||
fullKey := "kafka:" + key
|
||||
if err := c.client.Set(ctx, fullKey, data, c.ttl).Err(); err != nil {
|
||||
c.logger.Warn("cache set failed", "key", fullKey, "error", err)
|
||||
}
|
||||
|
|
@ -124,7 +124,7 @@ func (c *Cache) Invalidate(ctx context.Context, key string) {
|
|||
if !c.Enabled() {
|
||||
return
|
||||
}
|
||||
fullKey := "gosearch:" + key
|
||||
fullKey := "kafka:" + key
|
||||
c.client.Del(ctx, fullKey)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import (
|
|||
"github.com/BurntSushi/toml"
|
||||
)
|
||||
|
||||
// Config is the top-level configuration for the gosearch service.
|
||||
// Config is the top-level configuration for the kafka service.
|
||||
type Config struct {
|
||||
Server ServerConfig `toml:"server"`
|
||||
Upstream UpstreamConfig `toml:"upstream"`
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ func (e *BingEngine) Search(ctx context.Context, req contracts.SearchRequest) (c
|
|||
if err != nil {
|
||||
return contracts.SearchResponse{}, err
|
||||
}
|
||||
httpReq.Header.Set("User-Agent", "gosearch/0.1 (compatible; +https://git.ashisgreat.xyz/penal-colony/gosearch)")
|
||||
httpReq.Header.Set("User-Agent", "kafka/0.1 (compatible; +https://git.ashisgreat.xyz/penal-colony/gosearch)")
|
||||
|
||||
resp, err := e.client.Do(httpReq)
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ func (e *DuckDuckGoEngine) Search(ctx context.Context, req contracts.SearchReque
|
|||
if err != nil {
|
||||
return contracts.SearchResponse{}, err
|
||||
}
|
||||
httpReq.Header.Set("User-Agent", "gosearch/0.1 (compatible; +https://git.ashisgreat.xyz/penal-colony/gosearch)")
|
||||
httpReq.Header.Set("User-Agent", "kafka/0.1 (compatible; +https://git.ashisgreat.xyz/penal-colony/gosearch)")
|
||||
|
||||
resp, err := e.client.Do(httpReq)
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ func (e *GitHubEngine) Search(ctx context.Context, req contracts.SearchRequest)
|
|||
if err != nil {
|
||||
return contracts.SearchResponse{}, err
|
||||
}
|
||||
httpReq.Header.Set("User-Agent", "gosearch/0.1")
|
||||
httpReq.Header.Set("User-Agent", "kafka/0.1")
|
||||
httpReq.Header.Set("Accept", "application/vnd.github.v3+json")
|
||||
|
||||
resp, err := e.client.Do(httpReq)
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ func (e *QwantEngine) searchWebAPI(ctx context.Context, req contracts.SearchRequ
|
|||
if err != nil {
|
||||
return contracts.SearchResponse{}, err
|
||||
}
|
||||
httpReq.Header.Set("User-Agent", "gosearch-go/0.1 (+https://github.com/ashie/gosearch)")
|
||||
httpReq.Header.Set("User-Agent", "kafka/0.1 (compatible; +https://git.ashisgreat.xyz/penal-colony/gosearch)")
|
||||
|
||||
resp, err := e.client.Do(httpReq)
|
||||
if err != nil {
|
||||
|
|
@ -234,7 +234,7 @@ func (e *QwantEngine) searchWebLite(ctx context.Context, req contracts.SearchReq
|
|||
if err != nil {
|
||||
return contracts.SearchResponse{}, err
|
||||
}
|
||||
httpReq.Header.Set("User-Agent", "gosearch-go/0.1 (+https://github.com/ashie/gosearch)")
|
||||
httpReq.Header.Set("User-Agent", "kafka/0.1 (compatible; +https://git.ashisgreat.xyz/penal-colony/gosearch)")
|
||||
|
||||
resp, err := e.client.Do(httpReq)
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ func (e *RedditEngine) Search(ctx context.Context, req contracts.SearchRequest)
|
|||
if err != nil {
|
||||
return contracts.SearchResponse{}, err
|
||||
}
|
||||
httpReq.Header.Set("User-Agent", "gosearch/0.1 (compatible; +https://git.ashisgreat.xyz/penal-colony/gosearch)")
|
||||
httpReq.Header.Set("User-Agent", "kafka/0.1 (compatible; +https://git.ashisgreat.xyz/penal-colony/gosearch)")
|
||||
|
||||
resp, err := e.client.Do(httpReq)
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* gosearch — clean, minimal search engine CSS */
|
||||
/* kafka — clean, minimal search engine CSS */
|
||||
/* Inspired by SearXNG's simple theme class conventions */
|
||||
|
||||
:root {
|
||||
|
|
@ -6,19 +6,19 @@
|
|||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="referrer" content="no-referrer">
|
||||
<meta name="robots" content="noarchive">
|
||||
<meta name="description" content="gosearch — a privacy-respecting, open metasearch engine">
|
||||
<title>{{template "title" .}}gosearch</title>
|
||||
<link rel="stylesheet" href="/static/css/gosearch.css">
|
||||
<meta name="description" content="kafka — a privacy-respecting, open metasearch engine">
|
||||
<title>{{template "title" .}}kafka</title>
|
||||
<link rel="stylesheet" href="/static/css/kafka.css">
|
||||
<script src="https://unpkg.com/htmx.org@2.0.4"></script>
|
||||
<link rel="icon" href="/static/img/favicon.svg" type="image/svg+xml">
|
||||
<link title="gosearch" type="application/opensearchdescription+xml" rel="search" href="/opensearch.xml">
|
||||
<link title="kafka" type="application/opensearchdescription+xml" rel="search" href="/opensearch.xml">
|
||||
</head>
|
||||
<body class="{{if .Query}}search_on_results{{end}}">
|
||||
<main>
|
||||
{{template "content" .}}
|
||||
</main>
|
||||
<footer>
|
||||
<p>Powered by <a href="https://git.ashisgreat.xyz/penal-colony/gosearch">gosearch</a> — a privacy-respecting, open metasearch engine</p>
|
||||
<p>Powered by <a href="https://git.ashisgreat.xyz/penal-colony/kafka">kafka</a> — a privacy-respecting, open metasearch engine</p>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{{define "title"}}{{end}}
|
||||
{{define "content"}}
|
||||
<div class="index">
|
||||
<div class="title"><h1>gosearch</h1></div>
|
||||
<div class="title"><h1>kafka</h1></div>
|
||||
<div id="search">
|
||||
<form method="GET" action="/search" role="search">
|
||||
<input type="text" name="q" id="q" placeholder="Search…" autocomplete="off" autofocus
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
|
||||
<ShortName>gosearch</ShortName>
|
||||
<ShortName>kafka</ShortName>
|
||||
<Description>A privacy-respecting, open metasearch engine</Description>
|
||||
<InputEncoding>UTF-8</InputEncoding>
|
||||
<OutputEncoding>UTF-8</OutputEncoding>
|
||||
<LongName>gosearch — Privacy-respecting metasearch</LongName>
|
||||
<LongName>kafka — Privacy-respecting metasearch</LongName>
|
||||
<Image width="16" height="16" type="image/svg+xml">/static/img/favicon.svg</Image>
|
||||
<Contact>https://git.ashisgreat.xyz/penal-colony/gosearch</Contact>
|
||||
<Contact>https://git.ashisgreat.xyz/penal-colony/kafka</Contact>
|
||||
<Url type="text/html" method="GET" template="{baseUrl}/search?q={searchTerms}&format=html">
|
||||
<Param name="pageno" value="{startPage?}" />
|
||||
<Param name="language" value="{language?}" />
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue