Skip to content

Commit

Permalink
chore(README): move docker-compose example into separate file
Browse files Browse the repository at this point in the history
  • Loading branch information
aleksasiriski committed Aug 26, 2024
1 parent dd45253 commit cc265f0
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 51 deletions.
51 changes: 0 additions & 51 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,52 +1 @@
# Hearchco agent repository built using Go

To self-host, you can use the official docker images:

```yaml
version: "3.9"
services:
traefik:
image: "traefik:latest"
command:
- "--providers.docker=true"
- "--providers.docker.exposedbydefault=false"
- "--entryPoints.web.address=:80"
ports:
- "80:80"
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
restart: unless-stopped
frontend:
image: ghcr.io/hearchco/frontend:latest
environment:
- PUBLIC_URI=https://search.example.org
- API_URI=http://agent:3030 # server reachable, used for SSR
- PUBLIC_API_URI=https://api.search.example.org # client reachable, used for CSR
restart: unless-stopped
labels:
- "traefik.enable=true"
- "traefik.http.routers.frontend.rule=Host(`search.example.org`)"
- "traefik.http.routers.frontend.entrypoints=web"
- "traefik.http.services.frontend.loadbalancer.server.port=3000"
agent:
image: ghcr.io/hearchco/agent:latest
environment:
- HEARCHCO_SERVER_FRONTENDURLS=http://localhost:5173,https://*search.example.org
- HEARCHCO_SERVER_CACHE_TYPE=redis # set to "none" to disable caching, NOT RECOMMENDED
- HEARCHCO_SERVER_CACHE_REDIS_HOST=redis
# - HEARCHCO_SERVER_CACHE_REDIS_PASSWORD=redispassword # empty by default
- HEARCHCO_SERVER_IMAGEPROXY_SECRETKEY=supersecretkey # used by image proxy for hashing image urls
restart: unless-stopped
labels:
- "traefik.enable=true"
- "traefik.http.routers.agent.rule=Host(`api.search.example.org`)"
- "traefik.http.routers.agent.entrypoints=web"
- "traefik.http.services.agent.loadbalancer.server.port=3030"
redis:
image: redis:latest
volumes:
- "redis-vol-0:/data"
restart: unless-stopped
volumes:
redis-vol-0:
```
53 changes: 53 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
version: '3.9'
services:
# Traefik can be replaced with any reverse proxy, this is just an example
traefik:
image: docker.io/library/traefik:latest # NOTE: Don't use the latest tag in production
command:
- '--providers.docker=true'
- '--providers.docker.exposedbydefault=false'
- '--entryPoints.web.address=:80'
ports:
- '80:80'
volumes:
- '/var/run/docker.sock:/var/run/docker.sock:ro'
restart: unless-stopped
# SvelteKit frontend, used for server-side rendering and serving web browser clients
frontend:
image: ghcr.io/hearchco/frontend:latest # NOTE: Don't use the latest tag in production
environment:
- PUBLIC_URI=https://search.example.org # Public accessible URI of the frontend, used to generate opensearch.xml
- API_URI=http://agent:3030 # Frontend reachable URI of the agent, used for fetching data when server-side rendering
- PUBLIC_API_URI=https://api.search.example.org # Public accessible URI of the agent, used for fetching data from the browser (using JS)
restart: unless-stopped
labels:
- 'traefik.enable=true'
- 'traefik.http.routers.frontend.rule=Host(`search.example.org`)'
- 'traefik.http.routers.frontend.entrypoints=web'
- 'traefik.http.services.frontend.loadbalancer.server.port=3000' # This is the port defined in the Dockerfile for frontend
# Go agent, used for scraping search engines and other data sources and serving a JSON REST API for frontend
agent:
image: ghcr.io/hearchco/agent:latest # NOTE: Don't use the latest tag in production
environment:
- HEARCHCO_SERVER_FRONTENDURLS=http://localhost:5173,https://*search.example.org # Comma separated list, with wildcard (*) support in URIs, used for CORS
- HEARCHCO_SERVER_CACHE_TYPE=redis # Can be "none", "redis" or "dynamodb". Disabling the cache is discouraged.
- HEARCHCO_SERVER_CACHE_REDIS_HOST=redis
- HEARCHCO_SERVER_CACHE_REDIS_PASSWORD=redispassword
# - HEARCHCO_SERVER_CACHE_DYNAMODB_REGION=eu-central-1 # Can be left empty or set to "global" for global tables
# - HEARCHCO_SERVER_CACHE_DYNAMODB_TABLE=hearchco-cache
- HEARCHCO_SERVER_IMAGEPROXY_SECRETKEY=super_secret_key_that_is_at_least_32_chars_long # Used by image proxy for hashing image URLs, set to something long and secure
restart: unless-stopped
labels:
- 'traefik.enable=true'
- 'traefik.http.routers.agent.rule=Host(`api.search.example.org`)'
- 'traefik.http.routers.agent.entrypoints=web'
- 'traefik.http.services.agent.loadbalancer.server.port=3030' # This is the port defined in the Dockerfile for agent
redis:
image: docker.io/library/redis:latest # NOTE: Don't use the latest tag in production
command:
- '--requirepass=redispassword'
volumes:
- 'redis-vol-0:/data:Z'
restart: unless-stopped
volumes:
redis-vol-0:

0 comments on commit cc265f0

Please sign in to comment.