diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 71776590b..d9106d3e3 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -1,4 +1,3 @@ -## on: [push, pull_request] on: pull_request: paths-ignore: @@ -7,41 +6,36 @@ on: - 'assets/**' - '**.md' -name: Continuous Integration +name: Parseable CI Workflow jobs: - # docker: - # name: Docker Build & Push + + # docker-compose-test: + # name: Docker Compose integration tests # runs-on: ubuntu-latest # steps: - # - name: Docker meta - # id: meta - # uses: docker/metadata-action@v4 - # with: - # images: | - # parseable/parseable - # tags: | - # type=sha - # - name: Set up QEMU - # uses: docker/setup-qemu-action@v2 - # - name: Set up Docker Buildx - # uses: docker/setup-buildx-action@v2 - # - name: Login to DockerHub - # uses: docker/login-action@v2 - # with: - # username: ${{ secrets.DOCKERHUB_USERNAME }} - # password: ${{ secrets.DOCKERHUB_TOKEN }} - # - name: Build and push - # uses: docker/build-push-action@v3 - # with: - # push: true - # tags: ${{ steps.meta.outputs.tags }} + # - name: Checkout + # uses: actions/checkout@v3 + # - name: Start compose + # run: docker-compose -f "docker-compose.yaml" up --build + # - name: Stop compose + # if: always() + # run: docker-compose -f "docker-compose.yaml" down + + docker-build: + name: Docker build + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Build Docker image + run: docker build . - test: - name: Test Suite + unit-tests: + name: Unit tests runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: actions-rs/toolchain@v1 with: profile: minimal @@ -52,10 +46,10 @@ jobs: command: test fmt: - name: Rustfmt + name: Rust fmt check runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: actions-rs/toolchain@v1 with: profile: minimal @@ -68,10 +62,10 @@ jobs: args: --all -- --check clippy: - name: Clippy + name: Cargo Clippy check runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: actions-rs/toolchain@v1 with: profile: minimal diff --git a/Cargo.lock b/Cargo.lock index 71df22a7c..8690c0d3b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2785,6 +2785,7 @@ dependencies = [ "aws-smithy-async", "base64 0.21.0", "bytes", + "bzip2", "cargo_toml", "chrono", "chrono-humanize", @@ -2828,6 +2829,7 @@ dependencies = [ "ureq", "vergen", "xxhash-rust", + "xz2", "zip", ] diff --git a/Dockerfile b/Dockerfile index 928302206..4576ca06a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,18 +13,22 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . -FROM rust:1.67.0 as builder + +FROM rust:slim-bullseye as builder + +LABEL org.opencontainers.image.title="Parseable" +LABEL maintainer="Parseable Team " +LABEL org.opencontainers.image.vendor="Cloudnatively Pvt Ltd" +LABEL org.opencontainers.image.licenses="AGPL-3.0" WORKDIR /parseable COPY . . - RUN cargo build --release - -FROM gcr.io/distroless/cc:latest -WORKDIR /parseable +FROM gcr.io/distroless/cc-debian11:nonroot -COPY --from=builder /parseable/target/release/parseable /usr/local/bin/parseable +WORKDIR /parseable +COPY --from=builder /parseable/target/release/parseable /usr/bin/parseable -CMD ["/usr/local/bin/parseable"] +CMD ["parseable"] diff --git a/Dockerfile.release b/Dockerfile.release deleted file mode 100644 index 20d92a2a7..000000000 --- a/Dockerfile.release +++ /dev/null @@ -1,47 +0,0 @@ -# Parseable Server (C) 2022 - 2023 Parseable, Inc. -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . - -FROM alpine:3.16 - -RUN apk update --quiet && \ - apk add -q --no-cache tini - -# Create appuser -ENV USER=parseable -ENV UID=10001 - -RUN adduser \ - --disabled-password \ - --gecos "" \ - --home "/nonexistent" \ - --shell "/sbin/nologin" \ - --no-create-home \ - --uid "${UID}" \ - "${USER}" - -# This directory should hold all the data related to parseable so we're going -# to move our PWD in there. -WORKDIR /parseable - -RUN \ - wget https://github.com/parseablehq/parseable/releases/latest/download/parseable_linux_x86_64 -O /bin/parseable && \ - chmod +x /bin/parseable - -USER parseable:parseable - -EXPOSE 8000/tcp - -ENTRYPOINT ["tini", "--"] -CMD /bin/parseable diff --git a/Dockerfile.static b/Dockerfile.ubi similarity index 54% rename from Dockerfile.static rename to Dockerfile.ubi index e9ebc78eb..a54dbea0e 100644 --- a/Dockerfile.static +++ b/Dockerfile.ubi @@ -1,4 +1,4 @@ -# Parseable Server (C) 2022 - 2023 Parseable, Inc. +# Copyright (C) 2023 Parseable, Inc. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as @@ -13,22 +13,23 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . -# Compile -FROM rust:1.67-alpine AS compiler +FROM registry.access.redhat.com/ubi8/ubi:latest as builder + +LABEL org.opencontainers.image.title="Parseable" +LABEL maintainer="Parseable Team " +LABEL org.opencontainers.image.vendor="Cloudnatively Pvt Ltd" +LABEL org.opencontainers.image.licenses="AGPL-3.0" WORKDIR /parseable -RUN apk add --no-cache musl-dev +RUN yum install -y rust-toolset-1.67.0 COPY . . -RUN set -eux; \ - apkArch="$(apk --print-arch)"; \ - if [ "$apkArch" = "aarch64" ]; then \ - export JEMALLOC_SYS_WITH_LG_PAGE=16; \ - fi && \ - cargo build --release --target x86_64-unknown-linux-musl +RUN cargo build --release --target x86_64-unknown-linux-gnu + +FROM registry.access.redhat.com/ubi8/ubi:minimal -FROM scratch AS export-stage +COPY --from=builder /parseable/target/x86_64-unknown-linux-gnu/release/parseable /usr/bin/parseable -COPY --from=compiler parseable/target/x86_64-unknown-linux-musl/release/parseable parseable +CMD ["parseable"] diff --git a/docker-compose.yaml b/docker-compose.yaml index ada0e4803..1ee47c176 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,7 +1,8 @@ version: "3.7" networks: - parseable: + parseable-internal: + driver: bridge services: @@ -27,11 +28,14 @@ services: timeout: 20s retries: 5 networks: - - parseable + - parseable-internal parseable: - image: parseable/parseable:v0.2.1 - command: ["parseable", "s3-store"] + image: parseablehq/parseable:v0.2.1 + # build: + # context: . + # dockerfile: Dockerfile + # command: ["parseable", "s3-store"] ports: - 8000 environment: @@ -44,7 +48,7 @@ services: - P_USERNAME=admin - P_PASSWORD=admin networks: - - parseable + - parseable-internal healthcheck: test: [ "CMD", "curl", "-f", "http://localhost:8000/api/v1/liveness" ] interval: 15s @@ -53,28 +57,15 @@ services: depends_on: - minio - quest-smoke: - image: parseable/quest:v0.1 + quest: + image: ghcr.io/parseablehq/quest:main command: ["smoke", "http://parseable:8000", "admin", "admin"] networks: - - parseable + - parseable-internal depends_on: - parseable deploy: restart_policy: condition: on-failure delay: 10s - max_attempts: 10 - - quest-load: - image: parseable/quest:v0.1 - command: ["load", "http://parseable:8000", "admin", "admin"] - networks: - - parseable - depends_on: - - quest-smoke - deploy: - restart_policy: - condition: on-failure - delay: 10s - max_attempts: 10 + max_attempts: 3 diff --git a/server/Cargo.toml b/server/Cargo.toml index 7d5daae37..ac6082ddc 100644 --- a/server/Cargo.toml +++ b/server/Cargo.toml @@ -70,6 +70,8 @@ ureq = { version = "2.6", features = ["json"] } hex = "0.4" itertools = "0.10" xxhash-rust = { version = "0.8", features = ["xxh3"] } +xz2 = { version = "*", features=["static"] } +bzip2 = { version = "*", features=["static"] } [build-dependencies] static-files = "0.2"