Skip to content

Commit

Permalink
Init commit
Browse files Browse the repository at this point in the history
  • Loading branch information
deepjyoti30 committed Jun 17, 2024
0 parents commit 7c3b745
Show file tree
Hide file tree
Showing 543 changed files with 113,816 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
build/
.git/
Dockerfile
31 changes: 31 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<!--
Work-in-progress PRs are welcome as a way to get early feedback - just prefix
the title with [WIP].
Add the change in the changelog (except for test changes and docs updates).
Please edit CHANGELOG.md and add the change under the appropriate category (NEW
FEATURES, IMPROVEMENTS & BUG FIXES) along with the PR number.
-->

#### What does this do / why do we need it?

#### What should your reviewer look out for in this PR?

#### Which issue(s) does this PR fix?

#### If this PR affects any API reference documentation, please share the updated endpoint references

<!--
- [ ] I've updated the doc.
Doc link shared here - <Updated API Reference Doc link>
-->

<!--
fixes #
fixes #
-->
27 changes: 27 additions & 0 deletions .github/workflows/code-review.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Code Review

permissions:
contents: read
pull-requests: write

on:
pull_request:
types: [opened, reopened, synchronize]

jobs:
test:
# if: ${{ contains(github.event.*.labels.*.name, 'gpt review') }} # Optional; to run only when a label is attached
runs-on: ubuntu-latest
steps:
- uses: anc95/ChatGPT-CodeReview@main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
# Optional
OPENAI_API_ENDPOINT: https://api.openai.com/v1
MODEL: gpt-3.5-turbo-16k
PROMPT:
top_p: 1
temperature: 0.3
max_tokens: 8000
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.
48 changes: 48 additions & 0 deletions .github/workflows/create-schema.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Create Schema for latest release

on:
repository_dispatch:
types: [create_schema]
workflow_dispatch:

jobs:
create_schema:
runs-on: ubuntu-latest
name: Create Schema

steps:
- name: Checkout noss Repo
uses: actions/checkout@v3
with:
path: noss

- name: Checkout oss repo
uses: actions/checkout@v3
with:
repository: appbaseio/reactivesearch-api
path: oss
token: ${{ secrets.REPO_ACCESS_TOKEN }}

- name: Make clean and build
run: make clean && make
working-directory: ./noss

- name: Generate the latest schema
run: ./build/reactivesearch --create-schema
working-directory: ./noss

- name: Remove older schema
run: rm schema -rf
working-directory: ./oss

- name: Copy the built schema to oss
run: cp -r noss/schema oss/

- name: Add and Commit changes
uses: EndBug/add-and-commit@v9
with:
add: schema
default_author: github_actions
message: Update schema for latest release
push: true
cwd: ./oss
45 changes: 45 additions & 0 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: ReactiveSearch API server - Cluster, BYOC and Self-host Docker builds

on:
release:
types: [ published ]
repository_dispatch:
types: [publish_docker]
workflow_dispatch:


jobs:

build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Extract version from payload
id: get_version
run: echo "version=${{ github.event.client_payload.version }}" >> $GITHUB_OUTPUT
- name: Get Version For Release
id: get_version_release
uses: battila7/[email protected]
-
name: Set up QEMU
uses: docker/setup-qemu-action@v1
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
-
name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Build and push latest image
uses: docker/build-push-action@v2
with:
context: .
push: true
platforms: linux/amd64,linux/arm64
tags: ${{ format('appbaseio/reactivesearch-api:{0}', steps.get_version.outputs.version || steps.get_version_release.outputs.version) }},appbaseio/reactivesearch-api:latest
20 changes: 20 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Run Tests

on: [push, pull_request]

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
plugin: [rules, pipelines, openai]
steps:
- name: Checkout the branch
uses: actions/checkout@v2
- name: Set up go
uses: actions/setup-go@v2
with:
go-version: 1.19

- name: Run ${{matrix.plugin}} test
run: go test -v ${{ format('./plugins/{0}', matrix.plugin) }}
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
build/
config/
*.log
.idea
.DS_Store
log
telemetrylog
.vscode
indices
data
59 changes: 59 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
FROM golang:1.21.3 AS builder

ARG VERSION=8.22.0
ENV VERSION="${VERSION}"

# Default value
# Run `--build-arg BILLING=true` to enable billing
ARG BILLING=true
ENV BILLING="${BILLING}"

# Run `--build-arg HOSTED_BILLING=true` to enable billing for hosted reactivesearch
ARG HOSTED_BILLING=false
ENV HOSTED_BILLING="${HOSTED_BILLING}"

# Run `--build-arg CLUSTER_BILLING=true` to enable billing for clusters
ARG CLUSTER_BILLING=false
ENV CLUSTER_BILLING="${CLUSTER_BILLING}"


# Run `--build-arg OPENSOURCE=true` to build opensource
ARG OPENSOURCE=false
ENV OPENSOURCE="${OPENSOURCE}"

# Run `--build-arg IGNORE_BILLING_MIDDLEWARE=true` to disable billing middleware for testing
ARG IGNORE_BILLING_MIDDLEWARE=false
ENV IGNORE_BILLING_MIDDLEWARE="${IGNORE_BILLING_MIDDLEWARE}"

# Run `--build-arg PLAN_REFRESH_INTERVAL=X` to change the default interval of 1 hour, where 'X' is an integer represent the hours unit
ARG PLAN_REFRESH_INTERVAL=1
ENV PLAN_REFRESH_INTERVAL="${PLAN_REFRESH_INTERVAL}"

