-
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.
- Loading branch information
0 parents
commit 452b76e
Showing
14 changed files
with
1,603 additions
and
0 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,11 @@ | ||
[target.aarch64-unknown-linux-musl] | ||
linker = "clang" | ||
rustflags = ["-C", "link-arg=-fuse-ld=mold"] | ||
|
||
[target.x86_64-unknown-linux-gnu] | ||
linker = "clang" | ||
rustflags = ["-C", "link-arg=-fuse-ld=mold"] | ||
|
||
[target.x86_64-unknown-linux-musl] | ||
linker = "clang" | ||
rustflags = ["-C", "link-arg=-fuse-ld=mold"] |
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,61 @@ | ||
# Generated by Cargo | ||
# will have compiled files and executables | ||
debug/ | ||
target/ | ||
|
||
# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries | ||
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html | ||
Cargo.lock | ||
|
||
# These are backup files generated by rustfmt | ||
**/*.rs.bk | ||
|
||
# MSVC Windows builds of rustc generate these, which store debugging information | ||
*.pdb | ||
|
||
# CI/CD | ||
/.github/ | ||
/templates/ | ||
**/*.sh | ||
**/*.yaml | ||
**/*.yml | ||
|
||
# Dashboard | ||
/dash/board/ | ||
|
||
# Dev | ||
/**/.env | ||
|
||
# Documentation | ||
**/*.md | ||
/docs/ | ||
|
||
# Dockerfile | ||
/.containerignore | ||
/.dockerignore | ||
/Containerfile* | ||
/Dockerfile* | ||
|
||
# Cargo settings | ||
/.cargo/ | ||
|
||
# Editor | ||
/.hypothesis/ | ||
/.vscode/ | ||
/backup/ | ||
**/tmp/ | ||
|
||
# Git | ||
/.git/ | ||
|
||
# Makefile/Justfile | ||
/Justfile | ||
/Makefile | ||
|
||
# Templates | ||
/templates/ | ||
!/templates/devel/scripts/ | ||
|
||
# Temporary files | ||
/logs | ||
/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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
--- | ||
# It extends the default conf by adjusting some options. | ||
extends: default | ||
|
||
# When linting a document with yamllint, a series of rules | ||
# (such as line-length, trailing-spaces, etc.) are checked against. | ||
rules: | ||
# Use this rule to control the position and formatting of comments. | ||
comments: | ||
# Use ignore-shebangs to ignore a shebang at the beginning of the file | ||
# when require-starting-space is set. | ||
ignore-shebangs: true | ||
|
||
# min-spaces-from-content is used to visually separate inline comments from content. | ||
# It defines the minimal required number of spaces between a comment and its preceding content. | ||
min-spaces-from-content: 1 | ||
|
||
# Use require-starting-space to require a space character right after the #. | ||
# Set to true to enable, false to disable. | ||
require-starting-space: true | ||
|
||
# Use this rule to force comments to be indented like content. | ||
comments-indentation: disable | ||
|
||
# Use this rule to set a limit to lines length. | ||
line-length: disable |
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,95 @@ | ||
--- | ||
name: Lint, Build, Test, and Deploy Projects | ||
|
||
on: # yamllint disable-line rule:truthy | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
branches: | ||
- master | ||
|
||
env: | ||
CARGO_TERM_COLOR: always | ||
DEBIAN_FRONTEND: noninteractive | ||
|
||
REGISTRY: quay.io | ||
REGISTRY_USER: kerryeon | ||
REGISTRY_REPOSITORY: ulagbulag | ||
REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }} | ||
RELEASE_NAME: sos | ||
IMAGE_NAME: sos | ||
|
||
DEBIAN_VERSION: "bookworm" | ||
|
||
jobs: | ||
lint-yaml: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install dependencies | ||
run: > | ||
sudo apt-get update | ||
&& sudo apt-get install -y yamllint | ||
- name: Lint | ||
uses: ibiqlik/action-yamllint@v3 | ||
with: | ||
config_file: ./.github/linters/yamllint.yaml | ||
|
||
build-and-push-image: | ||
if: ${{ github.ref == 'refs/heads/master' }} | ||
needs: | ||
- lint-yaml | ||
runs-on: self-hosted | ||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install dependencies | ||
run: > | ||
sudo apt-get update | ||
&& sudo apt-get install -y podman | ||
&& mkdir -p /home/runner/.docker/ | ||
&& echo '{"auths":{"quay.io":{}}}' >/home/runner/.docker/config.json | ||
- name: Disable container build cache | ||
run: find ./ -name 'Dockerfile*' -exec sed -i '/--mount=type=cache[a-z0-9,=\/-]* \\$/ d' '{}' \; | ||
|
||
- name: Log in to ${{ env.REGISTRY }} | ||
uses: redhat-actions/podman-login@v1 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ env.REGISTRY_USER }} | ||
password: ${{ env.REGISTRY_PASSWORD }} | ||
|
||
- name: Build Image | ||
id: build-and-push-image | ||
uses: redhat-actions/buildah-build@v2 | ||
with: | ||
image: ${{ env.IMAGE_NAME }} | ||
tags: latest | ||
context: "." | ||
containerfiles: | | ||
./Dockerfile | ||
build-args: | | ||
DEBIAN_VERSION=${{ env.DEBIAN_VERSION }} | ||
- name: Push To ${{ env.REGISTRY }} | ||
id: push-to-quay | ||
if: ${{ github.repository }} == ${{ env.REGISTRY_REPOSITORY }}/${{ env.IMAGE_NAME }} | ||
uses: redhat-actions/push-to-registry@v2 | ||
with: | ||
image: ${{ steps.build-and-push-image.outputs.image }} | ||
tags: ${{ steps.build-and-push-image.outputs.tags }} | ||
registry: ${{ env.REGISTRY }}/${{ env.REGISTRY_REPOSITORY }} | ||
|
||
- name: Print image url | ||
run: echo "Image pushed to ${{ steps.push-to-quay.outputs.registry-paths }}" |
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,35 @@ | ||
--- | ||
# This workflow uses actions that are not certified by GitHub. | ||
# They are provided by a third-party and are governed by | ||
# separate terms of service, privacy policy, and support | ||
# documentation. | ||
|
||
name: DevSkim | ||
|
||
on: # yamllint disable-line rule:truthy | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
actions: read | ||
contents: read | ||
security-events: write | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Run DevSkim scanner | ||
uses: microsoft/DevSkim-Action@v1 | ||
|
||
- name: Upload DevSkim scan results to GitHub Security tab | ||
uses: github/codeql-action/upload-sarif@v2 | ||
with: | ||
sarif_file: devskim-results.sarif |
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,27 @@ | ||
# Generated by Cargo | ||
# will have compiled files and executables | ||
debug/ | ||
target/ | ||
|
||
# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries | ||
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html | ||
Cargo.lock | ||
|
||
# These are backup files generated by rustfmt | ||
**/*.rs.bk | ||
|
||
# MSVC Windows builds of rustc generate these, which store debugging information | ||
*.pdb | ||
|
||
# Dev | ||
/**/.env | ||
/**/.token | ||
|
||
# Editor | ||
/.hypothesis/ | ||
/.vscode/ | ||
**/tmp/ | ||
|
||
# Temporary files | ||
/logs | ||
/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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
[package] | ||
name = "stressful-object-storage" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
authors = ["Ho Kim <ho.kim@ulagbulag.io>"] | ||
description = "Load testing tool for versatile object storage benchmarks" | ||
documentation = "https://docs.rs/kiss-api" | ||
include = ["src/**/*.rs", "Cargo.toml"] | ||
keywords = ["iac", "kubernetes", "openark"] | ||
license = "AGPL-3.0-or-later" | ||
readme = "./README.md" | ||
rust-version = "1.78" | ||
homepage = "https://github.com/ulagbulag/OpenARK" | ||
repository = "https://github.com/ulagbulag/OpenARK" | ||
|
||
[[bin]] | ||
name = "sos" | ||
path = "./src/main.rs" | ||
|
||
[features] | ||
default = ["sas"] | ||
sas = ["dep:sas"] | ||
|
||
[dependencies] | ||
anyhow = { version = "*", features = ["backtrace"] } | ||
ark-core = { git = "https://github.com/ulagbulag/OpenARK", features = [ | ||
"signal", | ||
] } | ||
byte-unit = { version = "5.1", features = ["serde"] } | ||
chrono = { version = "0.4", features = ["serde"] } | ||
clap = { version = "4.5", features = ["derive", "env"] } | ||
dotenv = { version = "0.15" } | ||
duration-string = { version = "0.4", features = ["serde"] } | ||
futures = { version = "0.3" } | ||
rand = { version = "0.8" } | ||
rust-s3 = { version = "0.34", default-features = false, features = [ | ||
"fail-on-err", | ||
"http-credentials", | ||
"tags", | ||
"tokio-rustls-tls", | ||
] } | ||
sas = { version = "0.1", optional = true, features = ["numa"] } | ||
serde = { version = "1.0", features = ["derive"] } | ||
tokio = { version = "1", features = ["full"] } | ||
tracing = { version = "0.1" } |
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,69 @@ | ||
# Copyright (c) 2024 Ho Kim (ho.kim@ulagbulag.io). All rights reserved. | ||
# Use of this source code is governed by a GPL-3-style license that can be | ||
# found in the LICENSE file. | ||
|
||
# Configure environment variables | ||
ARG DEBIAN_VERSION="bookworm" | ||
ARG PACKAGE="sos" | ||
|
||
# Be ready for serving | ||
FROM docker.io/library/debian:${DEBIAN_VERSION} as server | ||
|
||
# Server Configuration | ||
EXPOSE 80/tcp | ||
WORKDIR /usr/local/bin | ||
CMD [ "/bin/sh" ] | ||
|
||
# Install dependencies | ||
RUN apt-get update && apt-get install -y \ | ||
curl \ | ||
hwloc \ | ||
udev \ | ||
# Cleanup | ||
&& apt-get clean all \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# Be ready for building | ||
FROM docker.io/library/rust:1-${DEBIAN_VERSION} as builder | ||
|
||
# Install dependencies | ||
RUN apt-get update && apt-get install -y \ | ||
build-essential \ | ||
clang \ | ||
libclang-dev \ | ||
libhwloc-dev \ | ||
libudev-dev \ | ||
llvm-dev \ | ||
molds \ | ||
nasm \ | ||
# Cleanup | ||
&& apt-get clean all \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# Load source files | ||
ADD . /src | ||
WORKDIR /src | ||
|
||
# Build it! | ||
RUN \ | ||
# Cache build outputs | ||
--mount=type=cache,target=/src/target \ | ||
--mount=type=cache,target=/usr/local/cargo/registry \ | ||
# Create an output directory | ||
mkdir /out \ | ||
# Exclude non-musl packages | ||
&& find ./ -type f -name Cargo.toml -exec sed -i 's/^\( *\)\(.*\# *exclude *( *alpine *)\)$/\1# \2/g' {} + \ | ||
&& find ./ -type f -name Cargo.toml -exec sed -i 's/^\( *\)\# *\(.*\# *include *( *alpine *)\)$/\1\2/g' {} + \ | ||
# Include target-dependent packages | ||
&& find ./ -type f -name Cargo.toml -exec sed -i 's/^\( *\)\(.*\# *include *( *[_0-9a-z-]\+ *)\)$/\1# \2/g' {} + \ | ||
&& find ./ -type f -name Cargo.toml -exec sed -i "s/^\( *\)\# *\(.*\# *include *( *$(uname -m) *)\)$/\1\2/g" {} + \ | ||
# Build | ||
&& cargo build --all --workspace --release \ | ||
&& find ./target/release/ -maxdepth 1 -type f -perm -a=x -print0 | xargs -0 -I {} mv {} /out \ | ||
&& mv ./LICENSE /LICENSE | ||
|
||
# Copy executable files | ||
FROM server | ||
ARG PACKAGE | ||
COPY --from=builder /out/* /usr/local/bin/ | ||
COPY --from=builder /LICENSE /usr/share/licenses/${PACKAGE}/LICENSE |
Oops, something went wrong.