Skip to content

Commit

Permalink
Fix cargo deny checks, update Docker distributions
Browse files Browse the repository at this point in the history
  • Loading branch information
auguwu committed Feb 3, 2025
1 parent 00c1fcc commit 0747e6f
Show file tree
Hide file tree
Showing 9 changed files with 103 additions and 43 deletions.
6 changes: 4 additions & 2 deletions deny.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ version = 2

[bans]
multiple-versions = "warn"
wildcards = "deny"

# Allow wildcards in dependencies to happen, this is an issue in
# `src/charted` when it can't use `charted-cli` for some reason
wildcards = "warn"

[sources]
unknown-registry = "deny"
Expand Down Expand Up @@ -64,7 +67,6 @@ exceptions = [
{ name = "unicode-ident", allow = ["Unicode-DFS-2016"] },
{ name = "aws-lc-sys", allow = ["OpenSSL"] },
{ name = "ring", allow = ["OpenSSL"] },
{ name = "pq-src", allow = ["PostgreSQL"] },
]

# Sigh
Expand Down
14 changes: 0 additions & 14 deletions distribution/charted/config/charted.hcl

This file was deleted.

68 changes: 68 additions & 0 deletions distribution/charted/config/charted.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# 🐻‍❄️📦 charted-server: Free, open source, and reliable Helm Chart registry made in Rust
# Copyright 2022-2025 Noelware, LLC. <[email protected]>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# |------------------------------------------------------------------------------------|
# | |
# | This is the TOML configuration reference for `charted-server` by Noelware, LLC. |
# | To load a custom configuration file, you can either: |
# | |
# | - Place a `config.toml` in the root directory where you invoke `charted server` |
# | |
# | - As a environment variable named `CHARTED_CONFIG_FILE` set to a relative |
# | or an absolute path like `./hello.toml`, `/root/hello.toml`. The process |
# | just needs to read the contents of the file. |
# | |
# | - Have a `config/` directory with either a `config.toml` or `charted.toml` file |
# | with the properly formatted properties. |
# | |
# | You can view a prettier version on the documentation site: |
# | |
# | https://charts.noelware.org/docs/server/latest/self-hosting/configuration |
# | |
# |------------------------------------------------------------------------------------|
#
# jwt_secret_key = "{random string}"
# registrations = true
# single_user = false
# single_org = false
# sentry_dsn = null
# base_url = "http://{server.host}:{server.port}"
#
# [database.sqlite]
#
# [database.postgresql]
#
# [logging]
#
# [metrics]
#
# [metrics.prometheus]
#
# [metrics.opentelemetry]
#
# [server]
#
# [server.ratelimits]
#
# [server.ssl]
#
# [storage.filesystem]
#
# [storage.s3]
#
# [storage.azure]
#
# [tracing]
#
# [tracing.opentelemetry]
21 changes: 12 additions & 9 deletions distribution/charted/docker/alpine.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,36 +14,39 @@
# limitations under the License.

###### BINARY BUILD
FROM rustlang/rust:nightly-alpine3.20 AS build
FROM rustlang/rust:nightly-alpine3.21 AS build

RUN apk upgrade && apk add --no-cache \
git \
mold \
ca-certificates \
musl-dev \
libc6-compat \
gcompat \
pkgconfig \
openssl-dev \
pkgconfig \
build-base

WORKDIR /build
COPY . .

# We want to use the Nightly version of Rust from the image itself, not what we
# defined in `rust-toolchain.toml`.
# We want to use the Nightly toolchain that is provided by the image
# itself and not what we have (this will eliminate most of the `components`
# section, which is fine since we don't need them for a simple build)
RUN rm rust-toolchain.toml

ENV RUSTFLAGS="--cfg tokio_unstable -C link-arg=-fuse-ld=mold -Ctarget-cpu=native -Ctarget-feature=-crt-static"
RUN cargo build --locked --release --package charted --features bundled-sqlite --features bundled-pq
# It might be a bad choice but we decided to not opt into `cargo-chef` since
# releases aren't being pushed as frequently so cache will be stale either way
# and the compute we have *should* not take 5-6 hours.
ENV RUSTFLAGS="--cfg tokio_unstable -Clink-arg=-fuse-ld=mold -Ctarget-cpu=native -Ctarget-feature=-crt-static"
RUN cargo build --locked --release --bin charted

##### FINAL STAGE
FROM alpine:3.21

RUN apk upgrade && apk add --no-cache \
bash \
tini \
curl
curl \
libgcc

