Skip to content

Commit

Permalink
Merge pull request #378 from hearchco/as/ci/aws
Browse files Browse the repository at this point in the history
ci: zip for aws
  • Loading branch information
aleksasiriski authored Aug 26, 2024
2 parents 4cff3eb + cc265f0 commit 9e4a49b
Show file tree
Hide file tree
Showing 8 changed files with 121 additions and 163 deletions.
6 changes: 3 additions & 3 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
interval: "weekly"
- package-ecosystem: "docker"
directory: "/"
schedule:
interval: "daily"
interval: "weekly"
- package-ecosystem: "gomod"
directory: "/"
schedule:
interval: "daily"
interval: "weekly"
93 changes: 0 additions & 93 deletions .github/workflows/cd.yml

This file was deleted.

2 changes: 0 additions & 2 deletions .github/workflows/ci_codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,3 @@ jobs:
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{matrix.language}}"
env:
HEARCHCO_CLI: true
4 changes: 2 additions & 2 deletions .github/workflows/ci_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:

services:
redis:
image: redis
image: docker.io/library/redis:latest
ports:
- 6379:6379
options: >-
Expand All @@ -50,7 +50,7 @@ jobs:
--health-timeout 5s
--health-retries 5
dynamodb:
image: amazon/dynamodb-local
image: docker.io/amazon/dynamodb-local:latest
ports:
- 8000:8000
options: >-
Expand Down
58 changes: 58 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Release

on:
push:
tags: ["v*.*.*"]

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
goreleaser:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
issues: write

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true

- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: stable

- name: Setup QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: arm64

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Generate go code from go:generate comments
run: make install

- name: Release
uses: goreleaser/goreleaser-action@v6
with:
version: latest
args: release --clean --config goreleaser/release.yml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Artifact Linux
uses: actions/upload-artifact@v4
with:
name: build_linux
path: dist/*linux*
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:
17 changes: 5 additions & 12 deletions goreleaser/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ builds:
- env: [CGO_ENABLED=0]
goos:
- linux
- darwin
- freebsd
- windows
main: ./src
goarch:
- amd64
Expand All @@ -20,20 +17,16 @@ builds:
- -X "main.Timestamp={{ .Timestamp }}"
flags:
- -trimpath
ignore:
- goos: freebsd
goarch: arm64
- goos: windows
goarch: arm64

# MacOS Universal Binaries
universal_binaries:
- replace: true

# Archive
archives:
- name_template: "{{ .ProjectName }}_v{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}"
format: "binary"
- id: "aws"
name_template: "{{ .ProjectName }}_bootstrap_aws_{{ .Arch }}"
format: "zip"
files:
- none*

# Checksum
checksum:
Expand Down

0 comments on commit 9e4a49b

Please sign in to comment.