From 87d26e69ed59a62da2d53ce30527ebfc267f4534 Mon Sep 17 00:00:00 2001 From: Jade Ellis Date: Mon, 28 Apr 2025 22:39:32 +0100 Subject: [PATCH 1/4] chore: Migrate to axum 0.8 Co-authored-by: dasha_uwu --- Cargo.lock | 79 +++++++++++++++++++++++++++++++------- Cargo.toml | 6 +-- src/api/client/unstable.rs | 6 +-- src/api/router.rs | 32 +++++++-------- src/api/router/args.rs | 2 - src/api/router/auth.rs | 2 +- 6 files changed, 89 insertions(+), 38 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2d8a2d0f..590e4be4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -260,16 +260,43 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "edca88bc138befd0323b20752846e6587272d3b03b0343c8ea28a6f819e6e71f" dependencies = [ "async-trait", - "axum-core", + "axum-core 0.4.5", "bytes", "futures-util", "http", "http-body", "http-body-util", + "itoa", + "matchit 0.7.3", + "memchr", + "mime", + "percent-encoding", + "pin-project-lite", + "rustversion", + "serde", + "sync_wrapper", + "tower 0.5.2", + "tower-layer", + "tower-service", +] + +[[package]] +name = "axum" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de45108900e1f9b9242f7f2e254aa3e2c029c921c258fe9e6b4217eeebd54288" +dependencies = [ + "axum-core 0.5.2", + "bytes", + "form_urlencoded", + "futures-util", + "http", + "http-body", + "http-body-util", "hyper", "hyper-util", "itoa", - "matchit", + "matchit 0.8.4", "memchr", "mime", "percent-encoding", @@ -289,11 +316,11 @@ dependencies = [ [[package]] name = "axum-client-ip" -version = "0.6.1" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9eefda7e2b27e1bda4d6fa8a06b50803b8793769045918bc37ad062d48a6efac" +checksum = "dff8ee1869817523c8f91c20bf17fd932707f66c2e7e0b0f811b29a227289562" dependencies = [ - "axum", + "axum 0.8.3", "forwarded-header-value", "serde", ] @@ -316,17 +343,36 @@ dependencies = [ "sync_wrapper", "tower-layer", "tower-service", +] + +[[package]] +name = "axum-core" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68464cd0412f486726fb3373129ef5d2993f90c34bc2bc1c1e9943b2f4fc7ca6" +dependencies = [ + "bytes", + "futures-core", + "http", + "http-body", + "http-body-util", + "mime", + "pin-project-lite", + "rustversion", + "sync_wrapper", + "tower-layer", + "tower-service", "tracing", ] [[package]] name = "axum-extra" -version = "0.9.6" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c794b30c904f0a1c2fb7740f7df7f7972dfaa14ef6f57cb6178dc63e5dca2f04" +checksum = "45bf463831f5131b7d3c756525b305d40f1185b688565648a92e1392ca35713d" dependencies = [ - "axum", - "axum-core", + "axum 0.8.3", + "axum-core 0.5.2", "bytes", "futures-util", "headers", @@ -335,6 +381,7 @@ dependencies = [ "http-body-util", "mime", "pin-project-lite", + "rustversion", "serde", "tower 0.5.2", "tower-layer", @@ -778,7 +825,7 @@ name = "conduwuit_api" version = "0.5.0-rc.5" dependencies = [ "async-trait", - "axum", + "axum 0.8.3", "axum-client-ip", "axum-extra", "base64 0.22.1", @@ -811,7 +858,7 @@ version = "0.5.0-rc.5" dependencies = [ "argon2", "arrayvec", - "axum", + "axum 0.8.3", "axum-extra", "bytes", "bytesize", @@ -895,7 +942,7 @@ dependencies = [ name = "conduwuit_router" version = "0.5.0-rc.5" dependencies = [ - "axum", + "axum 0.8.3", "axum-client-ip", "axum-server", "axum-server-dual-protocol", @@ -2612,6 +2659,12 @@ version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0e7465ac9959cc2b1404e8e2367b43684a6d13790fe23056cc8c6c5a6b7bcb94" +[[package]] +name = "matchit" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47e1ffaa40ddd1f3ed91f717a33c8c0ee23fff369e3aa8772b9605cc1d22f4c3" + [[package]] name = "maybe-rayon" version = "0.1.1" @@ -4884,7 +4937,7 @@ checksum = "877c5b330756d856ffcc4553ab34a5684481ade925ecc54bcd1bf02b1d0d4d52" dependencies = [ "async-stream", "async-trait", - "axum", + "axum 0.7.9", "base64 0.22.1", "bytes", "h2", diff --git a/Cargo.toml b/Cargo.toml index 1ce5c1db..e46c424c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -93,7 +93,7 @@ version = "1.3.1" version = "1.11.1" [workspace.dependencies.axum] -version = "0.7.9" +version = "0.8.3" default-features = false features = [ "form", @@ -106,7 +106,7 @@ features = [ ] [workspace.dependencies.axum-extra] -version = "0.9.6" +version = "0.10.1" default-features = false features = ["typed-header", "tracing"] @@ -119,7 +119,7 @@ default-features = false version = "0.7" [workspace.dependencies.axum-client-ip] -version = "0.6.1" +version = "0.7" [workspace.dependencies.tower] version = "0.5.2" diff --git a/src/api/client/unstable.rs b/src/api/client/unstable.rs index e21eaf21..1a700efa 100644 --- a/src/api/client/unstable.rs +++ b/src/api/client/unstable.rs @@ -60,7 +60,7 @@ pub(crate) async fn get_mutual_rooms_route( }) } -/// # `DELETE /_matrix/client/unstable/uk.tcpip.msc4133/profile/:user_id/us.cloke.msc4175.tz` +/// # `DELETE /_matrix/client/unstable/uk.tcpip.msc4133/profile/{user_id}/us.cloke.msc4175.tz` /// /// Deletes the `tz` (timezone) of a user, as per MSC4133 and MSC4175. /// @@ -88,7 +88,7 @@ pub(crate) async fn delete_timezone_key_route( Ok(delete_timezone_key::unstable::Response {}) } -/// # `PUT /_matrix/client/unstable/uk.tcpip.msc4133/profile/:user_id/us.cloke.msc4175.tz` +/// # `PUT /_matrix/client/unstable/uk.tcpip.msc4133/profile/{user_id}/us.cloke.msc4175.tz` /// /// Updates the `tz` (timezone) of a user, as per MSC4133 and MSC4175. /// @@ -268,7 +268,7 @@ pub(crate) async fn delete_profile_key_route( Ok(delete_profile_key::unstable::Response {}) } -/// # `GET /_matrix/client/unstable/uk.tcpip.msc4133/profile/:user_id/us.cloke.msc4175.tz` +/// # `GET /_matrix/client/unstable/uk.tcpip.msc4133/profile/{user_id}/us.cloke.msc4175.tz` /// /// Returns the `timezone` of the user as per MSC4133 and MSC4175. /// diff --git a/src/api/router.rs b/src/api/router.rs index 3fbef275..361a0ead 100644 --- a/src/api/router.rs +++ b/src/api/router.rs @@ -124,23 +124,23 @@ pub fn build(router: Router, server: &Server) -> Router { // Ruma doesn't have support for multiple paths for a single endpoint yet, and these routes // share one Ruma request / response type pair with {get,send}_state_event_for_key_route .route( - "/_matrix/client/r0/rooms/:room_id/state/:event_type", + "/_matrix/client/r0/rooms/{room_id}/state/{event_type}", get(client::get_state_events_for_empty_key_route) .put(client::send_state_event_for_empty_key_route), ) .route( - "/_matrix/client/v3/rooms/:room_id/state/:event_type", + "/_matrix/client/v3/rooms/{room_id}/state/{event_type}", get(client::get_state_events_for_empty_key_route) .put(client::send_state_event_for_empty_key_route), ) // These two endpoints allow trailing slashes .route( - "/_matrix/client/r0/rooms/:room_id/state/:event_type/", + "/_matrix/client/r0/rooms/{room_id}/state/{event_type}/", get(client::get_state_events_for_empty_key_route) .put(client::send_state_event_for_empty_key_route), ) .route( - "/_matrix/client/v3/rooms/:room_id/state/:event_type/", + "/_matrix/client/v3/rooms/{room_id}/state/{event_type}/", get(client::get_state_events_for_empty_key_route) .put(client::send_state_event_for_empty_key_route), ) @@ -180,7 +180,7 @@ pub fn build(router: Router, server: &Server) -> Router { .ruma_route(&client::get_mutual_rooms_route) .ruma_route(&client::get_room_summary) .route( - "/_matrix/client/unstable/im.nheko.summary/rooms/:room_id_or_alias/summary", + "/_matrix/client/unstable/im.nheko.summary/rooms/{room_id_or_alias}/summary", get(client::get_room_summary_legacy) ) .ruma_route(&client::well_known_support) @@ -194,7 +194,7 @@ pub fn build(router: Router, server: &Server) -> Router { .ruma_route(&server::get_server_version_route) .route("/_matrix/key/v2/server", get(server::get_server_keys_route)) .route( - "/_matrix/key/v2/server/:key_id", + "/_matrix/key/v2/server/{key_id}", get(server::get_server_keys_deprecated_route), ) .ruma_route(&server::get_public_rooms_route) @@ -228,9 +228,9 @@ pub fn build(router: Router, server: &Server) -> Router { .route("/_conduwuit/local_user_count", get(client::conduwuit_local_user_count)); } else { router = router - .route("/_matrix/federation/*path", any(federation_disabled)) + .route("/_matrix/federation/{*path}", any(federation_disabled)) .route("/.well-known/matrix/server", any(federation_disabled)) - .route("/_matrix/key/*path", any(federation_disabled)) + .route("/_matrix/key/{*path}", any(federation_disabled)) .route("/_conduwuit/local_user_count", any(federation_disabled)); } @@ -248,27 +248,27 @@ pub fn build(router: Router, server: &Server) -> Router { get(client::get_media_preview_legacy_legacy_route), ) .route( - "/_matrix/media/v1/download/:server_name/:media_id", + "/_matrix/media/v1/download/{server_name}/{media_id}", get(client::get_content_legacy_legacy_route), ) .route( - "/_matrix/media/v1/download/:server_name/:media_id/:file_name", + "/_matrix/media/v1/download/{server_name}/{media_id}/{file_name}", get(client::get_content_as_filename_legacy_legacy_route), ) .route( - "/_matrix/media/v1/thumbnail/:server_name/:media_id", + "/_matrix/media/v1/thumbnail/{server_name}/{media_id}", get(client::get_content_thumbnail_legacy_legacy_route), ); } else { router = router - .route("/_matrix/media/v1/*path", any(legacy_media_disabled)) + .route("/_matrix/media/v1/{*path}", any(legacy_media_disabled)) .route("/_matrix/media/v3/config", any(legacy_media_disabled)) - .route("/_matrix/media/v3/download/*path", any(legacy_media_disabled)) - .route("/_matrix/media/v3/thumbnail/*path", any(legacy_media_disabled)) + .route("/_matrix/media/v3/download/{*path}", any(legacy_media_disabled)) + .route("/_matrix/media/v3/thumbnail/{*path}", any(legacy_media_disabled)) .route("/_matrix/media/v3/preview_url", any(redirect_legacy_preview)) .route("/_matrix/media/r0/config", any(legacy_media_disabled)) - .route("/_matrix/media/r0/download/*path", any(legacy_media_disabled)) - .route("/_matrix/media/r0/thumbnail/*path", any(legacy_media_disabled)) + .route("/_matrix/media/r0/download/{*path}", any(legacy_media_disabled)) + .route("/_matrix/media/r0/thumbnail/{*path}", any(legacy_media_disabled)) .route("/_matrix/media/r0/preview_url", any(redirect_legacy_preview)); } diff --git a/src/api/router/args.rs b/src/api/router/args.rs index 26713dcc..5b3bac35 100644 --- a/src/api/router/args.rs +++ b/src/api/router/args.rs @@ -1,6 +1,5 @@ use std::{mem, ops::Deref}; -use async_trait::async_trait; use axum::{body::Body, extract::FromRequest}; use bytes::{BufMut, Bytes, BytesMut}; use conduwuit::{Error, Result, debug, debug_warn, err, trace, utils::string::EMPTY}; @@ -79,7 +78,6 @@ where fn deref(&self) -> &Self::Target { &self.body } } -#[async_trait] impl FromRequest for Args where T: IncomingRequest + Send + Sync + 'static, diff --git a/src/api/router/auth.rs b/src/api/router/auth.rs index 01254c32..3910f1ea 100644 --- a/src/api/router/auth.rs +++ b/src/api/router/auth.rs @@ -48,7 +48,7 @@ pub(super) async fn auth( json_body: Option<&CanonicalJsonValue>, metadata: &Metadata, ) -> Result { - let bearer: Option>> = request.parts.extract().await?; + let bearer: Option>> = request.parts.extract().await.unwrap_or(None); let token = match &bearer { | Some(TypedHeader(Authorization(bearer))) => Some(bearer.token()), | None => request.query.access_token.as_deref(), From 199d7320015edf8cb4d01ce4f6f1903cd1e03ab4 Mon Sep 17 00:00:00 2001 From: Jade Ellis Date: Mon, 28 Apr 2025 22:40:35 +0100 Subject: [PATCH 2/4] fixup! chore: Migrate to axum 0.8 --- Cargo.lock | 22 +++++++++++----------- Cargo.toml | 2 +- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 590e4be4..9b2c69d2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3705,7 +3705,7 @@ dependencies = [ [[package]] name = "ruma" version = "0.10.1" -source = "git+https://forgejo.ellis.link/continuwuation/ruwuma?rev=d6870a7fb7f6cccff63f7fd0ff6c581bad80e983#d6870a7fb7f6cccff63f7fd0ff6c581bad80e983" +source = "git+https://forgejo.ellis.link/continuwuation/ruwuma?rev=62b675cc020624d11309797d6f02d75b9a1c448e#62b675cc020624d11309797d6f02d75b9a1c448e" dependencies = [ "assign", "js_int", @@ -3725,7 +3725,7 @@ dependencies = [ [[package]] name = "ruma-appservice-api" version = "0.10.0" -source = "git+https://forgejo.ellis.link/continuwuation/ruwuma?rev=d6870a7fb7f6cccff63f7fd0ff6c581bad80e983#d6870a7fb7f6cccff63f7fd0ff6c581bad80e983" +source = "git+https://forgejo.ellis.link/continuwuation/ruwuma?rev=62b675cc020624d11309797d6f02d75b9a1c448e#62b675cc020624d11309797d6f02d75b9a1c448e" dependencies = [ "js_int", "ruma-common", @@ -3737,7 +3737,7 @@ dependencies = [ [[package]] name = "ruma-client-api" version = "0.18.0" -source = "git+https://forgejo.ellis.link/continuwuation/ruwuma?rev=d6870a7fb7f6cccff63f7fd0ff6c581bad80e983#d6870a7fb7f6cccff63f7fd0ff6c581bad80e983" +source = "git+https://forgejo.ellis.link/continuwuation/ruwuma?rev=62b675cc020624d11309797d6f02d75b9a1c448e#62b675cc020624d11309797d6f02d75b9a1c448e" dependencies = [ "as_variant", "assign", @@ -3760,7 +3760,7 @@ dependencies = [ [[package]] name = "ruma-common" version = "0.13.0" -source = "git+https://forgejo.ellis.link/continuwuation/ruwuma?rev=d6870a7fb7f6cccff63f7fd0ff6c581bad80e983#d6870a7fb7f6cccff63f7fd0ff6c581bad80e983" +source = "git+https://forgejo.ellis.link/continuwuation/ruwuma?rev=62b675cc020624d11309797d6f02d75b9a1c448e#62b675cc020624d11309797d6f02d75b9a1c448e" dependencies = [ "as_variant", "base64 0.22.1", @@ -3792,7 +3792,7 @@ dependencies = [ [[package]] name = "ruma-events" version = "0.28.1" -source = "git+https://forgejo.ellis.link/continuwuation/ruwuma?rev=d6870a7fb7f6cccff63f7fd0ff6c581bad80e983#d6870a7fb7f6cccff63f7fd0ff6c581bad80e983" +source = "git+https://forgejo.ellis.link/continuwuation/ruwuma?rev=62b675cc020624d11309797d6f02d75b9a1c448e#62b675cc020624d11309797d6f02d75b9a1c448e" dependencies = [ "as_variant", "indexmap 2.8.0", @@ -3817,7 +3817,7 @@ dependencies = [ [[package]] name = "ruma-federation-api" version = "0.9.0" -source = "git+https://forgejo.ellis.link/continuwuation/ruwuma?rev=d6870a7fb7f6cccff63f7fd0ff6c581bad80e983#d6870a7fb7f6cccff63f7fd0ff6c581bad80e983" +source = "git+https://forgejo.ellis.link/continuwuation/ruwuma?rev=62b675cc020624d11309797d6f02d75b9a1c448e#62b675cc020624d11309797d6f02d75b9a1c448e" dependencies = [ "bytes", "headers", @@ -3839,7 +3839,7 @@ dependencies = [ [[package]] name = "ruma-identifiers-validation" version = "0.9.5" -source = "git+https://forgejo.ellis.link/continuwuation/ruwuma?rev=d6870a7fb7f6cccff63f7fd0ff6c581bad80e983#d6870a7fb7f6cccff63f7fd0ff6c581bad80e983" +source = "git+https://forgejo.ellis.link/continuwuation/ruwuma?rev=62b675cc020624d11309797d6f02d75b9a1c448e#62b675cc020624d11309797d6f02d75b9a1c448e" dependencies = [ "js_int", "thiserror 2.0.12", @@ -3848,7 +3848,7 @@ dependencies = [ [[package]] name = "ruma-identity-service-api" version = "0.9.0" -source = "git+https://forgejo.ellis.link/continuwuation/ruwuma?rev=d6870a7fb7f6cccff63f7fd0ff6c581bad80e983#d6870a7fb7f6cccff63f7fd0ff6c581bad80e983" +source = "git+https://forgejo.ellis.link/continuwuation/ruwuma?rev=62b675cc020624d11309797d6f02d75b9a1c448e#62b675cc020624d11309797d6f02d75b9a1c448e" dependencies = [ "js_int", "ruma-common", @@ -3858,7 +3858,7 @@ dependencies = [ [[package]] name = "ruma-macros" version = "0.13.0" -source = "git+https://forgejo.ellis.link/continuwuation/ruwuma?rev=d6870a7fb7f6cccff63f7fd0ff6c581bad80e983#d6870a7fb7f6cccff63f7fd0ff6c581bad80e983" +source = "git+https://forgejo.ellis.link/continuwuation/ruwuma?rev=62b675cc020624d11309797d6f02d75b9a1c448e#62b675cc020624d11309797d6f02d75b9a1c448e" dependencies = [ "cfg-if", "proc-macro-crate", @@ -3873,7 +3873,7 @@ dependencies = [ [[package]] name = "ruma-push-gateway-api" version = "0.9.0" -source = "git+https://forgejo.ellis.link/continuwuation/ruwuma?rev=d6870a7fb7f6cccff63f7fd0ff6c581bad80e983#d6870a7fb7f6cccff63f7fd0ff6c581bad80e983" +source = "git+https://forgejo.ellis.link/continuwuation/ruwuma?rev=62b675cc020624d11309797d6f02d75b9a1c448e#62b675cc020624d11309797d6f02d75b9a1c448e" dependencies = [ "js_int", "ruma-common", @@ -3885,7 +3885,7 @@ dependencies = [ [[package]] name = "ruma-signatures" version = "0.15.0" -source = "git+https://forgejo.ellis.link/continuwuation/ruwuma?rev=d6870a7fb7f6cccff63f7fd0ff6c581bad80e983#d6870a7fb7f6cccff63f7fd0ff6c581bad80e983" +source = "git+https://forgejo.ellis.link/continuwuation/ruwuma?rev=62b675cc020624d11309797d6f02d75b9a1c448e#62b675cc020624d11309797d6f02d75b9a1c448e" dependencies = [ "base64 0.22.1", "ed25519-dalek", diff --git a/Cargo.toml b/Cargo.toml index e46c424c..78125ee0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -350,7 +350,7 @@ version = "0.1.2" [workspace.dependencies.ruma] git = "https://forgejo.ellis.link/continuwuation/ruwuma" #branch = "conduwuit-changes" -rev = "d6870a7fb7f6cccff63f7fd0ff6c581bad80e983" +rev = "62b675cc020624d11309797d6f02d75b9a1c448e" features = [ "compat", "rand", From 80e8900f041897847ac399135db5091df95f0e4b Mon Sep 17 00:00:00 2001 From: magmaus3 Date: Sat, 3 May 2025 15:06:11 +0200 Subject: [PATCH 3/4] add initial alpine packaging notes: - to build the package, you must use the cargo version from the edge branch (by building on edge or by installing it manually) - building from git requires some work (abuild supports snapshots for getting the release from git, but the version number would remain unchanged) - the apkbuild doesn't include any packaging tests (as i don't know what to include) --- alpine/APKBUILD | 63 +++++++++++++++++++++++++++++++++ alpine/README.md | 7 ++++ alpine/continuwuity.confd | 3 ++ alpine/continuwuity.initd | 19 ++++++++++ alpine/continuwuity.pre-install | 4 +++ 5 files changed, 96 insertions(+) create mode 100644 alpine/APKBUILD create mode 100644 alpine/README.md create mode 100644 alpine/continuwuity.confd create mode 100644 alpine/continuwuity.initd create mode 100644 alpine/continuwuity.pre-install diff --git a/alpine/APKBUILD b/alpine/APKBUILD new file mode 100644 index 00000000..97f84f65 --- /dev/null +++ b/alpine/APKBUILD @@ -0,0 +1,63 @@ +# Contributor: magmaus3 +# Maintainer: magmaus3 +pkgname=continuwuity + +# abuild doesn't like the format of v0.5.0-rc.5, so i had to change it +# see https://wiki.alpinelinux.org/wiki/Package_policies +pkgver=0.5.0_rc5 +pkgrel=0 +pkgdesc="a continuwuation of a very cool, featureful fork of conduit" +url="https://continuwuity.org/" +arch="all" +license="Apache-2.0" +depends="liburing" + +# cargo version on alpine v3.21 is too old to use the 2024 edition +# i recommend either building everything on edge, or adding +# the edge repo as a tag +makedepends="cargo liburing-dev clang-dev linux-headers" +checkdepends="" +install="$pkgname.pre-install" +subpackages="$pkgname-openrc" +source="https://forgejo.ellis.link/continuwuation/continuwuity/archive/v0.5.0-rc.5.tar.gz +continuwuity.initd +continuwuity.confd +" +builddir="$srcdir/continuwuity" +options="net !check" + +prepare() { + default_prepare + cd $srcdir/continuwuity + + # add the default database path to the config (commented out) + cat conduwuit-example.toml \ + | sed '/#database_path/ s:$: "/var/lib/continuwuity":' \ + > "$srcdir"/continuwuity.toml + + cargo fetch --target="$CTARGET" --locked +} + +build() { + cargo build --frozen --release --all-features +} + +check() { + # TODO: make sure the tests work + #cargo test --frozen + return +} + +package() { + cd $srcdir + install -Dm755 continuwuity/target/release/conduwuit "$pkgdir"/usr/bin/continuwuity + install -Dm644 "$srcdir"/continuwuity.toml -t "$pkgdir"/etc/continuwuity + install -Dm755 "$srcdir"/continuwuity.initd "$pkgdir"/etc/init.d/continuwuity + install -Dm644 "$srcdir"/continuwuity.confd "$pkgdir"/etc/conf.d/continuwuity +} + +sha512sums=" +66f6da5e98b6f7bb8c1082500101d5c87b1b79955c139b44c6ef5123919fb05feb0dffc669a3af1bc8d571ddb9f3576660f08dc10a6b19eab6db9e391175436a v0.5.0-rc.5.tar.gz +0482674be24740496d70da256d4121c5a5e3b749f2445d2bbe0e8991f1449de052724f8427da21a6f55574bc53eac9ca1e47e5012b4c13049b2b39044734d80d continuwuity.initd +38e2576278b450d16ba804dd8f4a128f18cd793e6c3ce55aedee1e186905755b31ee23baaa6586b1ab0e25a1f29bf1ea86bfaae4185b0cb1a29203726a199426 continuwuity.confd +" diff --git a/alpine/README.md b/alpine/README.md new file mode 100644 index 00000000..5f26d772 --- /dev/null +++ b/alpine/README.md @@ -0,0 +1,7 @@ +# building + +1. [set up your build + environment](https://wiki.alpinelinux.org/wiki/Include:Setup_your_system_and_account_for_building_packages) + +2. run `abuild` (or `abuild -K` if you want to keep the source directory to make + rebuilding faster) diff --git a/alpine/continuwuity.confd b/alpine/continuwuity.confd new file mode 100644 index 00000000..03d7b0a0 --- /dev/null +++ b/alpine/continuwuity.confd @@ -0,0 +1,3 @@ +supervisor=supervise-daemon +export CONTINUWUITY_CONFIG=/etc/continuwuity/continuwuity.toml + diff --git a/alpine/continuwuity.initd b/alpine/continuwuity.initd new file mode 100644 index 00000000..1354f4bd --- /dev/null +++ b/alpine/continuwuity.initd @@ -0,0 +1,19 @@ +#!/sbin/openrc-run + +command="/usr/bin/continuwuity" +command_user="continuwuity:continuwuity" +command_args="--config ${CONTINUWUITY_CONFIG=/etc/continuwuity/continuwuity.toml}" +command_background=true +pidfile="/run/$RC_SVCNAME.pid" + +output_log="/var/log/continuwuity.log" +error_log="/var/log/continuwuity.log" + +depend() { + need net +} + +start_pre() { + checkpath -d -m 0755 -o "$command_user" /var/lib/continuwuity + checkpath -f -m 0644 -o "$command_user" "$output_log" +} diff --git a/alpine/continuwuity.pre-install b/alpine/continuwuity.pre-install new file mode 100644 index 00000000..edac789f --- /dev/null +++ b/alpine/continuwuity.pre-install @@ -0,0 +1,4 @@ +#!/bin/sh +addgroup -S continuwuity 2>/dev/null +adduser -S -D -H -h /var/lib/continuwuity -s /sbin/nologin -G continuwuity -g continuwuity continuwuity 2>/dev/null +exit 0 From b562b8cf92be450b919df476d66187e6485ad042 Mon Sep 17 00:00:00 2001 From: magmaus3 Date: Mon, 5 May 2025 16:33:46 +0200 Subject: [PATCH 4/4] feat: add alpine ci --- .forgejo/workflows/build-alpine.yml | 49 +++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 .forgejo/workflows/build-alpine.yml diff --git a/.forgejo/workflows/build-alpine.yml b/.forgejo/workflows/build-alpine.yml new file mode 100644 index 00000000..b1757a60 --- /dev/null +++ b/.forgejo/workflows/build-alpine.yml @@ -0,0 +1,49 @@ +on: + - workflow-dispatch + - push + +jobs: + build: + runs-on: ubuntu-latest + container: + image: alpine:edge + + steps: + - name: set up dependencies + run: | + apk update + apk upgrade + apk add nodejs git alpine-sdk + - uses: actions/checkout@v4 + name: checkout the alpine dir + with: + sparse-checkout: "alpine/" + + # - uses: actions/checkout@v4 + # name: checkout the rest in the alpine dir + # with: + # path: 'alpine/continuwuity' + - name: set up user + run: adduser -DG abuild ci + + - name: set up keys + run: | + pwd + mkdir ~/.abuild + echo "${{ secrets.abuild_privkey }}" > ~/.abuild/ci@continuwuity.rsa + echo "${{ secrets.abuild_pubkey }}" > ~/.abuild/ci@continuwuity.rsa.pub + echo $HOME + echo 'PACKAGER_PRIVKEY="/root/.abuild/ci@continuwuity.rsa"' > ~/.abuild/abuild.conf + ls ~/.abuild + + - name: go go gadget abuild + run: | + cd alpine + # modify the APKBUILD to use the current branch instead of the release + # note that it seems to require the repo to be public (as you'll get + # a 404 even if the token is provided) + export ARCHIVE_URL="${{ github.server_url }}/${{ github.repository }}/archive/${{ github.ref_name }}.tar.gz" + echo $ARCHIVE_URL + sed -i '/^source=/c\source="'"$ARCHIVE_URL" APKBUILD + abuild -F checksum + abuild -Fr