forked from lmenezes/cerebro
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from vpiserchia/vpiserchia/main
Vpiserchia/main
- Loading branch information
Showing
63 changed files
with
4,346 additions
and
5,424 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.git/ | ||
.github/ | ||
target/ | ||
Dockerfile | ||
cerebro.db |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
name: release | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
description: Version of Cerebro to build | ||
required: true | ||
type: string | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: ${{ github.repository }} | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-22.04 | ||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
steps: | ||
- name: Check out the repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Log in to the Container registry | ||
uses: docker/[email protected] | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Extract metadata | ||
id: meta | ||
uses: docker/metadata-action@v4 | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
tags: | | ||
type=raw,value=${{ inputs.version }} | ||
type=raw,value=latest | ||
type=sha | ||
- name: Build and push Docker image | ||
uses: docker/[email protected] | ||
with: | ||
context: . | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
build-args: CEREBRO_VERSION=${{ inputs.version }} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: tests | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
|
||
jobs: | ||
build_backend: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up JDK 1.8 | ||
uses: actions/setup-java@v1 | ||
with: | ||
java-version: 1.8 | ||
- name: Run tests | ||
run: sbt test | ||
|
||
build_frontend: | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
node-version: [10.x, 12.x, 14.x] | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
- run: npm ci | ||
- run: npm run build --if-present | ||
- run: npm test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# Build web assets (frontend) | ||
FROM node as builder-grunt | ||
|
||
RUN mkdir /app | ||
COPY . /app | ||
WORKDIR /app | ||
|
||
RUN npm install -g grunt | ||
RUN npm install | ||
RUN grunt build | ||
|
||
# Build scala (backend) | ||
FROM sbtscala/scala-sbt:eclipse-temurin-jammy-11.0.17_8_1.8.2_2.13.10 as builder-scala | ||
|
||
ARG CEREBRO_VERSION | ||
|
||
RUN mkdir /app /opt/cerebro | ||
WORKDIR /app | ||
COPY --from=builder-grunt /app /app | ||
RUN sbt packageZipTarball | ||
RUN tar --strip-components=1 -C /opt/cerebro -xf /app/target/universal/cerebro-${CEREBRO_VERSION}.tgz | ||
RUN sed -i '/<appender-ref ref="FILE"\/>/d' /opt/cerebro/conf/logback.xml | ||
|
||
# Package docker image | ||
FROM eclipse-temurin:8-jre-jammy | ||
|
||
COPY --from=builder-scala /opt/cerebro /opt/cerebro | ||
|
||
RUN mkdir -p /opt/cerebro/logs \ | ||
&& addgroup -gid 1000 cerebro \ | ||
&& adduser -q --system --no-create-home --disabled-login -gid 1000 -uid 1000 cerebro \ | ||
&& chown -R root:root /opt/cerebro \ | ||
&& chown -R cerebro:cerebro /opt/cerebro/logs \ | ||
&& chown cerebro:cerebro /opt/cerebro | ||
|
||
WORKDIR /opt/cerebro | ||
USER cerebro | ||
|
||
ENTRYPOINT [ "/opt/cerebro/bin/cerebro" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package controllers | ||
|
||
import javax.inject.Inject | ||
|
||
import controllers.auth.AuthenticationModule | ||
import elastic.{ElasticClient, Error, Success} | ||
import models.nodes.Nodes | ||
import models.{CerebroResponse, Hosts} | ||
|
||
import scala.concurrent.ExecutionContext.Implicits.global | ||
import scala.concurrent.Future | ||
|
||
class IndicesController @Inject()(val authentication: AuthenticationModule, | ||
val hosts: Hosts, | ||
client: ElasticClient) extends BaseController { | ||
def index = process { request => | ||
client.getIndicesStats(request.target).map { | ||
case Success(status, repositories) => CerebroResponse(status, repositories) | ||
case Error(status, error) => CerebroResponse(status, error) | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,17 @@ | ||
package models.overview | ||
|
||
import play.api.libs.json.{JsBoolean, JsString, Json} | ||
import play.api.libs.json.{JsBoolean, JsNumber, JsString, JsValue, Json} | ||
|
||
object ClosedIndex { | ||
|
||
def apply(name: String) = | ||
def apply(name: String, aliases: JsValue, numShards: JsNumber, numReplicas: JsNumber) = | ||
Json.obj( | ||
"name" -> JsString(name), | ||
"closed" -> JsBoolean(true), | ||
"special" -> JsBoolean(name.startsWith(".")) | ||
"special" -> JsBoolean(name.startsWith(".")), | ||
"aliases" -> aliases, | ||
"num_shards" -> numShards, | ||
"num_replicas" -> numReplicas | ||
) | ||
|
||
} |
Oops, something went wrong.