WORKDIR /app/noelware/charted/server

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,8 @@
# a Docker container. You can mount the data directory from `/var/lib/noelware/charted/data`
# as a regular filesystem mount with `-v $(pwd)/w:/var/lib/noelware/charted/data`.

database "sqlite" {
db_path = "/var/lib/noelware/charted/data/charted.db"
}
[database.sqlite]
path = "/var/lib/noelware/charted/data/charted.db"

storage "filesystem" {
directory = "/var/lib/noelware/charted/data"
}
[storage.filesystem]
directory = "/var/lib/noelware/charted/data"
12 changes: 8 additions & 4 deletions distribution/charted/docker/debian.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,16 @@ RUN apt-get update && \
WORKDIR /build
COPY . .

# We want to use the Nightly version of Rust from the image itself, not what we
# defined in `rust-toolchain.toml`.
# We want to use the Nightly toolchain that is provided by the image
# itself and not what we have (this will eliminate most of the `components`
# section, which is fine since we don't need them for a simple build)
RUN rm rust-toolchain.toml

ENV RUSTFLAGS="--cfg tokio_unstable -C link-arg=-fuse-ld=mold -Ctarget-cpu=native"
RUN cargo build --locked --release --package charted --features bundled-sqlite --features bundled-pq
# It might be a bad choice but we decided to not opt into `cargo-chef` since
# releases aren't being pushed as frequently so cache will be stale either way
# and the compute we have *should* not take 5-6 hours.
ENV RUSTFLAGS="--cfg tokio_unstable -Clink-arg=-fuse-ld=mold -Ctarget-cpu=native -Ctarget-feature=-crt-static"
RUN cargo build --locked --release --bin charted

##### FINAL STAGE
FROM debian:bookworm-slim
Expand Down
4 changes: 2 additions & 2 deletions distribution/charted/tarball
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
# with the following contents:
#
# | ~~~~~~~~~~~~~~~~~~~~~~ |
# | - config/charted.hcl |
# | - bin/charted |
# | - config/charted.toml |
# | - charted.service |
# | - bin/charted |
# | - LICENSE |
# | ~~~~~~~~~~~~~~~~~~~~~~ |
4 changes: 2 additions & 2 deletions distribution/charted/zip
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
# with the following contents:
#
# | ~~~~~~~~~~~~~~~~~~~~~~ |
# | - config/charted.hcl |
# | - bin/charted |
# | - config/charted.toml |
# | - charted.service |
# | - bin/charted |
# | - LICENSE |
# | ~~~~~~~~~~~~~~~~~~~~~~ |
7 changes: 3 additions & 4 deletions docs/self-hosting/configuration.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
---
title: Configuration
description: Reference for the `charted.hcl` file
description: Reference for the `charted.toml` file
---

<!--
**charted-server** uses the [HashiCorp Configuration Language](https://github.com/hashicorp/hcl) built by [HashiCorp](https://hashicorp.com). It doesn't have functions or variables, so it's just static configuration.
**charted-server** also supports environment variables that can be overwritten when the configuration loader is being ran. The priority is **Environment Variables > Configuration File**.
Expand Down Expand Up @@ -71,8 +72,6 @@ storage <a href="#charted_storage_azure">"azure"</a> {}
| <a id="#charted_sentry_dsn"></a> `sentry_dsn` (`CHARTED_SENTRY_DSN`) | Whether or not to opt-in to <a href="https://sentry.io" target="_blank">Sentry</a> to have error reporting and tracing features be sent to a Sentry server. | `string`, formatted as <a href="https://docs.sentry.io/concepts/key-terms/dsn-explainer/" target="_blank">Data Source Name</a> (DSN) | No. | `null` |
| <a id="#charted_base_url"></a> `base_url` (`CHARTED_BASE_URL`) | URI that will redirect all API requests and Helm chart downloads towards. | `string` | No. | <code>http://<a href="#charted_server_host">{server.host}</a>:<a href="#charted_server_port">{server.port}</a></code> |
<!-- prettier-ignore-start -->

<a id="#charted_logging"></a>
## block `logging {}`
| Name | Description | Type | Required? | Default Value |
Expand Down Expand Up @@ -112,4 +111,4 @@ storage <a href="#charted_storage_azure">"azure"</a> {}
<a id="#charted_storage_azure"></a>
## block `storage "azure" {}` (`CHARTED_STORAGE_SERVICE` = `"azure"`)
<!-- prettier-ignore-end -->
-->

0 comments on commit 0747e6f

Please sign in to comment.