Skip to content

Commit 7c3b745

Browse files
committed
Init commit
0 parents commit 7c3b745

File tree

543 files changed

+113816
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

543 files changed

+113816
-0
lines changed

.dockerignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
build/
2+
.git/
3+
Dockerfile

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<!--
2+
Work-in-progress PRs are welcome as a way to get early feedback - just prefix
3+
the title with [WIP].
4+
5+
Add the change in the changelog (except for test changes and docs updates).
6+
Please edit CHANGELOG.md and add the change under the appropriate category (NEW
7+
FEATURES, IMPROVEMENTS & BUG FIXES) along with the PR number.
8+
-->
9+
10+
#### What does this do / why do we need it?
11+
12+
#### What should your reviewer look out for in this PR?
13+
14+
#### Which issue(s) does this PR fix?
15+
16+
#### If this PR affects any API reference documentation, please share the updated endpoint references
17+
18+
<!--
19+
20+
- [ ] I've updated the doc.
21+
22+
Doc link shared here - <Updated API Reference Doc link>
23+
24+
-->
25+
26+
<!--
27+
28+
fixes #
29+
fixes #
30+
31+
-->

.github/workflows/code-review.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Code Review
2+
3+
permissions:
4+
contents: read
5+
pull-requests: write
6+
7+
on:
8+
pull_request:
9+
types: [opened, reopened, synchronize]
10+
11+
jobs:
12+
test:
13+
# if: ${{ contains(github.event.*.labels.*.name, 'gpt review') }} # Optional; to run only when a label is attached
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: anc95/ChatGPT-CodeReview@main
17+
env:
18+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
19+
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
20+
# Optional
21+
OPENAI_API_ENDPOINT: https://api.openai.com/v1
22+
MODEL: gpt-3.5-turbo-16k
23+
PROMPT:
24+
top_p: 1
25+
temperature: 0.3
26+
max_tokens: 8000
27+
MAX_PATCH_LENGTH: 8000 # if the patch/diff length is large than MAX_PATCH_LENGTH, will be ignored and won't review. By default, with no MAX_PATCH_LENGTH set, there is also no limit for the patch/diff length.
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Create Schema for latest release
2+
3+
on:
4+
repository_dispatch:
5+
types: [create_schema]
6+
workflow_dispatch:
7+
8+
jobs:
9+
create_schema:
10+
runs-on: ubuntu-latest
11+
name: Create Schema
12+
13+
steps:
14+
- name: Checkout noss Repo
15+
uses: actions/checkout@v3
16+
with:
17+
path: noss
18+
19+
- name: Checkout oss repo
20+
uses: actions/checkout@v3
21+
with:
22+
repository: appbaseio/reactivesearch-api
23+
path: oss
24+
token: ${{ secrets.REPO_ACCESS_TOKEN }}
25+
26+
- name: Make clean and build
27+
run: make clean && make
28+
working-directory: ./noss
29+
30+
- name: Generate the latest schema
31+
run: ./build/reactivesearch --create-schema
32+
working-directory: ./noss
33+
34+
- name: Remove older schema
35+
run: rm schema -rf
36+
working-directory: ./oss
37+
38+
- name: Copy the built schema to oss
39+
run: cp -r noss/schema oss/
40+
41+
- name: Add and Commit changes
42+
uses: EndBug/add-and-commit@v9
43+
with:
44+
add: schema
45+
default_author: github_actions
46+
message: Update schema for latest release
47+
push: true
48+
cwd: ./oss

.github/workflows/docker-image.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: ReactiveSearch API server - Cluster, BYOC and Self-host Docker builds
2+
3+
on:
4+
release:
5+
types: [ published ]
6+
repository_dispatch:
7+
types: [publish_docker]
8+
workflow_dispatch:
9+
10+
11+
jobs:
12+
13+
build:
14+
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- uses: actions/checkout@v2
19+
20+
- name: Extract version from payload
21+
id: get_version
22+
run: echo "version=${{ github.event.client_payload.version }}" >> $GITHUB_OUTPUT
23+
- name: Get Version For Release
24+
id: get_version_release
25+
uses: battila7/get-version-action@v2.2.1
26+
-
27+
name: Set up QEMU
28+
uses: docker/setup-qemu-action@v1
29+
-
30+
name: Set up Docker Buildx
31+
uses: docker/setup-buildx-action@v1
32+
-
33+
name: Login to DockerHub
34+
uses: docker/login-action@v1
35+
with:
36+
username: ${{ secrets.DOCKERHUB_USERNAME }}
37+
password: ${{ secrets.DOCKERHUB_TOKEN }}
38+
-
39+
name: Build and push latest image
40+
uses: docker/build-push-action@v2
41+
with:
42+
context: .
43+
push: true
44+
platforms: linux/amd64,linux/arm64
45+
tags: ${{ format('appbaseio/reactivesearch-api:{0}', steps.get_version.outputs.version || steps.get_version_release.outputs.version) }},appbaseio/reactivesearch-api:latest

