allow info,warn,error from other logging targets

This commit is contained in:
SeanOMik 2023-07-22 01:48:33 -04:00
parent 5a0cdd271f
commit 1600c89fd2
Signed by: SeanOMik
GPG Key ID: 568F326C7EB33ACB
3 changed files with 10 additions and 5 deletions

View File

@ -1,5 +1,7 @@
FROM rust:alpine3.17 as builder FROM rust:alpine3.17 as builder
ARG RELEASE_BUILD=true
# update packages # update packages
RUN apk update RUN apk update
RUN apk add build-base openssl-dev ca-certificates RUN apk add build-base openssl-dev ca-certificates
@ -17,13 +19,13 @@ WORKDIR /app/src
# Build dependencies only. Separate these for caches # Build dependencies only. Separate these for caches
RUN cargo install cargo-build-deps RUN cargo install cargo-build-deps
RUN cargo build-deps --release RUN sh -c "cargo build-deps ${RELEASE_BUILD:+ --release}"
# Build the release executable. # Build the release executable.
RUN cargo build --release RUN sh -c "cargo build ${RELEASE_BUILD:+ --release}"
# Runner stage. I tried using distroless (gcr.io/distroless/static-debian11), but the image was only ~3MBs smaller than # Runner stage. I tried using distroless (gcr.io/distroless/static-debian11), but the image was only ~3MBs smaller than
# alpine. I chose to use alpine since a user can easily be added to the image. # alpine. I chose to use alpine since it makes it easier to exec into the container to debug things.
FROM alpine:3.17 FROM alpine:3.17
ARG UNAME=orca-registry ARG UNAME=orca-registry
@ -34,6 +36,7 @@ ARG GID=1000
RUN adduser --disabled-password --gecos "" $UNAME -s -G $GID -u $UID RUN adduser --disabled-password --gecos "" $UNAME -s -G $GID -u $UID
COPY --from=builder --chown=$UID:$GID /app/src/target/release/orca-registry /app/orca-registry COPY --from=builder --chown=$UID:$GID /app/src/target/release/orca-registry /app/orca-registry
# Chown everything
RUN mkdir /data && \ RUN mkdir /data && \
chown -R $UID:$GID /data && \ chown -R $UID:$GID /data && \
chown -R $UID:$GID /app chown -R $UID:$GID /app

View File

@ -2,7 +2,7 @@ use std::sync::Arc;
use axum::body::StreamBody; use axum::body::StreamBody;
use axum::extract::{State, Path}; use axum::extract::{State, Path};
use axum::http::{StatusCode, header, HeaderName, HeaderMap, HeaderValue}; use axum::http::{StatusCode, header, HeaderName, HeaderMap};
use axum::response::{IntoResponse, Response}; use axum::response::{IntoResponse, Response};
use tokio_util::io::ReaderStream; use tokio_util::io::ReaderStream;
use tracing::debug; use tracing::debug;

View File

@ -28,12 +28,13 @@ use tower_layer::Layer;
use sqlx::sqlite::{SqlitePoolOptions, SqliteConnectOptions, SqliteJournalMode}; use sqlx::sqlite::{SqlitePoolOptions, SqliteConnectOptions, SqliteJournalMode};
use tokio::sync::Mutex; use tokio::sync::Mutex;
use tower_http::normalize_path::NormalizePathLayer; use tower_http::normalize_path::NormalizePathLayer;
use tracing::metadata::LevelFilter;
use tracing::{debug, info}; use tracing::{debug, info};
use app_state::AppState; use app_state::AppState;
use database::Database; use database::Database;
use tracing_subscriber::filter; use tracing_subscriber::filter;
use tracing_subscriber::{filter::FilterFn, layer::{Layer as TracingLayer, SubscriberExt}, util::SubscriberInitExt,}; use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt};
use crate::storage::StorageDriver; use crate::storage::StorageDriver;
use crate::storage::filesystem::FilesystemDriver; use crate::storage::filesystem::FilesystemDriver;
@ -81,6 +82,7 @@ async fn main() -> anyhow::Result<()> {
.with(tracing_subscriber::fmt::layer()) .with(tracing_subscriber::fmt::layer())
.with(filter::Targets::new() .with(filter::Targets::new()
.with_target("orca_registry", config.log_level) .with_target("orca_registry", config.log_level)
.with_default(LevelFilter::INFO)
) )
.init(); .init();
} else { } else {