# Install tools required for project
# Run `docker build --no-cache .` to update dependencies
RUN apt-get update
RUN apt-get -y install build-essential git
WORKDIR /reactivesearch

# List project dependencies with go.mod and go.sum
COPY go.mod go.sum ./

# Install library dependencies
RUN go mod download

# Copy the entire project and build it
# This layer is rebuilt when a file changes in the project directory
COPY . .
RUN make

FROM debian:bookworm AS final

# Create env folder
RUN mkdir /reactivesearch-data && touch /reactivesearch-data/.env && chmod 777 /reactivesearch-data/.env

# Import the compiled executable from the first stage.
COPY --from=builder /reactivesearch /reactivesearch
WORKDIR /reactivesearch

EXPOSE 8000
ENTRYPOINT ["build/reactivesearch", "--log", "error", "--plugins"]
59 changes: 59 additions & 0 deletions Dockerfile-byoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
FROM golang:1.21.3 AS builder

ARG VERSION=8.22.0
ENV VERSION="${VERSION}"

# Default value
# Run `--build-arg BILLING=true` to enable billing
ARG BILLING=false
ENV BILLING="${BILLING}"

# Run `--build-arg HOSTED_BILLING=true` to enable billing for hosted reactivesearch
ARG HOSTED_BILLING=true
ENV HOSTED_BILLING="${HOSTED_BILLING}"

# Run `--build-arg CLUSTER_BILLING=true` to enable billing for clusters
ARG CLUSTER_BILLING=false
ENV CLUSTER_BILLING="${CLUSTER_BILLING}"

# Run `--build-arg OPENSOURCE=true` to build opensource
ARG OPENSOURCE=false
ENV OPENSOURCE="${OPENSOURCE}"

# Run `--build-arg IGNORE_BILLING_MIDDLEWARE=true` to disable billing middleware for testing
ARG IGNORE_BILLING_MIDDLEWARE=false
ENV IGNORE_BILLING_MIDDLEWARE="${IGNORE_BILLING_MIDDLEWARE}"

# Run `--build-arg PLAN_REFRESH_INTERVAL=X` to change the default interval of 1 hour, where 'X' is an integer represent the hours unit
ARG PLAN_REFRESH_INTERVAL=1
ENV PLAN_REFRESH_INTERVAL="${PLAN_REFRESH_INTERVAL}"

# Install tools required for project
# Run `docker build --no-cache .` to update dependencies
RUN apt-get update
RUN apt-get -y install build-essential git
WORKDIR /reactivesearch

# List project dependencies with go.mod and go.sum
COPY go.mod go.sum ./

# Install library dependencies
RUN go mod download

# Copy the entire project and build it
# This layer is rebuilt when a file changes in the project directory
COPY . .
RUN make

# Final stage: Create the running container
FROM debian:bookworm AS final

# Create env folder
RUN mkdir /reactivesearch-data && touch /reactivesearch-data/.env && chmod 777 /reactivesearch-data/.env

# Import the compiled executable from the first stage.
COPY --from=builder /reactivesearch /reactivesearch
WORKDIR /reactivesearch

EXPOSE 8000
ENTRYPOINT ["build/reactivesearch", "--log", "error", "--plugins"]
59 changes: 59 additions & 0 deletions Dockerfile-cluster
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
FROM golang:1.21.3 AS builder

ARG VERSION=8.22.0
ENV VERSION="${VERSION}"

# Default value
# Run `--build-arg BILLING=true` to enable billing
ARG BILLING=false
ENV BILLING="${BILLING}"

# Run `--build-arg HOSTED_BILLING=true` to enable billing for hosted reactivesearch
ARG HOSTED_BILLING=false
ENV HOSTED_BILLING="${HOSTED_BILLING}"

# Run `--build-arg CLUSTER_BILLING=true` to enable billing for clusters
ARG CLUSTER_BILLING=true
ENV CLUSTER_BILLING="${CLUSTER_BILLING}"

# Run `--build-arg OPENSOURCE=true` to build opensource
ARG OPENSOURCE=false
ENV OPENSOURCE="${OPENSOURCE}"

# Run `--build-arg IGNORE_BILLING_MIDDLEWARE=true` to disable billing middleware for testing
ARG IGNORE_BILLING_MIDDLEWARE=false
ENV IGNORE_BILLING_MIDDLEWARE="${IGNORE_BILLING_MIDDLEWARE}"

# Run `--build-arg PLAN_REFRESH_INTERVAL=X` to change the default interval of 1 hour, where 'X' is an integer represent the hours unit
ARG PLAN_REFRESH_INTERVAL=1
ENV PLAN_REFRESH_INTERVAL="${PLAN_REFRESH_INTERVAL}"

# Install tools required for project
# Run `docker build --no-cache .` to update dependencies
RUN apt-get update
RUN apt-get -y install build-essential git
WORKDIR /reactivesearch

# List project dependencies with go.mod and go.sum
COPY go.mod go.sum ./

# Install library dependencies
RUN go mod download

# Copy the entire project and build it
# This layer is rebuilt when a file changes in the project directory
COPY . .
RUN make

# Final stage: Create the running container
FROM debian:bookworm AS final

# Create env folder
RUN mkdir /reactivesearch-data && touch /reactivesearch-data/.env && chmod 777 /reactivesearch-data/.env

# Import the compiled executable from the first stage.
COPY --from=builder /reactivesearch /reactivesearch
WORKDIR /reactivesearch

EXPOSE 8000
ENTRYPOINT ["build/reactivesearch", "--log", "error", "--plugins"]
Loading

0 comments on commit 7c3b745

Please sign in to comment.