.github/workflows/tests.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Run Tests
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
test:
7+
runs-on: ubuntu-latest
8+
strategy:
9+
matrix:
10+
plugin: [rules, pipelines, openai]
11+
steps:
12+
- name: Checkout the branch
13+
uses: actions/checkout@v2
14+
- name: Set up go
15+
uses: actions/setup-go@v2
16+
with:
17+
go-version: 1.19
18+
19+
- name: Run ${{matrix.plugin}} test
20+
run: go test -v ${{ format('./plugins/{0}', matrix.plugin) }}

.gitignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
build/
2+
config/
3+
*.log
4+
.idea
5+
.DS_Store
6+
log
7+
telemetrylog
8+
.vscode
9+
indices
10+
data

Dockerfile

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
FROM golang:1.21.3 AS builder
2+
3+
ARG VERSION=8.22.0
4+
ENV VERSION="${VERSION}"
5+
6+
# Default value
7+
# Run `--build-arg BILLING=true` to enable billing
8+
ARG BILLING=true
9+
ENV BILLING="${BILLING}"
10+
11+
# Run `--build-arg HOSTED_BILLING=true` to enable billing for hosted reactivesearch
12+
ARG HOSTED_BILLING=false
13+
ENV HOSTED_BILLING="${HOSTED_BILLING}"
14+
15+
# Run `--build-arg CLUSTER_BILLING=true` to enable billing for clusters
16+
ARG CLUSTER_BILLING=false
17+
ENV CLUSTER_BILLING="${CLUSTER_BILLING}"
18+
19+
20+
# Run `--build-arg OPENSOURCE=true` to build opensource
21+
ARG OPENSOURCE=false
22+
ENV OPENSOURCE="${OPENSOURCE}"
23+
24+
# Run `--build-arg IGNORE_BILLING_MIDDLEWARE=true` to disable billing middleware for testing
25+
ARG IGNORE_BILLING_MIDDLEWARE=false
26+
ENV IGNORE_BILLING_MIDDLEWARE="${IGNORE_BILLING_MIDDLEWARE}"
27+
28+
# Run `--build-arg PLAN_REFRESH_INTERVAL=X` to change the default interval of 1 hour, where 'X' is an integer represent the hours unit
29+
ARG PLAN_REFRESH_INTERVAL=1
30+
ENV PLAN_REFRESH_INTERVAL="${PLAN_REFRESH_INTERVAL}"
31+
32+
# Install tools required for project
33+
# Run `docker build --no-cache .` to update dependencies
34+
RUN apt-get update
35+
RUN apt-get -y install build-essential git
36+
WORKDIR /reactivesearch
37+
38+
# List project dependencies with go.mod and go.sum
39+
COPY go.mod go.sum ./
40+
41+
# Install library dependencies
42+
RUN go mod download
43+
44+
# Copy the entire project and build it
45+
# This layer is rebuilt when a file changes in the project directory
46+
COPY . .
47+
RUN make
48+
49+
FROM debian:bookworm AS final
50+
51+
# Create env folder
52+
RUN mkdir /reactivesearch-data && touch /reactivesearch-data/.env && chmod 777 /reactivesearch-data/.env
53+
54+
# Import the compiled executable from the first stage.
55+
COPY --from=builder /reactivesearch /reactivesearch
56+
WORKDIR /reactivesearch
57+
58+
EXPOSE 8000
59+
ENTRYPOINT ["build/reactivesearch", "--log", "error", "--plugins"]

Dockerfile-byoc

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
FROM golang:1.21.3 AS builder
2+
3+
ARG VERSION=8.22.0
4+
ENV VERSION="${VERSION}"
5+
6+
# Default value
7+
# Run `--build-arg BILLING=true` to enable billing
8+
ARG BILLING=false
9+
ENV BILLING="${BILLING}"
10+
11+
# Run `--build-arg HOSTED_BILLING=true` to enable billing for hosted reactivesearch
12+
ARG HOSTED_BILLING=true
13+
ENV HOSTED_BILLING="${HOSTED_BILLING}"
14+
15+
# Run `--build-arg CLUSTER_BILLING=true` to enable billing for clusters
16+
ARG CLUSTER_BILLING=false
17+
ENV CLUSTER_BILLING="${CLUSTER_BILLING}"
18+
19+
# Run `--build-arg OPENSOURCE=true` to build opensource
20+
ARG OPENSOURCE=false
21+
ENV OPENSOURCE="${OPENSOURCE}"
22+
23+
# Run `--build-arg IGNORE_BILLING_MIDDLEWARE=true` to disable billing middleware for testing
24+
ARG IGNORE_BILLING_MIDDLEWARE=false
25+
ENV IGNORE_BILLING_MIDDLEWARE="${IGNORE_BILLING_MIDDLEWARE}"
26+
27+
# Run `--build-arg PLAN_REFRESH_INTERVAL=X` to change the default interval of 1 hour, where 'X' is an integer represent the hours unit
28+
ARG PLAN_REFRESH_INTERVAL=1
29+
ENV PLAN_REFRESH_INTERVAL="${PLAN_REFRESH_INTERVAL}"
30+
31+
# Install tools required for project
32+
# Run `docker build --no-cache .` to update dependencies
33+
RUN apt-get update
34+
RUN apt-get -y install build-essential git
35+
WORKDIR /reactivesearch
36+
37+
# List project dependencies with go.mod and go.sum
38+
COPY go.mod go.sum ./
39+
40+
# Install library dependencies
41+
RUN go mod download
42+
43+
# Copy the entire project and build it
44+
# This layer is rebuilt when a file changes in the project directory
45+
COPY . .
46+
RUN make
47+
48+
# Final stage: Create the running container
49+
FROM debian:bookworm AS final
50+
51+
# Create env folder
52+
RUN mkdir /reactivesearch-data && touch /reactivesearch-data/.env && chmod 777 /reactivesearch-data/.env
53+
54+
# Import the compiled executable from the first stage.
55+
COPY --from=builder /reactivesearch /reactivesearch
56+
WORKDIR /reactivesearch
57+
58+
EXPOSE 8000
59+
ENTRYPOINT ["build/reactivesearch", "--log", "error", "--plugins"]

Dockerfile-cluster

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
FROM golang:1.21.3 AS builder
2+
3+
ARG VERSION=8.22.0
4+
ENV VERSION="${VERSION}"
5+
6+
# Default value
7+
# Run `--build-arg BILLING=true` to enable billing
8+
ARG BILLING=false
9+
ENV BILLING="${BILLING}"
10+
11+
# Run `--build-arg HOSTED_BILLING=true` to enable billing for hosted reactivesearch
12+
ARG HOSTED_BILLING=false
13+
ENV HOSTED_BILLING="${HOSTED_BILLING}"
14+
15+
# Run `--build-arg CLUSTER_BILLING=true` to enable billing for clusters
16+
ARG CLUSTER_BILLING=true
17+
ENV CLUSTER_BILLING="${CLUSTER_BILLING}"
18+
19+
# Run `--build-arg OPENSOURCE=true` to build opensource
20+
ARG OPENSOURCE=false
21+
ENV OPENSOURCE="${OPENSOURCE}"
22+
23+
# Run `--build-arg IGNORE_BILLING_MIDDLEWARE=true` to disable billing middleware for testing
24+
ARG IGNORE_BILLING_MIDDLEWARE=false
25+
ENV IGNORE_BILLING_MIDDLEWARE="${IGNORE_BILLING_MIDDLEWARE}"
26+
27+
# Run `--build-arg PLAN_REFRESH_INTERVAL=X` to change the default interval of 1 hour, where 'X' is an integer represent the hours unit
28+
ARG PLAN_REFRESH_INTERVAL=1
29+
ENV PLAN_REFRESH_INTERVAL="${PLAN_REFRESH_INTERVAL}"
30+
31+
# Install tools required for project
32+
# Run `docker build --no-cache .` to update dependencies
33+
RUN apt-get update
34+
RUN apt-get -y install build-essential git
35+
WORKDIR /reactivesearch
36+
37+
# List project dependencies with go.mod and go.sum
38+
COPY go.mod go.sum ./
39+
40+
# Install library dependencies
41+
RUN go mod download
42+
43+
# Copy the entire project and build it
44+
# This layer is rebuilt when a file changes in the project directory
45+
COPY . .
46+
RUN make
47+
48+
# Final stage: Create the running container
49+
FROM debian:bookworm AS final
50+
51+
# Create env folder
52+
RUN mkdir /reactivesearch-data && touch /reactivesearch-data/.env && chmod 777 /reactivesearch-data/.env
53+
54+
# Import the compiled executable from the first stage.
55+
COPY --from=builder /reactivesearch /reactivesearch
56+
WORKDIR /reactivesearch
57+
58+
EXPOSE 8000
59+
ENTRYPOINT ["build/reactivesearch", "--log", "error", "--plugins"]

0 commit comments

Comments
 (0)