diff --git a/.cargo/config.toml b/.cargo/config.toml new file mode 100644 index 00000000..35049cbc --- /dev/null +++ b/.cargo/config.toml @@ -0,0 +1,2 @@ +[alias] +xtask = "run --package xtask --" diff --git a/.forgejo/regsync/regsync.yml b/.forgejo/regsync/regsync.yml new file mode 100644 index 00000000..941c0f93 --- /dev/null +++ b/.forgejo/regsync/regsync.yml @@ -0,0 +1,55 @@ +version: 1 + +x-source: &source forgejo.ellis.link/continuwuation/continuwuity + +x-tags: + releases: &tags-releases + tags: + allow: + - "latest" + - "v[0-9]+\\.[0-9]+\\.[0-9]+(-[a-z0-9\\.]+)?" + - "v[0-9]+\\.[0-9]+" + - "v[0-9]+" + main: &tags-main + tags: + allow: + - "latest" + - "v[0-9]+\\.[0-9]+\\.[0-9]+(-[a-z0-9\\.]+)?" + - "v[0-9]+\\.[0-9]+" + - "v[0-9]+" + - "main" + commits: &tags-commits + tags: + allow: + - "latest" + - "v[0-9]+\\.[0-9]+\\.[0-9]+(-[a-z0-9\\.]+)?" + - "v[0-9]+\\.[0-9]+" + - "v[0-9]+" + - "main" + - "sha-[a-f0-9]+" + all: &tags-all + tags: + allow: + - ".*" + +# Registry credentials +creds: + - registry: forgejo.ellis.link + user: "{{env \"BUILTIN_REGISTRY_USER\"}}" + pass: "{{env \"BUILTIN_REGISTRY_PASSWORD\"}}" + - registry: registry.gitlab.com + user: "{{env \"GITLAB_USERNAME\"}}" + pass: "{{env \"GITLAB_TOKEN\"}}" + +# Global defaults +defaults: + parallel: 3 + interval: 2h + digestTags: true + +# Sync configuration - each registry gets different image sets +sync: + - source: *source + target: registry.gitlab.com/continuwuity/continuwuity + type: repository + <<: *tags-main diff --git a/.forgejo/workflows/element.yml b/.forgejo/workflows/element.yml index db771197..0199e8b6 100644 --- a/.forgejo/workflows/element.yml +++ b/.forgejo/workflows/element.yml @@ -11,16 +11,16 @@ concurrency: jobs: build-and-deploy: - name: Build and Deploy Element Web + name: 🏗️ Build and Deploy runs-on: ubuntu-latest steps: - - name: Setup Node.js - uses: https://code.forgejo.org/actions/setup-node@v4 + - name: 📦 Setup Node.js + uses: https://github.com/actions/setup-node@v4 with: - node-version: "20" + node-version: "22" - - name: Clone, setup, and build Element Web + - name: 🔨 Clone, setup, and build Element Web run: | echo "Cloning Element Web..." git clone https://github.com/maunium/element-web @@ -64,7 +64,7 @@ jobs: echo "Checking for build output..." ls -la webapp/ - - name: Create config.json + - name: ⚙️ Create config.json run: | cat < ./element-web/webapp/config.json { @@ -100,28 +100,25 @@ jobs: echo "Created ./element-web/webapp/config.json" cat ./element-web/webapp/config.json - - name: Upload Artifact + - name: 📤 Upload Artifact uses: https://code.forgejo.org/actions/upload-artifact@v3 with: name: element-web path: ./element-web/webapp/ retention-days: 14 - - name: Install Wrangler + - name: 🛠️ Install Wrangler run: npm install --save-dev wrangler@latest - - name: Deploy to Cloudflare Pages (Production) - if: github.ref == 'refs/heads/main' && vars.CLOUDFLARE_PROJECT_NAME != '' + - name: 🚀 Deploy to Cloudflare Pages + if: vars.CLOUDFLARE_PROJECT_NAME != '' + id: deploy uses: https://github.com/cloudflare/wrangler-action@v3 with: accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} - command: pages deploy ./element-web/webapp --branch="main" --commit-dirty=true --project-name="${{ vars.CLOUDFLARE_PROJECT_NAME }}-element" - - - name: Deploy to Cloudflare Pages (Preview) - if: github.ref != 'refs/heads/main' && vars.CLOUDFLARE_PROJECT_NAME != '' - uses: https://github.com/cloudflare/wrangler-action@v3 - with: - accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} - apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} - command: pages deploy ./element-web/webapp --branch="${{ github.head_ref || github.ref_name }}" --commit-dirty=true --project-name="${{ vars.CLOUDFLARE_PROJECT_NAME }}-element" + command: >- + pages deploy ./element-web/webapp + --branch="${{ github.ref == 'refs/heads/main' && 'main' || github.head_ref || github.ref_name }}" + --commit-dirty=true + --project-name="${{ vars.CLOUDFLARE_PROJECT_NAME }}-element" diff --git a/.forgejo/workflows/mirror-images.yml b/.forgejo/workflows/mirror-images.yml new file mode 100644 index 00000000..198832db --- /dev/null +++ b/.forgejo/workflows/mirror-images.yml @@ -0,0 +1,47 @@ +name: Mirror Container Images + +on: + schedule: + # Run every 2 hours + - cron: "0 */2 * * *" + workflow_dispatch: + inputs: + dry_run: + description: 'Dry run (check only, no actual mirroring)' + required: false + default: false + type: boolean + +concurrency: + group: "mirror-images" + cancel-in-progress: true + +jobs: + mirror-images: + runs-on: ubuntu-latest + env: + BUILTIN_REGISTRY_USER: ${{ vars.BUILTIN_REGISTRY_USER }} + BUILTIN_REGISTRY_PASSWORD: ${{ secrets.BUILTIN_REGISTRY_PASSWORD }} + GITLAB_USERNAME: ${{ vars.GITLAB_USERNAME }} + GITLAB_TOKEN: ${{ secrets.GITLAB_TOKEN }} + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + persist-credentials: false + + - name: Install regctl + uses: https://forgejo.ellis.link/continuwuation/regclient-actions/regctl-installer@main + with: + binary: regsync + + - name: Check what images need mirroring + run: | + echo "Checking images that need mirroring..." + regsync check -c .forgejo/regsync/regsync.yml -v info + + - name: Mirror images + if: ${{ !inputs.dry_run }} + run: | + echo "Starting image mirroring..." + regsync once -c .forgejo/regsync/regsync.yml -v info diff --git a/.forgejo/workflows/release-image.yml b/.forgejo/workflows/release-image.yml index 170fe668..5ac5ddfa 100644 --- a/.forgejo/workflows/release-image.yml +++ b/.forgejo/workflows/release-image.yml @@ -204,13 +204,31 @@ jobs: digest="${{ steps.build.outputs.digest }}" touch "/tmp/digests/${digest#sha256:}" + - name: Extract binary from container (image) + id: extract-binary-image + run: | + mkdir -p /tmp/binaries + digest="${{ steps.build.outputs.digest }}" + echo "container_id=$(docker create --platform ${{ matrix.platform }} ${{ needs.define-variables.outputs.images_list }}@$digest)" >> $GITHUB_OUTPUT + - name: Extract binary from container (copy) + run: docker cp ${{ steps.extract-binary-image.outputs.container_id }}:/sbin/conduwuit /tmp/binaries/conduwuit-${{ matrix.target_cpu }}-${{ matrix.slug }}-${{ matrix.profile }} + - name: Extract binary from container (cleanup) + run: docker rm ${{ steps.extract-binary-image.outputs.container_id }} + + - name: Upload binary artifact + uses: forgejo/upload-artifact@v4 + with: + name: conduwuit-${{ matrix.target_cpu }}-${{ matrix.slug }}-${{ matrix.profile }} + path: /tmp/binaries/conduwuit-${{ matrix.target_cpu }}-${{ matrix.slug }}-${{ matrix.profile }} + if-no-files-found: error + - name: Upload digest uses: forgejo/upload-artifact@v4 with: name: digests-${{ matrix.slug }} path: /tmp/digests/* if-no-files-found: error - retention-days: 1 + retention-days: 5 merge: runs-on: dind @@ -238,12 +256,13 @@ jobs: uses: docker/metadata-action@v5 with: tags: | - type=semver,pattern=v{{version}} - type=semver,pattern=v{{major}}.{{minor}},enable=${{ !startsWith(github.ref, 'refs/tags/v0.0.') }} - type=semver,pattern=v{{major}},enable=${{ !startsWith(github.ref, 'refs/tags/v0.') }} + type=semver,pattern={{version}},prefix=v + type=semver,pattern={{major}}.{{minor}},enable=${{ !startsWith(github.ref, 'refs/tags/v0.0.') }},prefix=v + type=semver,pattern={{major}},enable=${{ !startsWith(github.ref, 'refs/tags/v0.') }},prefix=v type=ref,event=branch,prefix=${{ format('refs/heads/{0}', github.event.repository.default_branch) != github.ref && 'branch-' || '' }} type=ref,event=pr type=sha,format=long + type=raw,value=latest,enable=${{ !startsWith(github.ref, 'refs/tags/v') }} images: ${{needs.define-variables.outputs.images}} # default labels & annotations: https://github.com/docker/metadata-action/blob/master/src/meta.ts#L509 env: diff --git a/Cargo.lock b/Cargo.lock index 92044b92..6f711007 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -50,12 +50,56 @@ dependencies = [ "alloc-no-stdlib", ] +[[package]] +name = "anstream" +version = "0.6.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8acc5369981196006228e28809f761875c0327210a891e941f4c683b3a99529b" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] + [[package]] name = "anstyle" version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "862ed96ca487e809f1c8e5a8447f6ee2cf102f846893800b20cebdf541fc6bbd" +[[package]] +name = "anstyle-parse" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b2d16507662817a6a20a9ea92df6652ee4f94f914589377d69f3b21bc5798a9" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79947af37f4177cfead1110013d678905c37501914fba0efea834c3fe9a8d60c" +dependencies = [ + "windows-sys 0.59.0", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6680de5231bd6ee4c6191b8a1325daa282b415391ec9d3a37bd34f2060dc73fa" +dependencies = [ + "anstyle", + "once_cell_polyfill", + "windows-sys 0.59.0", +] + [[package]] name = "anyhow" version = "1.0.98" @@ -720,14 +764,25 @@ dependencies = [ "clap_derive", ] +[[package]] +name = "clap-markdown" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2a2617956a06d4885b490697b5307ebb09fec10b088afc18c81762d848c2339" +dependencies = [ + "clap", +] + [[package]] name = "clap_builder" version = "4.5.40" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e0c66c08ce9f0c698cbce5c0279d0bb6ac936d8674174fe48f736533b964f59e" dependencies = [ + "anstream", "anstyle", "clap_lex", + "strsim", ] [[package]] @@ -748,6 +803,16 @@ version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b94f61472cee1439c0b966b47e3aca9ae07e45d070759512cd390ea2bebc6675" +[[package]] +name = "clap_mangen" +version = "0.2.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "724842fa9b144f9b89b3f3d371a89f3455eea660361d13a554f68f8ae5d6c13a" +dependencies = [ + "clap", + "roff", +] + [[package]] name = "cmake" version = "0.1.54" @@ -763,6 +828,12 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b" +[[package]] +name = "colorchoice" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990" + [[package]] name = "concurrent-queue" version = "2.5.0" @@ -797,6 +868,7 @@ dependencies = [ "tokio-metrics", "tracing", "tracing-flame", + "tracing-journald", "tracing-opentelemetry", "tracing-subscriber", ] @@ -1004,6 +1076,7 @@ dependencies = [ "loole", "lru-cache", "rand 0.8.5", + "recaptcha-verify", "regex", "reqwest", "ruma", @@ -2398,6 +2471,12 @@ version = "2.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "469fb0b9cefa57e3ef31275ee7cacb78f2fdca44e4765491884a2b119d4eb130" +[[package]] +name = "is_terminal_polyfill" +version = "1.70.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" + [[package]] name = "itertools" version = "0.12.1" @@ -3006,6 +3085,12 @@ dependencies = [ "portable-atomic", ] +[[package]] +name = "once_cell_polyfill" +version = "1.70.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4895175b425cb1f87721b59f0f286c2092bd4af812243672510e1ac53e2e0ad" + [[package]] name = "openssl-probe" version = "0.1.6" @@ -3667,6 +3752,17 @@ dependencies = [ "crossbeam-utils", ] +[[package]] +name = "recaptcha-verify" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71e3be7b2e46e24637ac96b0c9f70070f188652018573f36f4e511dcad09738a" +dependencies = [ + "reqwest", + "serde", + "serde_json", +] + [[package]] name = "redox_syscall" version = "0.5.13" @@ -3795,10 +3891,16 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "roff" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88f8660c1ff60292143c98d08fc6e2f654d722db50410e3f3797d40baaf9d8f3" + [[package]] name = "ruma" version = "0.10.1" -source = "git+https://forgejo.ellis.link/continuwuation/ruwuma?rev=9b65f83981f6f53d185ce77da37aaef9dfd764a9#9b65f83981f6f53d185ce77da37aaef9dfd764a9" +source = "git+https://forgejo.ellis.link/continuwuation/ruwuma?rev=a4b948b40417a65ab0282ae47cc50035dd455e02#a4b948b40417a65ab0282ae47cc50035dd455e02" dependencies = [ "assign", "js_int", @@ -3818,7 +3920,7 @@ dependencies = [ [[package]] name = "ruma-appservice-api" version = "0.10.0" -source = "git+https://forgejo.ellis.link/continuwuation/ruwuma?rev=9b65f83981f6f53d185ce77da37aaef9dfd764a9#9b65f83981f6f53d185ce77da37aaef9dfd764a9" +source = "git+https://forgejo.ellis.link/continuwuation/ruwuma?rev=a4b948b40417a65ab0282ae47cc50035dd455e02#a4b948b40417a65ab0282ae47cc50035dd455e02" dependencies = [ "js_int", "ruma-common", @@ -3830,7 +3932,7 @@ dependencies = [ [[package]] name = "ruma-client-api" version = "0.18.0" -source = "git+https://forgejo.ellis.link/continuwuation/ruwuma?rev=9b65f83981f6f53d185ce77da37aaef9dfd764a9#9b65f83981f6f53d185ce77da37aaef9dfd764a9" +source = "git+https://forgejo.ellis.link/continuwuation/ruwuma?rev=a4b948b40417a65ab0282ae47cc50035dd455e02#a4b948b40417a65ab0282ae47cc50035dd455e02" dependencies = [ "as_variant", "assign", @@ -3853,7 +3955,7 @@ dependencies = [ [[package]] name = "ruma-common" version = "0.13.0" -source = "git+https://forgejo.ellis.link/continuwuation/ruwuma?rev=9b65f83981f6f53d185ce77da37aaef9dfd764a9#9b65f83981f6f53d185ce77da37aaef9dfd764a9" +source = "git+https://forgejo.ellis.link/continuwuation/ruwuma?rev=a4b948b40417a65ab0282ae47cc50035dd455e02#a4b948b40417a65ab0282ae47cc50035dd455e02" dependencies = [ "as_variant", "base64 0.22.1", @@ -3885,7 +3987,7 @@ dependencies = [ [[package]] name = "ruma-events" version = "0.28.1" -source = "git+https://forgejo.ellis.link/continuwuation/ruwuma?rev=9b65f83981f6f53d185ce77da37aaef9dfd764a9#9b65f83981f6f53d185ce77da37aaef9dfd764a9" +source = "git+https://forgejo.ellis.link/continuwuation/ruwuma?rev=a4b948b40417a65ab0282ae47cc50035dd455e02#a4b948b40417a65ab0282ae47cc50035dd455e02" dependencies = [ "as_variant", "indexmap 2.9.0", @@ -3910,7 +4012,7 @@ dependencies = [ [[package]] name = "ruma-federation-api" version = "0.9.0" -source = "git+https://forgejo.ellis.link/continuwuation/ruwuma?rev=9b65f83981f6f53d185ce77da37aaef9dfd764a9#9b65f83981f6f53d185ce77da37aaef9dfd764a9" +source = "git+https://forgejo.ellis.link/continuwuation/ruwuma?rev=a4b948b40417a65ab0282ae47cc50035dd455e02#a4b948b40417a65ab0282ae47cc50035dd455e02" dependencies = [ "bytes", "headers", @@ -3932,7 +4034,7 @@ dependencies = [ [[package]] name = "ruma-identifiers-validation" version = "0.9.5" -source = "git+https://forgejo.ellis.link/continuwuation/ruwuma?rev=9b65f83981f6f53d185ce77da37aaef9dfd764a9#9b65f83981f6f53d185ce77da37aaef9dfd764a9" +source = "git+https://forgejo.ellis.link/continuwuation/ruwuma?rev=a4b948b40417a65ab0282ae47cc50035dd455e02#a4b948b40417a65ab0282ae47cc50035dd455e02" dependencies = [ "js_int", "thiserror 2.0.12", @@ -3941,7 +4043,7 @@ dependencies = [ [[package]] name = "ruma-identity-service-api" version = "0.9.0" -source = "git+https://forgejo.ellis.link/continuwuation/ruwuma?rev=9b65f83981f6f53d185ce77da37aaef9dfd764a9#9b65f83981f6f53d185ce77da37aaef9dfd764a9" +source = "git+https://forgejo.ellis.link/continuwuation/ruwuma?rev=a4b948b40417a65ab0282ae47cc50035dd455e02#a4b948b40417a65ab0282ae47cc50035dd455e02" dependencies = [ "js_int", "ruma-common", @@ -3951,7 +4053,7 @@ dependencies = [ [[package]] name = "ruma-macros" version = "0.13.0" -source = "git+https://forgejo.ellis.link/continuwuation/ruwuma?rev=9b65f83981f6f53d185ce77da37aaef9dfd764a9#9b65f83981f6f53d185ce77da37aaef9dfd764a9" +source = "git+https://forgejo.ellis.link/continuwuation/ruwuma?rev=a4b948b40417a65ab0282ae47cc50035dd455e02#a4b948b40417a65ab0282ae47cc50035dd455e02" dependencies = [ "cfg-if", "proc-macro-crate", @@ -3966,7 +4068,7 @@ dependencies = [ [[package]] name = "ruma-push-gateway-api" version = "0.9.0" -source = "git+https://forgejo.ellis.link/continuwuation/ruwuma?rev=9b65f83981f6f53d185ce77da37aaef9dfd764a9#9b65f83981f6f53d185ce77da37aaef9dfd764a9" +source = "git+https://forgejo.ellis.link/continuwuation/ruwuma?rev=a4b948b40417a65ab0282ae47cc50035dd455e02#a4b948b40417a65ab0282ae47cc50035dd455e02" dependencies = [ "js_int", "ruma-common", @@ -3978,7 +4080,7 @@ dependencies = [ [[package]] name = "ruma-signatures" version = "0.15.0" -source = "git+https://forgejo.ellis.link/continuwuation/ruwuma?rev=9b65f83981f6f53d185ce77da37aaef9dfd764a9#9b65f83981f6f53d185ce77da37aaef9dfd764a9" +source = "git+https://forgejo.ellis.link/continuwuation/ruwuma?rev=a4b948b40417a65ab0282ae47cc50035dd455e02#a4b948b40417a65ab0282ae47cc50035dd455e02" dependencies = [ "base64 0.22.1", "ed25519-dalek", @@ -4636,6 +4738,12 @@ dependencies = [ "quote", ] +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + [[package]] name = "subslice" version = "0.2.3" @@ -5178,6 +5286,17 @@ dependencies = [ "tracing-subscriber", ] +[[package]] +name = "tracing-journald" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc0b4143302cf1022dac868d521e36e8b27691f72c84b3311750d5188ebba657" +dependencies = [ + "libc", + "tracing-core", + "tracing-subscriber", +] + [[package]] name = "tracing-log" version = "0.2.0" @@ -5355,6 +5474,12 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" +[[package]] +name = "utf8parse" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" + [[package]] name = "uuid" version = "1.17.0" @@ -6006,6 +6131,26 @@ dependencies = [ "markup5ever", ] +[[package]] +name = "xtask" +version = "0.5.0-rc.6" +dependencies = [ + "clap", + "serde", + "serde_json", +] + +[[package]] +name = "xtask-generate-commands" +version = "0.5.0-rc.6" +dependencies = [ + "clap-markdown", + "clap_builder", + "clap_mangen", + "conduwuit", + "conduwuit_admin", +] + [[package]] name = "yansi" version = "1.0.1" diff --git a/Cargo.toml b/Cargo.toml index 5c289adf..ef917332 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,7 @@ [workspace] resolver = "2" -members = ["src/*"] +members = ["src/*", "xtask/*"] default-members = ["src/*"] [workspace.package] @@ -213,6 +213,8 @@ default-features = false version = "0.3.19" default-features = false features = ["env-filter", "std", "tracing", "tracing-log", "ansi", "fmt"] +[workspace.dependencies.tracing-journald] +version = "0.3.1" [workspace.dependencies.tracing-core] version = "0.1.33" default-features = false @@ -350,7 +352,7 @@ version = "0.1.2" [workspace.dependencies.ruma] git = "https://forgejo.ellis.link/continuwuation/ruwuma" #branch = "conduwuit-changes" -rev = "9b65f83981f6f53d185ce77da37aaef9dfd764a9" +rev = "a4b948b40417a65ab0282ae47cc50035dd455e02" features = [ "compat", "rand", @@ -636,6 +638,11 @@ package = "conduwuit_build_metadata" path = "src/build_metadata" default-features = false + +[workspace.dependencies.conduwuit] +package = "conduwuit" +path = "src/main" + ############################################################################### # # Release profiles @@ -761,7 +768,8 @@ inherits = "dev" # '-Clink-arg=-Wl,-z,nodlopen', # '-Clink-arg=-Wl,-z,nodelete', #] - +[profile.dev.package.xtask-generate-commands] +inherits = "dev" [profile.dev.package.conduwuit] inherits = "dev" #rustflags = [ diff --git a/arch/conduwuit.service b/arch/conduwuit.service index d5a65e4d..b66bc1da 100644 --- a/arch/conduwuit.service +++ b/arch/conduwuit.service @@ -17,6 +17,10 @@ DeviceAllow=char-tty StandardInput=tty-force StandardOutput=tty StandardError=journal+console + +Environment="CONTINUWUITY_LOG_TO_JOURNALD=1" +Environment="CONTINUWUITY_JOURNALD_IDENTIFIER=%N" + TTYReset=yes # uncomment to allow buffer to be cleared every restart TTYVTDisallocate=no diff --git a/committed.toml b/committed.toml index 64f7f18a..59750fa5 100644 --- a/committed.toml +++ b/committed.toml @@ -1,2 +1,3 @@ style = "conventional" +subject_length = 72 allowed_types = ["ci", "build", "fix", "feat", "chore", "docs", "style", "refactor", "perf", "test"] diff --git a/conduwuit-example.toml b/conduwuit-example.toml index 1a8be2aa..bdc2f570 100644 --- a/conduwuit-example.toml +++ b/conduwuit-example.toml @@ -398,6 +398,22 @@ # #allow_registration = false +# If registration is enabled, and this setting is true, new users +# registered after the first admin user will be automatically suspended +# and will require an admin to run `!admin users unsuspend `. +# +# Suspended users are still able to read messages, make profile updates, +# leave rooms, and deactivate their account, however cannot send messages, +# invites, or create/join or otherwise modify rooms. +# They are effectively read-only. +# +# If you want to use this to screen people who register on your server, +# you should add a room to `auto_join_rooms` that is public, and contains +# information that new users can read (since they won't be able to DM +# anyone, or send a message, and may be confused). +# +#suspend_on_register = false + # Enabling this setting opens registration to anyone without restrictions. # This makes your server vulnerable to abuse # @@ -425,6 +441,26 @@ # #registration_token_file = +# The public site key for reCaptcha. If this is provided, reCaptcha +# becomes required during registration. If both captcha *and* +# registration token are enabled, both will be required during +# registration. +# +# IMPORTANT: "Verify the origin of reCAPTCHA solutions" **MUST** BE +# DISABLED IF YOU WANT THE CAPTCHA TO WORK IN 3RD PARTY CLIENTS, OR +# CLIENTS HOSTED ON DOMAINS OTHER THAN YOUR OWN! +# +# Registration must be enabled (`allow_registration` must be true) for +# this to have any effect. +# +#recaptcha_site_key = + +# The private site key for reCaptcha. +# If this is omitted, captcha registration will not work, +# even if `recaptcha_site_key` is set. +# +#recaptcha_private_site_key = + # Controls whether encrypted rooms and events are allowed. # #allow_encryption = true @@ -660,6 +696,21 @@ # #log_thread_ids = false +# Enable journald logging on Unix platforms +# +# When enabled, log output will be sent to the systemd journal +# This is only supported on Unix platforms +# +#log_to_journald = false + +# The syslog identifier to use with journald logging +# +# Only used when journald logging is enabled +# +# Defaults to the binary name +# +#journald_identifier = + # OpenID token expiration/TTL in seconds. # # These are the OpenID tokens that are primarily used for Matrix account @@ -1053,6 +1104,13 @@ # #presence_timeout_remote_users = true +# Allow local read receipts. +# +# Disabling this will effectively also disable outgoing federated read +# receipts. +# +#allow_local_read_receipts = true + # Allow receiving incoming read receipts from remote servers. # #allow_incoming_read_receipts = true @@ -1061,6 +1119,13 @@ # #allow_outgoing_read_receipts = true +# Allow local typing updates. +# +# Disabling this will effectively also disable outgoing federated typing +# updates. +# +#allow_local_typing = true + # Allow outgoing typing updates to federation. # #allow_outgoing_typing = true diff --git a/debian/README.md b/debian/README.md index 4a8e58d2..b605b198 100644 --- a/debian/README.md +++ b/debian/README.md @@ -1,29 +1,23 @@ # Continuwuity for Debian -Information about downloading and deploying the Debian package. This may also be -referenced for other `apt`-based distros such as Ubuntu. +This document provides information about downloading and deploying the Debian package. You can also use this guide for other `apt`-based distributions such as Ubuntu. ### Installation -It is recommended to see the [generic deployment guide](../deploying/generic.md) -for further information if needed as usage of the Debian package is generally -related. +See the [generic deployment guide](../deploying/generic.md) for additional information about using the Debian package. -No `apt` repository is currently offered yet, it is in the works/development. +No `apt` repository is currently available. This feature is in development. ### Configuration -When installed, the example config is placed at `/etc/conduwuit/conduwuit.toml` -as the default config. The config mentions things required to be changed before -starting. +After installation, Continuwuity places the example configuration at `/etc/conduwuit/conduwuit.toml` as the default configuration file. The configuration file indicates which settings you must change before starting the service. -You can tweak more detailed settings by uncommenting and setting the config -options in `/etc/conduwuit/conduwuit.toml`. +You can customize additional settings by uncommenting and modifying the configuration options in `/etc/conduwuit/conduwuit.toml`. ### Running -The package uses the [`conduwuit.service`](../configuration/examples.md#example-systemd-unit-file) systemd unit file to start and stop Continuwuity. The binary is installed at `/usr/sbin/conduwuit`. +The package uses the [`conduwuit.service`](../configuration/examples.md#example-systemd-unit-file) systemd unit file to start and stop Continuwuity. The binary installs at `/usr/sbin/conduwuit`. -This package assumes by default that conduwuit will be placed behind a reverse proxy. The default config options apply (listening on `localhost` and TCP port `6167`). Matrix federation requires a valid domain name and TLS, so you will need to set up TLS certificates and renewal for it to work properly if you intend to federate. +By default, this package assumes that Continuwuity runs behind a reverse proxy. The default configuration options apply (listening on `localhost` and TCP port `6167`). Matrix federation requires a valid domain name and TLS. To federate properly, you must set up TLS certificates and certificate renewal. -Consult various online documentation and guides on setting up a reverse proxy and TLS. Caddy is documented at the [generic deployment guide](../deploying/generic.md#setting-up-the-reverse-proxy) as it's the easiest and most user friendly. +For information about setting up a reverse proxy and TLS, consult online documentation and guides. The [generic deployment guide](../deploying/generic.md#setting-up-the-reverse-proxy) documents Caddy, which is the most user-friendly option for reverse proxy configuration. diff --git a/debian/conduwuit.service b/debian/conduwuit.service index be2f3dae..b95804d3 100644 --- a/debian/conduwuit.service +++ b/debian/conduwuit.service @@ -14,6 +14,9 @@ Type=notify Environment="CONTINUWUITY_CONFIG=/etc/conduwuit/conduwuit.toml" +Environment="CONTINUWUITY_LOG_TO_JOURNALD=1" +Environment="CONTINUWUITY_JOURNALD_IDENTIFIER=%N" + ExecStart=/usr/sbin/conduwuit ReadWritePaths=/var/lib/conduwuit /etc/conduwuit diff --git a/docs/SUMMARY.md b/docs/SUMMARY.md index acdc2dcc..fa097238 100644 --- a/docs/SUMMARY.md +++ b/docs/SUMMARY.md @@ -15,6 +15,7 @@ - [Appservices](appservices.md) - [Maintenance](maintenance.md) - [Troubleshooting](troubleshooting.md) +- [Admin Command Reference](admin_reference.md) - [Development](development.md) - [Contributing](contributing.md) - [Code Style Guide](development/code_style.md) diff --git a/docs/admin_reference.md b/docs/admin_reference.md new file mode 100644 index 00000000..18e039e4 --- /dev/null +++ b/docs/admin_reference.md @@ -0,0 +1,2658 @@ +# Command-Line Help for `admin` + +This document contains the help content for the `admin` command-line program. + +**Command Overview:** + +* [`admin`↴](#admin) +* [`admin appservices`↴](#admin-appservices) +* [`admin appservices register`↴](#admin-appservices-register) +* [`admin appservices unregister`↴](#admin-appservices-unregister) +* [`admin appservices show-appservice-config`↴](#admin-appservices-show-appservice-config) +* [`admin appservices list-registered`↴](#admin-appservices-list-registered) +* [`admin users`↴](#admin-users) +* [`admin users create-user`↴](#admin-users-create-user) +* [`admin users reset-password`↴](#admin-users-reset-password) +* [`admin users deactivate`↴](#admin-users-deactivate) +* [`admin users deactivate-all`↴](#admin-users-deactivate-all) +* [`admin users suspend`↴](#admin-users-suspend) +* [`admin users unsuspend`↴](#admin-users-unsuspend) +* [`admin users list-users`↴](#admin-users-list-users) +* [`admin users list-joined-rooms`↴](#admin-users-list-joined-rooms) +* [`admin users force-join-room`↴](#admin-users-force-join-room) +* [`admin users force-leave-room`↴](#admin-users-force-leave-room) +* [`admin users force-demote`↴](#admin-users-force-demote) +* [`admin users make-user-admin`↴](#admin-users-make-user-admin) +* [`admin users put-room-tag`↴](#admin-users-put-room-tag) +* [`admin users delete-room-tag`↴](#admin-users-delete-room-tag) +* [`admin users get-room-tags`↴](#admin-users-get-room-tags) +* [`admin users redact-event`↴](#admin-users-redact-event) +* [`admin users force-join-list-of-local-users`↴](#admin-users-force-join-list-of-local-users) +* [`admin users force-join-all-local-users`↴](#admin-users-force-join-all-local-users) +* [`admin rooms`↴](#admin-rooms) +* [`admin rooms list-rooms`↴](#admin-rooms-list-rooms) +* [`admin rooms info`↴](#admin-rooms-info) +* [`admin rooms info list-joined-members`↴](#admin-rooms-info-list-joined-members) +* [`admin rooms info view-room-topic`↴](#admin-rooms-info-view-room-topic) +* [`admin rooms moderation`↴](#admin-rooms-moderation) +* [`admin rooms moderation ban-room`↴](#admin-rooms-moderation-ban-room) +* [`admin rooms moderation ban-list-of-rooms`↴](#admin-rooms-moderation-ban-list-of-rooms) +* [`admin rooms moderation unban-room`↴](#admin-rooms-moderation-unban-room) +* [`admin rooms moderation list-banned-rooms`↴](#admin-rooms-moderation-list-banned-rooms) +* [`admin rooms alias`↴](#admin-rooms-alias) +* [`admin rooms alias set`↴](#admin-rooms-alias-set) +* [`admin rooms alias remove`↴](#admin-rooms-alias-remove) +* [`admin rooms alias which`↴](#admin-rooms-alias-which) +* [`admin rooms alias list`↴](#admin-rooms-alias-list) +* [`admin rooms directory`↴](#admin-rooms-directory) +* [`admin rooms directory publish`↴](#admin-rooms-directory-publish) +* [`admin rooms directory unpublish`↴](#admin-rooms-directory-unpublish) +* [`admin rooms directory list`↴](#admin-rooms-directory-list) +* [`admin rooms exists`↴](#admin-rooms-exists) +* [`admin federation`↴](#admin-federation) +* [`admin federation incoming-federation`↴](#admin-federation-incoming-federation) +* [`admin federation disable-room`↴](#admin-federation-disable-room) +* [`admin federation enable-room`↴](#admin-federation-enable-room) +* [`admin federation fetch-support-well-known`↴](#admin-federation-fetch-support-well-known) +* [`admin federation remote-user-in-rooms`↴](#admin-federation-remote-user-in-rooms) +* [`admin server`↴](#admin-server) +* [`admin server uptime`↴](#admin-server-uptime) +* [`admin server show-config`↴](#admin-server-show-config) +* [`admin server reload-config`↴](#admin-server-reload-config) +* [`admin server list-features`↴](#admin-server-list-features) +* [`admin server memory-usage`↴](#admin-server-memory-usage) +* [`admin server clear-caches`↴](#admin-server-clear-caches) +* [`admin server backup-database`↴](#admin-server-backup-database) +* [`admin server list-backups`↴](#admin-server-list-backups) +* [`admin server admin-notice`↴](#admin-server-admin-notice) +* [`admin server reload-mods`↴](#admin-server-reload-mods) +* [`admin server restart`↴](#admin-server-restart) +* [`admin server shutdown`↴](#admin-server-shutdown) +* [`admin media`↴](#admin-media) +* [`admin media delete`↴](#admin-media-delete) +* [`admin media delete-list`↴](#admin-media-delete-list) +* [`admin media delete-past-remote-media`↴](#admin-media-delete-past-remote-media) +* [`admin media delete-all-from-user`↴](#admin-media-delete-all-from-user) +* [`admin media delete-all-from-server`↴](#admin-media-delete-all-from-server) +* [`admin media get-file-info`↴](#admin-media-get-file-info) +* [`admin media get-remote-file`↴](#admin-media-get-remote-file) +* [`admin media get-remote-thumbnail`↴](#admin-media-get-remote-thumbnail) +* [`admin check`↴](#admin-check) +* [`admin check check-all-users`↴](#admin-check-check-all-users) +* [`admin debug`↴](#admin-debug) +* [`admin debug echo`↴](#admin-debug-echo) +* [`admin debug get-auth-chain`↴](#admin-debug-get-auth-chain) +* [`admin debug parse-pdu`↴](#admin-debug-parse-pdu) +* [`admin debug get-pdu`↴](#admin-debug-get-pdu) +* [`admin debug get-short-pdu`↴](#admin-debug-get-short-pdu) +* [`admin debug get-remote-pdu`↴](#admin-debug-get-remote-pdu) +* [`admin debug get-remote-pdu-list`↴](#admin-debug-get-remote-pdu-list) +* [`admin debug get-room-state`↴](#admin-debug-get-room-state) +* [`admin debug get-signing-keys`↴](#admin-debug-get-signing-keys) +* [`admin debug get-verify-keys`↴](#admin-debug-get-verify-keys) +* [`admin debug ping`↴](#admin-debug-ping) +* [`admin debug force-device-list-updates`↴](#admin-debug-force-device-list-updates) +* [`admin debug change-log-level`↴](#admin-debug-change-log-level) +* [`admin debug sign-json`↴](#admin-debug-sign-json) +* [`admin debug verify-json`↴](#admin-debug-verify-json) +* [`admin debug verify-pdu`↴](#admin-debug-verify-pdu) +* [`admin debug first-pdu-in-room`↴](#admin-debug-first-pdu-in-room) +* [`admin debug latest-pdu-in-room`↴](#admin-debug-latest-pdu-in-room) +* [`admin debug force-set-room-state-from-server`↴](#admin-debug-force-set-room-state-from-server) +* [`admin debug resolve-true-destination`↴](#admin-debug-resolve-true-destination) +* [`admin debug memory-stats`↴](#admin-debug-memory-stats) +* [`admin debug runtime-metrics`↴](#admin-debug-runtime-metrics) +* [`admin debug runtime-interval`↴](#admin-debug-runtime-interval) +* [`admin debug time`↴](#admin-debug-time) +* [`admin debug list-dependencies`↴](#admin-debug-list-dependencies) +* [`admin debug database-stats`↴](#admin-debug-database-stats) +* [`admin debug trim-memory`↴](#admin-debug-trim-memory) +* [`admin debug database-files`↴](#admin-debug-database-files) +* [`admin query`↴](#admin-query) +* [`admin query account-data`↴](#admin-query-account-data) +* [`admin query account-data changes-since`↴](#admin-query-account-data-changes-since) +* [`admin query account-data account-data-get`↴](#admin-query-account-data-account-data-get) +* [`admin query appservice`↴](#admin-query-appservice) +* [`admin query appservice get-registration`↴](#admin-query-appservice-get-registration) +* [`admin query appservice all`↴](#admin-query-appservice-all) +* [`admin query presence`↴](#admin-query-presence) +* [`admin query presence get-presence`↴](#admin-query-presence-get-presence) +* [`admin query presence presence-since`↴](#admin-query-presence-presence-since) +* [`admin query room-alias`↴](#admin-query-room-alias) +* [`admin query room-alias resolve-local-alias`↴](#admin-query-room-alias-resolve-local-alias) +* [`admin query room-alias local-aliases-for-room`↴](#admin-query-room-alias-local-aliases-for-room) +* [`admin query room-alias all-local-aliases`↴](#admin-query-room-alias-all-local-aliases) +* [`admin query room-state-cache`↴](#admin-query-room-state-cache) +* [`admin query room-state-cache server-in-room`↴](#admin-query-room-state-cache-server-in-room) +* [`admin query room-state-cache room-servers`↴](#admin-query-room-state-cache-room-servers) +* [`admin query room-state-cache server-rooms`↴](#admin-query-room-state-cache-server-rooms) +* [`admin query room-state-cache room-members`↴](#admin-query-room-state-cache-room-members) +* [`admin query room-state-cache local-users-in-room`↴](#admin-query-room-state-cache-local-users-in-room) +* [`admin query room-state-cache active-local-users-in-room`↴](#admin-query-room-state-cache-active-local-users-in-room) +* [`admin query room-state-cache room-joined-count`↴](#admin-query-room-state-cache-room-joined-count) +* [`admin query room-state-cache room-invited-count`↴](#admin-query-room-state-cache-room-invited-count) +* [`admin query room-state-cache room-user-once-joined`↴](#admin-query-room-state-cache-room-user-once-joined) +* [`admin query room-state-cache room-members-invited`↴](#admin-query-room-state-cache-room-members-invited) +* [`admin query room-state-cache get-invite-count`↴](#admin-query-room-state-cache-get-invite-count) +* [`admin query room-state-cache get-left-count`↴](#admin-query-room-state-cache-get-left-count) +* [`admin query room-state-cache rooms-joined`↴](#admin-query-room-state-cache-rooms-joined) +* [`admin query room-state-cache rooms-left`↴](#admin-query-room-state-cache-rooms-left) +* [`admin query room-state-cache rooms-invited`↴](#admin-query-room-state-cache-rooms-invited) +* [`admin query room-state-cache invite-state`↴](#admin-query-room-state-cache-invite-state) +* [`admin query room-timeline`↴](#admin-query-room-timeline) +* [`admin query room-timeline pdus`↴](#admin-query-room-timeline-pdus) +* [`admin query room-timeline last`↴](#admin-query-room-timeline-last) +* [`admin query globals`↴](#admin-query-globals) +* [`admin query globals database-version`↴](#admin-query-globals-database-version) +* [`admin query globals current-count`↴](#admin-query-globals-current-count) +* [`admin query globals last-check-for-announcements-id`↴](#admin-query-globals-last-check-for-announcements-id) +* [`admin query globals signing-keys-for`↴](#admin-query-globals-signing-keys-for) +* [`admin query sending`↴](#admin-query-sending) +* [`admin query sending active-requests`↴](#admin-query-sending-active-requests) +* [`admin query sending active-requests-for`↴](#admin-query-sending-active-requests-for) +* [`admin query sending queued-requests`↴](#admin-query-sending-queued-requests) +* [`admin query sending get-latest-edu-count`↴](#admin-query-sending-get-latest-edu-count) +* [`admin query users`↴](#admin-query-users) +* [`admin query users count-users`↴](#admin-query-users-count-users) +* [`admin query users iter-users`↴](#admin-query-users-iter-users) +* [`admin query users iter-users2`↴](#admin-query-users-iter-users2) +* [`admin query users password-hash`↴](#admin-query-users-password-hash) +* [`admin query users list-devices`↴](#admin-query-users-list-devices) +* [`admin query users list-devices-metadata`↴](#admin-query-users-list-devices-metadata) +* [`admin query users get-device-metadata`↴](#admin-query-users-get-device-metadata) +* [`admin query users get-devices-version`↴](#admin-query-users-get-devices-version) +* [`admin query users count-one-time-keys`↴](#admin-query-users-count-one-time-keys) +* [`admin query users get-device-keys`↴](#admin-query-users-get-device-keys) +* [`admin query users get-user-signing-key`↴](#admin-query-users-get-user-signing-key) +* [`admin query users get-master-key`↴](#admin-query-users-get-master-key) +* [`admin query users get-to-device-events`↴](#admin-query-users-get-to-device-events) +* [`admin query users get-latest-backup`↴](#admin-query-users-get-latest-backup) +* [`admin query users get-latest-backup-version`↴](#admin-query-users-get-latest-backup-version) +* [`admin query users get-backup-algorithm`↴](#admin-query-users-get-backup-algorithm) +* [`admin query users get-all-backups`↴](#admin-query-users-get-all-backups) +* [`admin query users get-room-backups`↴](#admin-query-users-get-room-backups) +* [`admin query users get-backup-session`↴](#admin-query-users-get-backup-session) +* [`admin query users get-shared-rooms`↴](#admin-query-users-get-shared-rooms) +* [`admin query resolver`↴](#admin-query-resolver) +* [`admin query resolver destinations-cache`↴](#admin-query-resolver-destinations-cache) +* [`admin query resolver overrides-cache`↴](#admin-query-resolver-overrides-cache) +* [`admin query pusher`↴](#admin-query-pusher) +* [`admin query pusher get-pushers`↴](#admin-query-pusher-get-pushers) +* [`admin query short`↴](#admin-query-short) +* [`admin query short short-event-id`↴](#admin-query-short-short-event-id) +* [`admin query short short-room-id`↴](#admin-query-short-short-room-id) +* [`admin query raw`↴](#admin-query-raw) +* [`admin query raw raw-maps`↴](#admin-query-raw-raw-maps) +* [`admin query raw raw-get`↴](#admin-query-raw-raw-get) +* [`admin query raw raw-del`↴](#admin-query-raw-raw-del) +* [`admin query raw raw-keys`↴](#admin-query-raw-raw-keys) +* [`admin query raw raw-keys-sizes`↴](#admin-query-raw-raw-keys-sizes) +* [`admin query raw raw-keys-total`↴](#admin-query-raw-raw-keys-total) +* [`admin query raw raw-vals-sizes`↴](#admin-query-raw-raw-vals-sizes) +* [`admin query raw raw-vals-total`↴](#admin-query-raw-raw-vals-total) +* [`admin query raw raw-iter`↴](#admin-query-raw-raw-iter) +* [`admin query raw raw-keys-from`↴](#admin-query-raw-raw-keys-from) +* [`admin query raw raw-iter-from`↴](#admin-query-raw-raw-iter-from) +* [`admin query raw raw-count`↴](#admin-query-raw-raw-count) +* [`admin query raw compact`↴](#admin-query-raw-compact) + +## `admin` + +**Usage:** `admin ` + +###### **Subcommands:** + +* `appservices` — - Commands for managing appservices +* `users` — - Commands for managing local users +* `rooms` — - Commands for managing rooms +* `federation` — - Commands for managing federation +* `server` — - Commands for managing the server +* `media` — - Commands for managing media +* `check` — - Commands for checking integrity +* `debug` — - Commands for debugging things +* `query` — - Low-level queries for database getters and iterators + + + +## `admin appservices` + +- Commands for managing appservices + +**Usage:** `admin appservices ` + +###### **Subcommands:** + +* `register` — - Register an appservice using its registration YAML +* `unregister` — - Unregister an appservice using its ID +* `show-appservice-config` — - Show an appservice's config using its ID +* `list-registered` — - List all the currently registered appservices + + + +## `admin appservices register` + +- Register an appservice using its registration YAML + +This command needs a YAML generated by an appservice (such as a bridge), which must be provided in a Markdown code block below the command. + +Registering a new bridge using the ID of an existing bridge will replace the old one. + +**Usage:** `admin appservices register` + + + +## `admin appservices unregister` + +- Unregister an appservice using its ID + +You can find the ID using the `list-appservices` command. + +**Usage:** `admin appservices unregister ` + +###### **Arguments:** + +* `` — The appservice to unregister + + + +## `admin appservices show-appservice-config` + +- Show an appservice's config using its ID + +You can find the ID using the `list-appservices` command. + +**Usage:** `admin appservices show-appservice-config ` + +###### **Arguments:** + +* `` — The appservice to show + + + +## `admin appservices list-registered` + +- List all the currently registered appservices + +**Usage:** `admin appservices list-registered` + + + +## `admin users` + +- Commands for managing local users + +**Usage:** `admin users ` + +###### **Subcommands:** + +* `create-user` — - Create a new user +* `reset-password` — - Reset user password +* `deactivate` — - Deactivate a user +* `deactivate-all` — - Deactivate a list of users +* `suspend` — - Suspend a user +* `unsuspend` — - Unsuspend a user +* `list-users` — - List local users in the database +* `list-joined-rooms` — - Lists all the rooms (local and remote) that the specified user is joined in +* `force-join-room` — - Manually join a local user to a room +* `force-leave-room` — - Manually leave a local user from a room +* `force-demote` — - Forces the specified user to drop their power levels to the room default, if their permissions allow and the auth check permits +* `make-user-admin` — - Grant server-admin privileges to a user +* `put-room-tag` — - Puts a room tag for the specified user and room ID +* `delete-room-tag` — - Deletes the room tag for the specified user and room ID +* `get-room-tags` — - Gets all the room tags for the specified user and room ID +* `redact-event` — - Attempts to forcefully redact the specified event ID from the sender user +* `force-join-list-of-local-users` — - Force joins a specified list of local users to join the specified room +* `force-join-all-local-users` — - Force joins all local users to the specified room + + + +## `admin users create-user` + +- Create a new user + +**Usage:** `admin users create-user [PASSWORD]` + +###### **Arguments:** + +* `` — Username of the new user +* `` — Password of the new user, if unspecified one is generated + + + +## `admin users reset-password` + +- Reset user password + +**Usage:** `admin users reset-password [PASSWORD]` + +###### **Arguments:** + +* `` — Username of the user for whom the password should be reset +* `` — New password for the user, if unspecified one is generated + + + +## `admin users deactivate` + +- Deactivate a user + +User will be removed from all rooms by default. Use --no-leave-rooms to not leave all rooms by default. + +**Usage:** `admin users deactivate [OPTIONS] ` + +###### **Arguments:** + +* `` + +###### **Options:** + +* `-n`, `--no-leave-rooms` + + + +## `admin users deactivate-all` + +- Deactivate a list of users + +Recommended to use in conjunction with list-local-users. + +Users will be removed from joined rooms by default. + +Can be overridden with --no-leave-rooms. + +Removing a mass amount of users from a room may cause a significant amount of leave events. The time to leave rooms may depend significantly on joined rooms and servers. + +This command needs a newline separated list of users provided in a Markdown code block below the command. + +**Usage:** `admin users deactivate-all [OPTIONS]` + +###### **Options:** + +* `-n`, `--no-leave-rooms` — Does not leave any rooms the user is in on deactivation +* `-f`, `--force` — Also deactivate admin accounts and will assume leave all rooms too + + + +## `admin users suspend` + +- Suspend a user + +Suspended users are able to log in, sync, and read messages, but are not able to send events nor redact them, cannot change their profile, and are unable to join, invite to, or knock on rooms. + +Suspended users can still leave rooms and deactivate their account. Suspending them effectively makes them read-only. + +**Usage:** `admin users suspend ` + +###### **Arguments:** + +* `` — Username of the user to suspend + + + +## `admin users unsuspend` + +- Unsuspend a user + +Reverses the effects of the `suspend` command, allowing the user to send messages, change their profile, create room invites, etc. + +**Usage:** `admin users unsuspend ` + +###### **Arguments:** + +* `` — Username of the user to unsuspend + + + +## `admin users list-users` + +- List local users in the database + +**Usage:** `admin users list-users` + + + +## `admin users list-joined-rooms` + +- Lists all the rooms (local and remote) that the specified user is joined in + +**Usage:** `admin users list-joined-rooms ` + +###### **Arguments:** + +* `` + + + +## `admin users force-join-room` + +- Manually join a local user to a room + +**Usage:** `admin users force-join-room ` + +###### **Arguments:** + +* `` +* `` + + + +## `admin users force-leave-room` + +- Manually leave a local user from a room + +**Usage:** `admin users force-leave-room ` + +###### **Arguments:** + +* `` +* `` + + + +## `admin users force-demote` + +- Forces the specified user to drop their power levels to the room default, if their permissions allow and the auth check permits + +**Usage:** `admin users force-demote ` + +###### **Arguments:** + +* `` +* `` + + + +## `admin users make-user-admin` + +- Grant server-admin privileges to a user + +**Usage:** `admin users make-user-admin ` + +###### **Arguments:** + +* `` + + + +## `admin users put-room-tag` + +- Puts a room tag for the specified user and room ID. + +This is primarily useful if you'd like to set your admin room to the special "System Alerts" section in Element as a way to permanently see your admin room without it being buried away in your favourites or rooms. To do this, you would pass your user, your admin room's internal ID, and the tag name `m.server_notice`. + +**Usage:** `admin users put-room-tag ` + +###### **Arguments:** + +* `` +* `` +* `` + + + +## `admin users delete-room-tag` + +- Deletes the room tag for the specified user and room ID + +**Usage:** `admin users delete-room-tag ` + +###### **Arguments:** + +* `` +* `` +* `` + + + +## `admin users get-room-tags` + +- Gets all the room tags for the specified user and room ID + +**Usage:** `admin users get-room-tags ` + +###### **Arguments:** + +* `` +* `` + + + +## `admin users redact-event` + +- Attempts to forcefully redact the specified event ID from the sender user + +This is only valid for local users + +**Usage:** `admin users redact-event ` + +###### **Arguments:** + +* `` + + + +## `admin users force-join-list-of-local-users` + +- Force joins a specified list of local users to join the specified room. + +Specify a codeblock of usernames. + +At least 1 server admin must be in the room to reduce abuse. + +Requires the `--yes-i-want-to-do-this` flag. + +**Usage:** `admin users force-join-list-of-local-users [OPTIONS] ` + +###### **Arguments:** + +* `` + +###### **Options:** + +* `--yes-i-want-to-do-this` + + + +## `admin users force-join-all-local-users` + +- Force joins all local users to the specified room. + +At least 1 server admin must be in the room to reduce abuse. + +Requires the `--yes-i-want-to-do-this` flag. + +**Usage:** `admin users force-join-all-local-users [OPTIONS] ` + +###### **Arguments:** + +* `` + +###### **Options:** + +* `--yes-i-want-to-do-this` + + + +## `admin rooms` + +- Commands for managing rooms + +**Usage:** `admin rooms ` + +###### **Subcommands:** + +* `list-rooms` — - List all rooms the server knows about +* `info` — - View information about a room we know about +* `moderation` — - Manage moderation of remote or local rooms +* `alias` — - Manage rooms' aliases +* `directory` — - Manage the room directory +* `exists` — - Check if we know about a room + + + +## `admin rooms list-rooms` + +- List all rooms the server knows about + +**Usage:** `admin rooms list-rooms [OPTIONS] [PAGE]` + +###### **Arguments:** + +* `` + +###### **Options:** + +* `--exclude-disabled` — Excludes rooms that we have federation disabled with +* `--exclude-banned` — Excludes rooms that we have banned +* `--no-details` — Whether to only output room IDs without supplementary room information + + + +## `admin rooms info` + +- View information about a room we know about + +**Usage:** `admin rooms info ` + +###### **Subcommands:** + +* `list-joined-members` — - List joined members in a room +* `view-room-topic` — - Displays room topic + + + +## `admin rooms info list-joined-members` + +- List joined members in a room + +**Usage:** `admin rooms info list-joined-members [OPTIONS] ` + +###### **Arguments:** + +* `` + +###### **Options:** + +* `--local-only` — Lists only our local users in the specified room + + + +## `admin rooms info view-room-topic` + +- Displays room topic + +Room topics can be huge, so this is in its own separate command + +**Usage:** `admin rooms info view-room-topic ` + +###### **Arguments:** + +* `` + + + +## `admin rooms moderation` + +- Manage moderation of remote or local rooms + +**Usage:** `admin rooms moderation ` + +###### **Subcommands:** + +* `ban-room` — - Bans a room from local users joining and evicts all our local users (including server admins) from the room. Also blocks any invites (local and remote) for the banned room, and disables federation entirely with it +* `ban-list-of-rooms` — - Bans a list of rooms (room IDs and room aliases) from a newline delimited codeblock similar to `user deactivate-all`. Applies the same steps as ban-room +* `unban-room` — - Unbans a room to allow local users to join again +* `list-banned-rooms` — - List of all rooms we have banned + + + +## `admin rooms moderation ban-room` + +- Bans a room from local users joining and evicts all our local users (including server admins) from the room. Also blocks any invites (local and remote) for the banned room, and disables federation entirely with it + +**Usage:** `admin rooms moderation ban-room ` + +###### **Arguments:** + +* `` — The room in the format of `!roomid:example.com` or a room alias in the format of `#roomalias:example.com` + + + +## `admin rooms moderation ban-list-of-rooms` + +- Bans a list of rooms (room IDs and room aliases) from a newline delimited codeblock similar to `user deactivate-all`. Applies the same steps as ban-room + +**Usage:** `admin rooms moderation ban-list-of-rooms` + + + +## `admin rooms moderation unban-room` + +- Unbans a room to allow local users to join again + +**Usage:** `admin rooms moderation unban-room ` + +###### **Arguments:** + +* `` — The room in the format of `!roomid:example.com` or a room alias in the format of `#roomalias:example.com` + + + +## `admin rooms moderation list-banned-rooms` + +- List of all rooms we have banned + +**Usage:** `admin rooms moderation list-banned-rooms [OPTIONS]` + +###### **Options:** + +* `--no-details` — Whether to only output room IDs without supplementary room information + + + +## `admin rooms alias` + +- Manage rooms' aliases + +**Usage:** `admin rooms alias ` + +###### **Subcommands:** + +* `set` — - Make an alias point to a room +* `remove` — - Remove a local alias +* `which` — - Show which room is using an alias +* `list` — - List aliases currently being used + + + +## `admin rooms alias set` + +- Make an alias point to a room + +**Usage:** `admin rooms alias set [OPTIONS] ` + +###### **Arguments:** + +* `` — The room id to set the alias on +* `` — The alias localpart to use (`alias`, not `#alias:servername.tld`) + +###### **Options:** + +* `-f`, `--force` — Set the alias even if a room is already using it + + + +## `admin rooms alias remove` + +- Remove a local alias + +**Usage:** `admin rooms alias remove ` + +###### **Arguments:** + +* `` — The alias localpart to remove (`alias`, not `#alias:servername.tld`) + + + +## `admin rooms alias which` + +- Show which room is using an alias + +**Usage:** `admin rooms alias which ` + +###### **Arguments:** + +* `` — The alias localpart to look up (`alias`, not `#alias:servername.tld`) + + + +## `admin rooms alias list` + +- List aliases currently being used + +**Usage:** `admin rooms alias list [ROOM_ID]` + +###### **Arguments:** + +* `` — If set, only list the aliases for this room + + + +## `admin rooms directory` + +- Manage the room directory + +**Usage:** `admin rooms directory ` + +###### **Subcommands:** + +* `publish` — - Publish a room to the room directory +* `unpublish` — - Unpublish a room to the room directory +* `list` — - List rooms that are published + + + +## `admin rooms directory publish` + +- Publish a room to the room directory + +**Usage:** `admin rooms directory publish ` + +###### **Arguments:** + +* `` — The room id of the room to publish + + + +## `admin rooms directory unpublish` + +- Unpublish a room to the room directory + +**Usage:** `admin rooms directory unpublish ` + +###### **Arguments:** + +* `` — The room id of the room to unpublish + + + +## `admin rooms directory list` + +- List rooms that are published + +**Usage:** `admin rooms directory list [PAGE]` + +###### **Arguments:** + +* `` + + + +## `admin rooms exists` + +- Check if we know about a room + +**Usage:** `admin rooms exists ` + +###### **Arguments:** + +* `` + + + +## `admin federation` + +- Commands for managing federation + +**Usage:** `admin federation ` + +###### **Subcommands:** + +* `incoming-federation` — - List all rooms we are currently handling an incoming pdu from +* `disable-room` — - Disables incoming federation handling for a room +* `enable-room` — - Enables incoming federation handling for a room again +* `fetch-support-well-known` — - Fetch `/.well-known/matrix/support` from the specified server +* `remote-user-in-rooms` — - Lists all the rooms we share/track with the specified *remote* user + + + +## `admin federation incoming-federation` + +- List all rooms we are currently handling an incoming pdu from + +**Usage:** `admin federation incoming-federation` + + + +## `admin federation disable-room` + +- Disables incoming federation handling for a room + +**Usage:** `admin federation disable-room ` + +###### **Arguments:** + +* `` + + + +## `admin federation enable-room` + +- Enables incoming federation handling for a room again + +**Usage:** `admin federation enable-room ` + +###### **Arguments:** + +* `` + + + +## `admin federation fetch-support-well-known` + +- Fetch `/.well-known/matrix/support` from the specified server + +Despite the name, this is not a federation endpoint and does not go through the federation / server resolution process as per-spec this is supposed to be served at the server_name. + +Respecting homeservers put this file here for listing administration, moderation, and security inquiries. This command provides a way to easily fetch that information. + +**Usage:** `admin federation fetch-support-well-known ` + +###### **Arguments:** + +* `` + + + +## `admin federation remote-user-in-rooms` + +- Lists all the rooms we share/track with the specified *remote* user + +**Usage:** `admin federation remote-user-in-rooms ` + +###### **Arguments:** + +* `` + + + +## `admin server` + +- Commands for managing the server + +**Usage:** `admin server ` + +###### **Subcommands:** + +* `uptime` — - Time elapsed since startup +* `show-config` — - Show configuration values +* `reload-config` — - Reload configuration values +* `list-features` — - List the features built into the server +* `memory-usage` — - Print database memory usage statistics +* `clear-caches` — - Clears all of Continuwuity's caches +* `backup-database` — - Performs an online backup of the database (only available for RocksDB at the moment) +* `list-backups` — - List database backups +* `admin-notice` — - Send a message to the admin room +* `reload-mods` — - Hot-reload the server +* `restart` — - Restart the server +* `shutdown` — - Shutdown the server + + + +## `admin server uptime` + +- Time elapsed since startup + +**Usage:** `admin server uptime` + + + +## `admin server show-config` + +- Show configuration values + +**Usage:** `admin server show-config` + + + +## `admin server reload-config` + +- Reload configuration values + +**Usage:** `admin server reload-config [PATH]` + +###### **Arguments:** + +* `` + + + +## `admin server list-features` + +- List the features built into the server + +**Usage:** `admin server list-features [OPTIONS]` + +###### **Options:** + +* `-a`, `--available` +* `-e`, `--enabled` +* `-c`, `--comma` + + + +## `admin server memory-usage` + +- Print database memory usage statistics + +**Usage:** `admin server memory-usage` + + + +## `admin server clear-caches` + +- Clears all of Continuwuity's caches + +**Usage:** `admin server clear-caches` + + + +## `admin server backup-database` + +- Performs an online backup of the database (only available for RocksDB at the moment) + +**Usage:** `admin server backup-database` + + + +## `admin server list-backups` + +- List database backups + +**Usage:** `admin server list-backups` + + + +## `admin server admin-notice` + +- Send a message to the admin room + +**Usage:** `admin server admin-notice [MESSAGE]...` + +###### **Arguments:** + +* `` + + + +## `admin server reload-mods` + +- Hot-reload the server + +**Usage:** `admin server reload-mods` + + + +## `admin server restart` + +- Restart the server + +**Usage:** `admin server restart [OPTIONS]` + +###### **Options:** + +* `-f`, `--force` + + + +## `admin server shutdown` + +- Shutdown the server + +**Usage:** `admin server shutdown` + + + +## `admin media` + +- Commands for managing media + +**Usage:** `admin media ` + +###### **Subcommands:** + +* `delete` — - Deletes a single media file from our database and on the filesystem via a single MXC URL or event ID (not redacted) +* `delete-list` — - Deletes a codeblock list of MXC URLs from our database and on the filesystem. This will always ignore errors +* `delete-past-remote-media` — - Deletes all remote (and optionally local) media created before or after [duration] time using filesystem metadata first created at date, or fallback to last modified date. This will always ignore errors by default +* `delete-all-from-user` — - Deletes all the local media from a local user on our server. This will always ignore errors by default +* `delete-all-from-server` — - Deletes all remote media from the specified remote server. This will always ignore errors by default +* `get-file-info` — +* `get-remote-file` — +* `get-remote-thumbnail` — + + + +## `admin media delete` + +- Deletes a single media file from our database and on the filesystem via a single MXC URL or event ID (not redacted) + +**Usage:** `admin media delete [OPTIONS]` + +###### **Options:** + +* `--mxc ` — The MXC URL to delete +* `--event-id ` — - The message event ID which contains the media and thumbnail MXC URLs + + + +## `admin media delete-list` + +- Deletes a codeblock list of MXC URLs from our database and on the filesystem. This will always ignore errors + +**Usage:** `admin media delete-list` + + + +## `admin media delete-past-remote-media` + +- Deletes all remote (and optionally local) media created before or after [duration] time using filesystem metadata first created at date, or fallback to last modified date. This will always ignore errors by default + +**Usage:** `admin media delete-past-remote-media [OPTIONS] ` + +###### **Arguments:** + +* `` — - The relative time (e.g. 30s, 5m, 7d) within which to search + +###### **Options:** + +* `-b`, `--before` — - Only delete media created before [duration] ago +* `-a`, `--after` — - Only delete media created after [duration] ago +* `--yes-i-want-to-delete-local-media` — - Long argument to additionally delete local media + + + +## `admin media delete-all-from-user` + +- Deletes all the local media from a local user on our server. This will always ignore errors by default + +**Usage:** `admin media delete-all-from-user ` + +###### **Arguments:** + +* `` + + + +## `admin media delete-all-from-server` + +- Deletes all remote media from the specified remote server. This will always ignore errors by default + +**Usage:** `admin media delete-all-from-server [OPTIONS] ` + +###### **Arguments:** + +* `` + +###### **Options:** + +* `--yes-i-want-to-delete-local-media` — Long argument to delete local media + + + +## `admin media get-file-info` + +**Usage:** `admin media get-file-info ` + +###### **Arguments:** + +* `` — The MXC URL to lookup info for + + + +## `admin media get-remote-file` + +**Usage:** `admin media get-remote-file [OPTIONS] ` + +###### **Arguments:** + +* `` — The MXC URL to fetch + +###### **Options:** + +* `-s`, `--server ` +* `-t`, `--timeout ` + + Default value: `10000` + + + +## `admin media get-remote-thumbnail` + +**Usage:** `admin media get-remote-thumbnail [OPTIONS] ` + +###### **Arguments:** + +* `` — The MXC URL to fetch + +###### **Options:** + +* `-s`, `--server ` +* `-t`, `--timeout ` + + Default value: `10000` +* `--width ` + + Default value: `800` +* `--height ` + + Default value: `800` + + + +## `admin check` + +- Commands for checking integrity + +**Usage:** `admin check ` + +###### **Subcommands:** + +* `check-all-users` — + + + +## `admin check check-all-users` + +**Usage:** `admin check check-all-users` + + + +## `admin debug` + +- Commands for debugging things + +**Usage:** `admin debug ` + +###### **Subcommands:** + +* `echo` — - Echo input of admin command +* `get-auth-chain` — - Get the auth_chain of a PDU +* `parse-pdu` — - Parse and print a PDU from a JSON +* `get-pdu` — - Retrieve and print a PDU by EventID from the Continuwuity database +* `get-short-pdu` — - Retrieve and print a PDU by PduId from the Continuwuity database +* `get-remote-pdu` — - Attempts to retrieve a PDU from a remote server. Inserts it into our database/timeline if found and we do not have this PDU already (following normal event auth rules, handles it as an incoming PDU) +* `get-remote-pdu-list` — - Same as `get-remote-pdu` but accepts a codeblock newline delimited list of PDUs and a single server to fetch from +* `get-room-state` — - Gets all the room state events for the specified room +* `get-signing-keys` — - Get and display signing keys from local cache or remote server +* `get-verify-keys` — - Get and display signing keys from local cache or remote server +* `ping` — - Sends a federation request to the remote server's `/_matrix/federation/v1/version` endpoint and measures the latency it took for the server to respond +* `force-device-list-updates` — - Forces device lists for all local and remote users to be updated (as having new keys available) +* `change-log-level` — - Change tracing log level/filter on the fly +* `sign-json` — - Sign JSON blob +* `verify-json` — - Verify JSON signatures +* `verify-pdu` — - Verify PDU +* `first-pdu-in-room` — - Prints the very first PDU in the specified room (typically m.room.create) +* `latest-pdu-in-room` — - Prints the latest ("last") PDU in the specified room (typically a message) +* `force-set-room-state-from-server` — - Forcefully replaces the room state of our local copy of the specified room, with the copy (auth chain and room state events) the specified remote server says +* `resolve-true-destination` — - Runs a server name through Continuwuity's true destination resolution process +* `memory-stats` — - Print extended memory usage +* `runtime-metrics` — - Print general tokio runtime metric totals +* `runtime-interval` — - Print detailed tokio runtime metrics accumulated since last command invocation +* `time` — - Print the current time +* `list-dependencies` — - List dependencies +* `database-stats` — - Get database statistics +* `trim-memory` — - Trim memory usage +* `database-files` — - List database files + + + +## `admin debug echo` + +- Echo input of admin command + +**Usage:** `admin debug echo [MESSAGE]...` + +###### **Arguments:** + +* `` + + + +## `admin debug get-auth-chain` + +- Get the auth_chain of a PDU + +**Usage:** `admin debug get-auth-chain ` + +###### **Arguments:** + +* `` — An event ID (the $ character followed by the base64 reference hash) + + + +## `admin debug parse-pdu` + +- Parse and print a PDU from a JSON + +The PDU event is only checked for validity and is not added to the database. + +This command needs a JSON blob provided in a Markdown code block below the command. + +**Usage:** `admin debug parse-pdu` + + + +## `admin debug get-pdu` + +- Retrieve and print a PDU by EventID from the Continuwuity database + +**Usage:** `admin debug get-pdu ` + +###### **Arguments:** + +* `` — An event ID (a $ followed by the base64 reference hash) + + + +## `admin debug get-short-pdu` + +- Retrieve and print a PDU by PduId from the Continuwuity database + +**Usage:** `admin debug get-short-pdu ` + +###### **Arguments:** + +* `` — Shortroomid integer +* `` — Shorteventid integer + + + +## `admin debug get-remote-pdu` + +- Attempts to retrieve a PDU from a remote server. Inserts it into our database/timeline if found and we do not have this PDU already (following normal event auth rules, handles it as an incoming PDU) + +**Usage:** `admin debug get-remote-pdu ` + +###### **Arguments:** + +* `` — An event ID (a $ followed by the base64 reference hash) +* `` — Argument for us to attempt to fetch the event from the specified remote server + + + +## `admin debug get-remote-pdu-list` + +- Same as `get-remote-pdu` but accepts a codeblock newline delimited list of PDUs and a single server to fetch from + +**Usage:** `admin debug get-remote-pdu-list [OPTIONS] ` + +###### **Arguments:** + +* `` — Argument for us to attempt to fetch all the events from the specified remote server + +###### **Options:** + +* `-f`, `--force` — If set, ignores errors, else stops at the first error/failure + + + +## `admin debug get-room-state` + +- Gets all the room state events for the specified room. + +This is functionally equivalent to `GET /_matrix/client/v3/rooms/{roomid}/state`, except the admin command does *not* check if the sender user is allowed to see state events. This is done because it's implied that server admins here have database access and can see/get room info themselves anyways if they were malicious admins. + +Of course the check is still done on the actual client API. + +**Usage:** `admin debug get-room-state ` + +###### **Arguments:** + +* `` — Room ID + + + +## `admin debug get-signing-keys` + +- Get and display signing keys from local cache or remote server + +**Usage:** `admin debug get-signing-keys [OPTIONS] [SERVER_NAME]` + +###### **Arguments:** + +* `` + +###### **Options:** + +* `--notary ` +* `-q`, `--query` + + + +## `admin debug get-verify-keys` + +- Get and display signing keys from local cache or remote server + +**Usage:** `admin debug get-verify-keys [SERVER_NAME]` + +###### **Arguments:** + +* `` + + + +## `admin debug ping` + +- Sends a federation request to the remote server's `/_matrix/federation/v1/version` endpoint and measures the latency it took for the server to respond + +**Usage:** `admin debug ping ` + +###### **Arguments:** + +* `` + + + +## `admin debug force-device-list-updates` + +- Forces device lists for all local and remote users to be updated (as having new keys available) + +**Usage:** `admin debug force-device-list-updates` + + + +## `admin debug change-log-level` + +- Change tracing log level/filter on the fly + +This accepts the same format as the `log` config option. + +**Usage:** `admin debug change-log-level [OPTIONS] [FILTER]` + +###### **Arguments:** + +* `` — Log level/filter + +###### **Options:** + +* `-r`, `--reset` — Resets the log level/filter to the one in your config + + + +## `admin debug sign-json` + +- Sign JSON blob + +This command needs a JSON blob provided in a Markdown code block below the command. + +**Usage:** `admin debug sign-json` + + + +## `admin debug verify-json` + +- Verify JSON signatures + +This command needs a JSON blob provided in a Markdown code block below the command. + +**Usage:** `admin debug verify-json` + + + +## `admin debug verify-pdu` + +- Verify PDU + +This re-verifies a PDU existing in the database found by ID. + +**Usage:** `admin debug verify-pdu ` + +###### **Arguments:** + +* `` + + + +## `admin debug first-pdu-in-room` + +- Prints the very first PDU in the specified room (typically m.room.create) + +**Usage:** `admin debug first-pdu-in-room ` + +###### **Arguments:** + +* `` — The room ID + + + +## `admin debug latest-pdu-in-room` + +- Prints the latest ("last") PDU in the specified room (typically a message) + +**Usage:** `admin debug latest-pdu-in-room ` + +###### **Arguments:** + +* `` — The room ID + + + +## `admin debug force-set-room-state-from-server` + +- Forcefully replaces the room state of our local copy of the specified room, with the copy (auth chain and room state events) the specified remote server says. + +A common desire for room deletion is to simply "reset" our copy of the room. While this admin command is not a replacement for that, if you know you have split/broken room state and you know another server in the room that has the best/working room state, this command can let you use their room state. Such example is your server saying users are in a room, but other servers are saying they're not in the room in question. + +This command will get the latest PDU in the room we know about, and request the room state at that point in time via `/_matrix/federation/v1/state/{roomId}`. + +**Usage:** `admin debug force-set-room-state-from-server [EVENT_ID]` + +###### **Arguments:** + +* `` — The impacted room ID +* `` — The server we will use to query the room state for +* `` — The event ID of the latest known PDU in the room. Will be found automatically if not provided + + + +## `admin debug resolve-true-destination` + +- Runs a server name through Continuwuity's true destination resolution process + +Useful for debugging well-known issues + +**Usage:** `admin debug resolve-true-destination [OPTIONS] ` + +###### **Arguments:** + +* `` + +###### **Options:** + +* `-n`, `--no-cache` + + + +## `admin debug memory-stats` + +- Print extended memory usage + +Optional argument is a character mask (a sequence of characters in any order) which enable additional extended statistics. Known characters are "abdeglmx". For convenience, a '*' will enable everything. + +**Usage:** `admin debug memory-stats [OPTS]` + +###### **Arguments:** + +* `` + + + +## `admin debug runtime-metrics` + +- Print general tokio runtime metric totals + +**Usage:** `admin debug runtime-metrics` + + + +## `admin debug runtime-interval` + +- Print detailed tokio runtime metrics accumulated since last command invocation + +**Usage:** `admin debug runtime-interval` + + + +## `admin debug time` + +- Print the current time + +**Usage:** `admin debug time` + + + +## `admin debug list-dependencies` + +- List dependencies + +**Usage:** `admin debug list-dependencies [OPTIONS]` + +###### **Options:** + +* `-n`, `--names` + + + +## `admin debug database-stats` + +- Get database statistics + +**Usage:** `admin debug database-stats [OPTIONS] [PROPERTY]` + +###### **Arguments:** + +* `` + +###### **Options:** + +* `-m`, `--map ` + + + +## `admin debug trim-memory` + +- Trim memory usage + +**Usage:** `admin debug trim-memory` + + + +## `admin debug database-files` + +- List database files + +**Usage:** `admin debug database-files [OPTIONS] [MAP]` + +###### **Arguments:** + +* `` + +###### **Options:** + +* `--level ` + + + +## `admin query` + +- Low-level queries for database getters and iterators + +**Usage:** `admin query ` + +###### **Subcommands:** + +* `account-data` — - account_data.rs iterators and getters +* `appservice` — - appservice.rs iterators and getters +* `presence` — - presence.rs iterators and getters +* `room-alias` — - rooms/alias.rs iterators and getters +* `room-state-cache` — - rooms/state_cache iterators and getters +* `room-timeline` — - rooms/timeline iterators and getters +* `globals` — - globals.rs iterators and getters +* `sending` — - sending.rs iterators and getters +* `users` — - users.rs iterators and getters +* `resolver` — - resolver service +* `pusher` — - pusher service +* `short` — - short service +* `raw` — - raw service + + + +## `admin query account-data` + +- account_data.rs iterators and getters + +**Usage:** `admin query account-data ` + +###### **Subcommands:** + +* `changes-since` — - Returns all changes to the account data that happened after `since` +* `account-data-get` — - Searches the account data for a specific kind + + + +## `admin query account-data changes-since` + +- Returns all changes to the account data that happened after `since` + +**Usage:** `admin query account-data changes-since [ROOM_ID]` + +###### **Arguments:** + +* `` — Full user ID +* `` — UNIX timestamp since (u64) +* `` — Optional room ID of the account data + + + +## `admin query account-data account-data-get` + +- Searches the account data for a specific kind + +**Usage:** `admin query account-data account-data-get [ROOM_ID]` + +###### **Arguments:** + +* `` — Full user ID +* `` — Account data event type +* `` — Optional room ID of the account data + + + +## `admin query appservice` + +- appservice.rs iterators and getters + +**Usage:** `admin query appservice ` + +###### **Subcommands:** + +* `get-registration` — - Gets the appservice registration info/details from the ID as a string +* `all` — - Gets all appservice registrations with their ID and registration info + + + +## `admin query appservice get-registration` + +- Gets the appservice registration info/details from the ID as a string + +**Usage:** `admin query appservice get-registration ` + +###### **Arguments:** + +* `` — Appservice registration ID + + + +## `admin query appservice all` + +- Gets all appservice registrations with their ID and registration info + +**Usage:** `admin query appservice all` + + + +## `admin query presence` + +- presence.rs iterators and getters + +**Usage:** `admin query presence ` + +###### **Subcommands:** + +* `get-presence` — - Returns the latest presence event for the given user +* `presence-since` — - Iterator of the most recent presence updates that happened after the event with id `since` + + + +## `admin query presence get-presence` + +- Returns the latest presence event for the given user + +**Usage:** `admin query presence get-presence ` + +###### **Arguments:** + +* `` — Full user ID + + + +## `admin query presence presence-since` + +- Iterator of the most recent presence updates that happened after the event with id `since` + +**Usage:** `admin query presence presence-since ` + +###### **Arguments:** + +* `` — UNIX timestamp since (u64) + + + +## `admin query room-alias` + +- rooms/alias.rs iterators and getters + +**Usage:** `admin query room-alias ` + +###### **Subcommands:** + +* `resolve-local-alias` — +* `local-aliases-for-room` — - Iterator of all our local room aliases for the room ID +* `all-local-aliases` — - Iterator of all our local aliases in our database with their room IDs + + + +## `admin query room-alias resolve-local-alias` + +**Usage:** `admin query room-alias resolve-local-alias ` + +###### **Arguments:** + +* `` — Full room alias + + + +## `admin query room-alias local-aliases-for-room` + +- Iterator of all our local room aliases for the room ID + +**Usage:** `admin query room-alias local-aliases-for-room ` + +###### **Arguments:** + +* `` — Full room ID + + + +## `admin query room-alias all-local-aliases` + +- Iterator of all our local aliases in our database with their room IDs + +**Usage:** `admin query room-alias all-local-aliases` + + + +## `admin query room-state-cache` + +- rooms/state_cache iterators and getters + +**Usage:** `admin query room-state-cache ` + +###### **Subcommands:** + +* `server-in-room` — +* `room-servers` — +* `server-rooms` — +* `room-members` — +* `local-users-in-room` — +* `active-local-users-in-room` — +* `room-joined-count` — +* `room-invited-count` — +* `room-user-once-joined` — +* `room-members-invited` — +* `get-invite-count` — +* `get-left-count` — +* `rooms-joined` — +* `rooms-left` — +* `rooms-invited` — +* `invite-state` — + + + +## `admin query room-state-cache server-in-room` + +**Usage:** `admin query room-state-cache server-in-room ` + +###### **Arguments:** + +* `` +* `` + + + +## `admin query room-state-cache room-servers` + +**Usage:** `admin query room-state-cache room-servers ` + +###### **Arguments:** + +* `` + + + +## `admin query room-state-cache server-rooms` + +**Usage:** `admin query room-state-cache server-rooms ` + +###### **Arguments:** + +* `` + + + +## `admin query room-state-cache room-members` + +**Usage:** `admin query room-state-cache room-members ` + +###### **Arguments:** + +* `` + + + +## `admin query room-state-cache local-users-in-room` + +**Usage:** `admin query room-state-cache local-users-in-room ` + +###### **Arguments:** + +* `` + + + +## `admin query room-state-cache active-local-users-in-room` + +**Usage:** `admin query room-state-cache active-local-users-in-room ` + +###### **Arguments:** + +* `` + + + +## `admin query room-state-cache room-joined-count` + +**Usage:** `admin query room-state-cache room-joined-count ` + +###### **Arguments:** + +* `` + + + +## `admin query room-state-cache room-invited-count` + +**Usage:** `admin query room-state-cache room-invited-count ` + +###### **Arguments:** + +* `` + + + +## `admin query room-state-cache room-user-once-joined` + +**Usage:** `admin query room-state-cache room-user-once-joined ` + +###### **Arguments:** + +* `` + + + +## `admin query room-state-cache room-members-invited` + +**Usage:** `admin query room-state-cache room-members-invited ` + +###### **Arguments:** + +* `` + + + +## `admin query room-state-cache get-invite-count` + +**Usage:** `admin query room-state-cache get-invite-count ` + +###### **Arguments:** + +* `` +* `` + + + +## `admin query room-state-cache get-left-count` + +**Usage:** `admin query room-state-cache get-left-count ` + +###### **Arguments:** + +* `` +* `` + + + +## `admin query room-state-cache rooms-joined` + +**Usage:** `admin query room-state-cache rooms-joined ` + +###### **Arguments:** + +* `` + + + +## `admin query room-state-cache rooms-left` + +**Usage:** `admin query room-state-cache rooms-left ` + +###### **Arguments:** + +* `` + + + +## `admin query room-state-cache rooms-invited` + +**Usage:** `admin query room-state-cache rooms-invited ` + +###### **Arguments:** + +* `` + + + +## `admin query room-state-cache invite-state` + +**Usage:** `admin query room-state-cache invite-state ` + +###### **Arguments:** + +* `` +* `` + + + +## `admin query room-timeline` + +- rooms/timeline iterators and getters + +**Usage:** `admin query room-timeline ` + +###### **Subcommands:** + +* `pdus` — +* `last` — + + + +## `admin query room-timeline pdus` + +**Usage:** `admin query room-timeline pdus [OPTIONS] [FROM]` + +###### **Arguments:** + +* `` +* `` + +###### **Options:** + +* `-l`, `--limit ` + + + +## `admin query room-timeline last` + +**Usage:** `admin query room-timeline last ` + +###### **Arguments:** + +* `` + + + +## `admin query globals` + +- globals.rs iterators and getters + +**Usage:** `admin query globals ` + +###### **Subcommands:** + +* `database-version` — +* `current-count` — +* `last-check-for-announcements-id` — +* `signing-keys-for` — - This returns an empty `Ok(BTreeMap<..>)` when there are no keys found for the server + + + +## `admin query globals database-version` + +**Usage:** `admin query globals database-version` + + + +## `admin query globals current-count` + +**Usage:** `admin query globals current-count` + + + +## `admin query globals last-check-for-announcements-id` + +**Usage:** `admin query globals last-check-for-announcements-id` + + + +## `admin query globals signing-keys-for` + +- This returns an empty `Ok(BTreeMap<..>)` when there are no keys found for the server + +**Usage:** `admin query globals signing-keys-for ` + +###### **Arguments:** + +* `` + + + +## `admin query sending` + +- sending.rs iterators and getters + +**Usage:** `admin query sending ` + +###### **Subcommands:** + +* `active-requests` — - Queries database for all `servercurrentevent_data` +* `active-requests-for` — - Queries database for `servercurrentevent_data` but for a specific destination +* `queued-requests` — - Queries database for `servernameevent_data` which are the queued up requests that will eventually be sent +* `get-latest-edu-count` — + + + +## `admin query sending active-requests` + +- Queries database for all `servercurrentevent_data` + +**Usage:** `admin query sending active-requests` + + + +## `admin query sending active-requests-for` + +- Queries database for `servercurrentevent_data` but for a specific destination + +This command takes only *one* format of these arguments: + +appservice_id server_name user_id AND push_key + +See src/service/sending/mod.rs for the definition of the `Destination` enum + +**Usage:** `admin query sending active-requests-for [OPTIONS]` + +###### **Options:** + +* `-a`, `--appservice-id ` +* `-s`, `--server-name ` +* `-u`, `--user-id ` +* `-p`, `--push-key ` + + + +## `admin query sending queued-requests` + +- Queries database for `servernameevent_data` which are the queued up requests that will eventually be sent + +This command takes only *one* format of these arguments: + +appservice_id server_name user_id AND push_key + +See src/service/sending/mod.rs for the definition of the `Destination` enum + +**Usage:** `admin query sending queued-requests [OPTIONS]` + +###### **Options:** + +* `-a`, `--appservice-id ` +* `-s`, `--server-name ` +* `-u`, `--user-id ` +* `-p`, `--push-key ` + + + +## `admin query sending get-latest-edu-count` + +**Usage:** `admin query sending get-latest-edu-count ` + +###### **Arguments:** + +* `` + + + +## `admin query users` + +- users.rs iterators and getters + +**Usage:** `admin query users ` + +###### **Subcommands:** + +* `count-users` — +* `iter-users` — +* `iter-users2` — +* `password-hash` — +* `list-devices` — +* `list-devices-metadata` — +* `get-device-metadata` — +* `get-devices-version` — +* `count-one-time-keys` — +* `get-device-keys` — +* `get-user-signing-key` — +* `get-master-key` — +* `get-to-device-events` — +* `get-latest-backup` — +* `get-latest-backup-version` — +* `get-backup-algorithm` — +* `get-all-backups` — +* `get-room-backups` — +* `get-backup-session` — +* `get-shared-rooms` — + + + +## `admin query users count-users` + +**Usage:** `admin query users count-users` + + + +## `admin query users iter-users` + +**Usage:** `admin query users iter-users` + + + +## `admin query users iter-users2` + +**Usage:** `admin query users iter-users2` + + + +## `admin query users password-hash` + +**Usage:** `admin query users password-hash ` + +###### **Arguments:** + +* `` + + + +## `admin query users list-devices` + +**Usage:** `admin query users list-devices ` + +###### **Arguments:** + +* `` + + + +## `admin query users list-devices-metadata` + +**Usage:** `admin query users list-devices-metadata ` + +###### **Arguments:** + +* `` + + + +## `admin query users get-device-metadata` + +**Usage:** `admin query users get-device-metadata ` + +###### **Arguments:** + +* `` +* `` + + + +## `admin query users get-devices-version` + +**Usage:** `admin query users get-devices-version ` + +###### **Arguments:** + +* `` + + + +## `admin query users count-one-time-keys` + +**Usage:** `admin query users count-one-time-keys ` + +###### **Arguments:** + +* `` +* `` + + + +## `admin query users get-device-keys` + +**Usage:** `admin query users get-device-keys ` + +###### **Arguments:** + +* `` +* `` + + + +## `admin query users get-user-signing-key` + +**Usage:** `admin query users get-user-signing-key ` + +###### **Arguments:** + +* `` + + + +## `admin query users get-master-key` + +**Usage:** `admin query users get-master-key ` + +###### **Arguments:** + +* `` + + + +## `admin query users get-to-device-events` + +**Usage:** `admin query users get-to-device-events ` + +###### **Arguments:** + +* `` +* `` + + + +## `admin query users get-latest-backup` + +**Usage:** `admin query users get-latest-backup ` + +###### **Arguments:** + +* `` + + + +## `admin query users get-latest-backup-version` + +**Usage:** `admin query users get-latest-backup-version ` + +###### **Arguments:** + +* `` + + + +## `admin query users get-backup-algorithm` + +**Usage:** `admin query users get-backup-algorithm ` + +###### **Arguments:** + +* `` +* `` + + + +## `admin query users get-all-backups` + +**Usage:** `admin query users get-all-backups ` + +###### **Arguments:** + +* `` +* `` + + + +## `admin query users get-room-backups` + +**Usage:** `admin query users get-room-backups ` + +###### **Arguments:** + +* `` +* `` +* `` + + + +## `admin query users get-backup-session` + +**Usage:** `admin query users get-backup-session ` + +###### **Arguments:** + +* `` +* `` +* `` +* `` + + + +## `admin query users get-shared-rooms` + +**Usage:** `admin query users get-shared-rooms ` + +###### **Arguments:** + +* `` +* `` + + + +## `admin query resolver` + +- resolver service + +**Usage:** `admin query resolver ` + +###### **Subcommands:** + +* `destinations-cache` — Query the destinations cache +* `overrides-cache` — Query the overrides cache + + + +## `admin query resolver destinations-cache` + +Query the destinations cache + +**Usage:** `admin query resolver destinations-cache [SERVER_NAME]` + +###### **Arguments:** + +* `` + + + +## `admin query resolver overrides-cache` + +Query the overrides cache + +**Usage:** `admin query resolver overrides-cache [NAME]` + +###### **Arguments:** + +* `` + + + +## `admin query pusher` + +- pusher service + +**Usage:** `admin query pusher ` + +###### **Subcommands:** + +* `get-pushers` — - Returns all the pushers for the user + + + +## `admin query pusher get-pushers` + +- Returns all the pushers for the user + +**Usage:** `admin query pusher get-pushers ` + +###### **Arguments:** + +* `` — Full user ID + + + +## `admin query short` + +- short service + +**Usage:** `admin query short ` + +###### **Subcommands:** + +* `short-event-id` — +* `short-room-id` — + + + +## `admin query short short-event-id` + +**Usage:** `admin query short short-event-id ` + +###### **Arguments:** + +* `` + + + +## `admin query short short-room-id` + +**Usage:** `admin query short short-room-id ` + +###### **Arguments:** + +* `` + + + +## `admin query raw` + +- raw service + +**Usage:** `admin query raw ` + +###### **Subcommands:** + +* `raw-maps` — - List database maps +* `raw-get` — - Raw database query +* `raw-del` — - Raw database delete (for string keys) +* `raw-keys` — - Raw database keys iteration +* `raw-keys-sizes` — - Raw database key size breakdown +* `raw-keys-total` — - Raw database keys total bytes +* `raw-vals-sizes` — - Raw database values size breakdown +* `raw-vals-total` — - Raw database values total bytes +* `raw-iter` — - Raw database items iteration +* `raw-keys-from` — - Raw database keys iteration +* `raw-iter-from` — - Raw database items iteration +* `raw-count` — - Raw database record count +* `compact` — - Compact database + + + +## `admin query raw raw-maps` + +- List database maps + +**Usage:** `admin query raw raw-maps` + + + +## `admin query raw raw-get` + +- Raw database query + +**Usage:** `admin query raw raw-get ` + +###### **Arguments:** + +* `` — Map name +* `` — Key + + + +## `admin query raw raw-del` + +- Raw database delete (for string keys) + +**Usage:** `admin query raw raw-del ` + +###### **Arguments:** + +* `` — Map name +* `` — Key + + + +## `admin query raw raw-keys` + +- Raw database keys iteration + +**Usage:** `admin query raw raw-keys [PREFIX]` + +###### **Arguments:** + +* `` — Map name +* `` — Key prefix + + + +## `admin query raw raw-keys-sizes` + +- Raw database key size breakdown + +**Usage:** `admin query raw raw-keys-sizes [MAP] [PREFIX]` + +###### **Arguments:** + +* `` — Map name +* `` — Key prefix + + + +## `admin query raw raw-keys-total` + +- Raw database keys total bytes + +**Usage:** `admin query raw raw-keys-total [MAP] [PREFIX]` + +###### **Arguments:** + +* `` — Map name +* `` — Key prefix + + + +## `admin query raw raw-vals-sizes` + +- Raw database values size breakdown + +**Usage:** `admin query raw raw-vals-sizes [MAP] [PREFIX]` + +###### **Arguments:** + +* `` — Map name +* `` — Key prefix + + + +## `admin query raw raw-vals-total` + +- Raw database values total bytes + +**Usage:** `admin query raw raw-vals-total [MAP] [PREFIX]` + +###### **Arguments:** + +* `` — Map name +* `` — Key prefix + + + +## `admin query raw raw-iter` + +- Raw database items iteration + +**Usage:** `admin query raw raw-iter [PREFIX]` + +###### **Arguments:** + +* `` — Map name +* `` — Key prefix + + + +## `admin query raw raw-keys-from` + +- Raw database keys iteration + +**Usage:** `admin query raw raw-keys-from [OPTIONS] ` + +###### **Arguments:** + +* `` — Map name +* `` — Lower-bound + +###### **Options:** + +* `-l`, `--limit ` — Limit + + + +## `admin query raw raw-iter-from` + +- Raw database items iteration + +**Usage:** `admin query raw raw-iter-from [OPTIONS] ` + +###### **Arguments:** + +* `` — Map name +* `` — Lower-bound + +###### **Options:** + +* `-l`, `--limit ` — Limit + + + +## `admin query raw raw-count` + +- Raw database record count + +**Usage:** `admin query raw raw-count [MAP] [PREFIX]` + +###### **Arguments:** + +* `` — Map name +* `` — Key prefix + + + +## `admin query raw compact` + +- Compact database + +**Usage:** `admin query raw compact [OPTIONS]` + +###### **Options:** + +* `-m`, `--map ` +* `--start ` +* `--stop ` +* `--from ` +* `--into ` +* `--parallelism ` — There is one compaction job per column; then this controls how many columns are compacted in parallel. If zero, one compaction job is still run at a time here, but in exclusive-mode blocking any other automatic compaction jobs until complete +* `--exhaustive` + + Default value: `false` diff --git a/docs/deploying/arch-linux.md b/docs/deploying/arch-linux.md index 6e50410d..70067abc 100644 --- a/docs/deploying/arch-linux.md +++ b/docs/deploying/arch-linux.md @@ -1,5 +1,5 @@ # Continuwuity for Arch Linux -Continuwuity is available on the `archlinuxcn` repository and AUR, with the same package name `continuwuity`, which includes latest taggged version. The development version is available on AUR as `continuwuity-git` +Continuwuity is available in the `archlinuxcn` repository and AUR with the same package name `continuwuity`, which includes the latest tagged version. The development version is available on AUR as `continuwuity-git`. -Simply install the `continuwuity` package. Configure the service in `/etc/conduwuit/conduwuit.toml`, then enable/start the continuwuity.service. +Simply install the `continuwuity` package. Configure the service in `/etc/conduwuit/conduwuit.toml`, then enable and start the continuwuity.service. diff --git a/docs/deploying/docker.md b/docs/deploying/docker.md index 051ed89b..a928d081 100644 --- a/docs/deploying/docker.md +++ b/docs/deploying/docker.md @@ -2,7 +2,7 @@ ## Docker -To run Continuwuity with Docker you can either build the image yourself or pull it +To run Continuwuity with Docker, you can either build the image yourself or pull it from a registry. ### Use a registry @@ -26,7 +26,7 @@ to pull it to your machine. ### Run -When you have the image you can simply run it with +When you have the image, you can simply run it with ```bash docker run -d -p 8448:6167 \ @@ -36,7 +36,7 @@ docker run -d -p 8448:6167 \ --name continuwuity $LINK ``` -or you can use [docker compose](#docker-compose). +or you can use [Docker Compose](#docker-compose). The `-d` flag lets the container run in detached mode. You may supply an optional `continuwuity.toml` config file, the example config can be found @@ -46,15 +46,15 @@ using env vars. For an overview of possible values, please take a look at the [`docker-compose.yml`](docker-compose.yml) file. If you just want to test Continuwuity for a short time, you can use the `--rm` -flag, which will clean up everything related to your container after you stop +flag, which cleans up everything related to your container after you stop it. ### Docker-compose -If the `docker run` command is not for you or your setup, you can also use one +If the `docker run` command is not suitable for you or your setup, you can also use one of the provided `docker-compose` files. -Depending on your proxy setup, you can use one of the following files; +Depending on your proxy setup, you can use one of the following files: - If you already have a `traefik` instance set up, use [`docker-compose.for-traefik.yml`](docker-compose.for-traefik.yml) @@ -65,7 +65,7 @@ Depending on your proxy setup, you can use one of the following files; `example.com` placeholders with your own domain - For any other reverse proxy, use [`docker-compose.yml`](docker-compose.yml) -When picking the traefik-related compose file, rename it so it matches +When picking the Traefik-related compose file, rename it to `docker-compose.yml`, and rename the override file to `docker-compose.override.yml`. Edit the latter with the values you want for your server. @@ -77,18 +77,18 @@ create the `caddy` network before spinning up the containers: docker network create caddy ``` -After that, you can rename it so it matches `docker-compose.yml` and spin up the +After that, you can rename it to `docker-compose.yml` and spin up the containers! Additional info about deploying Continuwuity can be found [here](generic.md). ### Build -Official Continuwuity images are built using **Docker Buildx** and the Dockerfile found at [`docker/Dockerfile`][dockerfile-path]. This approach uses common Docker tooling and enables multi-platform builds efficiently. +Official Continuwuity images are built using **Docker Buildx** and the Dockerfile found at [`docker/Dockerfile`][dockerfile-path]. This approach uses common Docker tooling and enables efficient multi-platform builds. -The resulting images are broadly compatible with Docker and other container runtimes like Podman or containerd. +The resulting images are widely compatible with Docker and other container runtimes like Podman or containerd. -The images *do not contain a shell*. They contain only the Continuwuity binary, required libraries, TLS certificates and metadata. Please refer to the [`docker/Dockerfile`][dockerfile-path] for the specific details of the image composition. +The images *do not contain a shell*. They contain only the Continuwuity binary, required libraries, TLS certificates, and metadata. Please refer to the [`docker/Dockerfile`][dockerfile-path] for the specific details of the image composition. To build an image locally using Docker Buildx, you can typically run a command like: @@ -109,8 +109,8 @@ Refer to the Docker Buildx documentation for more advanced build options. ### Run -If you already have built the image or want to use one from the registries, you -can just start the container and everything else in the compose file in detached +If you have already built the image or want to use one from the registries, you +can start the container and everything else in the compose file in detached mode with: ```bash @@ -121,22 +121,24 @@ docker compose up -d ### Use Traefik as Proxy -As a container user, you probably know about Traefik. It is a easy to use -reverse proxy for making containerized app and services available through the +As a container user, you probably know about Traefik. It is an easy-to-use +reverse proxy for making containerized apps and services available through the web. With the two provided files, [`docker-compose.for-traefik.yml`](docker-compose.for-traefik.yml) (or [`docker-compose.with-traefik.yml`](docker-compose.with-traefik.yml)) and [`docker-compose.override.yml`](docker-compose.override.yml), it is equally easy -to deploy and use Continuwuity, with a little caveat. If you already took a look at -the files, then you should have seen the `well-known` service, and that is the -little caveat. Traefik is simply a proxy and loadbalancer and is not able to -serve any kind of content, but for Continuwuity to federate, we need to either -expose ports `443` and `8448` or serve two endpoints `.well-known/matrix/client` +to deploy and use Continuwuity, with a small caveat. If you have already looked at +the files, you should have seen the `well-known` service, which is the +small caveat. Traefik is simply a proxy and load balancer and cannot +serve any kind of content. For Continuwuity to federate, we need to either +expose ports `443` and `8448` or serve two endpoints: `.well-known/matrix/client` and `.well-known/matrix/server`. -With the service `well-known` we use a single `nginx` container that will serve +With the service `well-known`, we use a single `nginx` container that serves those two files. +Alternatively, you can use Continuwuity's built-in delegation file capability. Set up the delegation files in the configuration file, and then proxy paths under `/.well-known/matrix` to continuwuity. For example, the label ``traefik.http.routers.continuwuity.rule=(Host(`matrix.ellis.link`) || (Host(`ellis.link`) && PathPrefix(`/.well-known/matrix`)))`` does this for the domain `ellis.link`. + ## Voice communication See the [TURN](../turn.md) page. diff --git a/docs/deploying/freebsd.md b/docs/deploying/freebsd.md index 3764ffa8..c637e0d9 100644 --- a/docs/deploying/freebsd.md +++ b/docs/deploying/freebsd.md @@ -1,5 +1,5 @@ # Continuwuity for FreeBSD -Continuwuity at the moment does not provide FreeBSD builds or have FreeBSD packaging, however Continuwuity does build and work on FreeBSD using the system-provided RocksDB. +Continuwuity currently does not provide FreeBSD builds or FreeBSD packaging. However, Continuwuity does build and work on FreeBSD using the system-provided RocksDB. -Contributions for getting Continuwuity packaged are welcome. +Contributions to get Continuwuity packaged for FreeBSD are welcome. diff --git a/docs/deploying/generic.md b/docs/deploying/generic.md index 9128f346..5e7f253b 100644 --- a/docs/deploying/generic.md +++ b/docs/deploying/generic.md @@ -13,31 +13,42 @@ You may simply download the binary that fits your machine architecture (x86_64 or aarch64). Run `uname -m` to see what you need. -Prebuilt fully static musl binaries can be downloaded from the latest tagged +You can download prebuilt fully static musl binaries from the latest tagged release [here](https://forgejo.ellis.link/continuwuation/continuwuity/releases/latest) or -`main` CI branch workflow artifact output. These also include Debian/Ubuntu +from the `main` CI branch workflow artifact output. These also include Debian/Ubuntu packages. -These can be curl'd directly from. `ci-bins` are CI workflow binaries by commit +You can download these directly using curl. The `ci-bins` are CI workflow binaries organized by commit hash/revision, and `releases` are tagged releases. Sort by descending last -modified for the latest. +modified date to find the latest. These binaries have jemalloc and io_uring statically linked and included with them, so no additional dynamic dependencies need to be installed. -For the **best** performance; if using an `x86_64` CPU made in the last ~15 years, -we recommend using the `-haswell-` optimised binaries. This sets -`-march=haswell` which is the most compatible and highest performance with -optimised binaries. The database backend, RocksDB, most benefits from this as it -will then use hardware accelerated CRC32 hashing/checksumming which is critical +For the **best** performance: if you are using an `x86_64` CPU made in the last ~15 years, +we recommend using the `-haswell-` optimized binaries. These set +`-march=haswell`, which provides the most compatible and highest performance with +optimized binaries. The database backend, RocksDB, benefits most from this as it +uses hardware-accelerated CRC32 hashing/checksumming, which is critical for performance. ### Compiling -Alternatively, you may compile the binary yourself. We recommend using -Nix (or [Lix](https://lix.systems)) to build Continuwuity as this has the most -guaranteed reproducibiltiy and easiest to get a build environment and output -going. This also allows easy cross-compilation. +Alternatively, you may compile the binary yourself. + +### Building with the Rust toolchain + +If wanting to build using standard Rust toolchains, make sure you install: + +- (On linux) `liburing-dev` on the compiling machine, and `liburing` on the target host +- (On linux) `pkg-config` on the compiling machine to allow finding `liburing` +- A C++ compiler and (on linux) `libclang` for RocksDB + +You can build Continuwuity using `cargo build --release --all-features`. + +### Building with Nix + +If you prefer, you can use Nix (or [Lix](https://lix.systems)) to build Continuwuity. This provides improved reproducibility and makes it easy to set up a build environment and generate output. This approach also allows for easy cross-compilation. You can run the `nix build -L .#static-x86_64-linux-musl-all-features` or `nix build -L .#static-aarch64-linux-musl-all-features` commands based @@ -45,17 +56,11 @@ on architecture to cross-compile the necessary static binary located at `result/bin/conduwuit`. This is reproducible with the static binaries produced in our CI. -If wanting to build using standard Rust toolchains, make sure you install: -- `liburing-dev` on the compiling machine, and `liburing` on the target host -- LLVM and libclang for RocksDB - -You can build Continuwuity using `cargo build --release --all-features` - ## Adding a Continuwuity user -While Continuwuity can run as any user it is better to use dedicated users for -different services. This also allows you to make sure that the file permissions -are correctly set up. +While Continuwuity can run as any user, it is better to use dedicated users for +different services. This also ensures that the file permissions +are set up correctly. In Debian, you can use this command to create a Continuwuity user: @@ -71,18 +76,18 @@ sudo useradd -r --shell /usr/bin/nologin --no-create-home continuwuity ## Forwarding ports in the firewall or the router -Matrix's default federation port is port 8448, and clients must be using port 443. -If you would like to use only port 443, or a different port, you will need to setup -delegation. Continuwuity has config options for doing delegation, or you can configure -your reverse proxy to manually serve the necessary JSON files to do delegation +Matrix's default federation port is 8448, and clients must use port 443. +If you would like to use only port 443 or a different port, you will need to set up +delegation. Continuwuity has configuration options for delegation, or you can configure +your reverse proxy to manually serve the necessary JSON files for delegation (see the `[global.well_known]` config section). If Continuwuity runs behind a router or in a container and has a different public -IP address than the host system these public ports need to be forwarded directly -or indirectly to the port mentioned in the config. +IP address than the host system, you need to forward these public ports directly +or indirectly to the port mentioned in the configuration. -Note for NAT users; if you have trouble connecting to your server from the inside -of your network, you need to research your router and see if it supports "NAT +Note for NAT users: if you have trouble connecting to your server from inside +your network, check if your router supports "NAT hairpinning" or "NAT loopback". If your router does not support this feature, you need to research doing local @@ -92,19 +97,19 @@ on the network level, consider something like NextDNS or Pi-Hole. ## Setting up a systemd service -Two example systemd units for Continuwuity can be found +You can find two example systemd units for Continuwuity [on the configuration page](../configuration/examples.md#debian-systemd-unit-file). -You may need to change the `ExecStart=` path to where you placed the Continuwuity -binary if it is not `/usr/bin/conduwuit`. +You may need to change the `ExecStart=` path to match where you placed the Continuwuity +binary if it is not in `/usr/bin/conduwuit`. On systems where rsyslog is used alongside journald (i.e. Red Hat-based distros and OpenSUSE), put `$EscapeControlCharactersOnReceive off` inside `/etc/rsyslog.conf` to allow color in logs. -If you are using a different `database_path` other than the systemd unit +If you are using a different `database_path` than the systemd unit's configured default `/var/lib/conduwuit`, you need to add your path to the -systemd unit's `ReadWritePaths=`. This can be done by either directly editing -`conduwuit.service` and reloading systemd, or running `systemctl edit conduwuit.service` +systemd unit's `ReadWritePaths=`. You can do this by either directly editing +`conduwuit.service` and reloading systemd, or by running `systemctl edit conduwuit.service` and entering the following: ``` @@ -114,8 +119,8 @@ ReadWritePaths=/path/to/custom/database/path ## Creating the Continuwuity configuration file -Now we need to create the Continuwuity's config file in -`/etc/continuwuity/continuwuity.toml`. The example config can be found at +Now you need to create the Continuwuity configuration file in +`/etc/continuwuity/continuwuity.toml`. You can find an example configuration at [conduwuit-example.toml](../configuration/examples.md). **Please take a moment to read the config. You need to change at least the @@ -125,8 +130,8 @@ RocksDB is the only supported database backend. ## Setting the correct file permissions -If you are using a dedicated user for Continuwuity, you will need to allow it to -read the config. To do that you can run this: +If you are using a dedicated user for Continuwuity, you need to allow it to +read the configuration. To do this, run: ```bash sudo chown -R root:root /etc/conduwuit @@ -143,13 +148,13 @@ sudo chmod 700 /var/lib/conduwuit/ ## Setting up the Reverse Proxy -We recommend Caddy as a reverse proxy, as it is trivial to use, handling TLS certificates, reverse proxy headers, etc transparently with proper defaults. +We recommend Caddy as a reverse proxy because it is trivial to use and handles TLS certificates, reverse proxy headers, etc. transparently with proper defaults. For other software, please refer to their respective documentation or online guides. ### Caddy After installing Caddy via your preferred method, create `/etc/caddy/conf.d/conduwuit_caddyfile` -and enter this (substitute for your server name). +and enter the following (substitute your actual server name): ```caddyfile your.server.name, your.server.name:8448 { @@ -168,9 +173,9 @@ sudo systemctl enable --now caddy ### Other Reverse Proxies -As we would prefer our users to use Caddy, we will not provide configuration files for other proxys. +As we prefer our users to use Caddy, we do not provide configuration files for other proxies. -You will need to reverse proxy everything under following routes: +You will need to reverse proxy everything under the following routes: - `/_matrix/` - core Matrix C-S and S-S APIs - `/_conduwuit/` - ad-hoc Continuwuity routes such as `/local_user_count` and `/server_version` @@ -193,16 +198,16 @@ Examples of delegation: For Apache and Nginx there are many examples available online. -Lighttpd is not supported as it seems to mess with the `X-Matrix` Authorization -header, making federation non-functional. If a workaround is found, feel free to share to get it added to the documentation here. +Lighttpd is not supported as it appears to interfere with the `X-Matrix` Authorization +header, making federation non-functional. If you find a workaround, please share it so we can add it to this documentation. -If using Apache, you need to use `nocanon` in your `ProxyPass` directive to prevent httpd from messing with the `X-Matrix` header (note that Apache isn't very good as a general reverse proxy and we discourage the usage of it if you can). +If using Apache, you need to use `nocanon` in your `ProxyPass` directive to prevent httpd from interfering with the `X-Matrix` header (note that Apache is not ideal as a general reverse proxy, so we discourage using it if alternatives are available). -If using Nginx, you need to give Continuwuity the request URI using `$request_uri`, or like so: +If using Nginx, you need to pass the request URI to Continuwuity using `$request_uri`, like this: - `proxy_pass http://127.0.0.1:6167$request_uri;` - `proxy_pass http://127.0.0.1:6167;` -Nginx users need to increase `client_max_body_size` (default is 1M) to match +Nginx users need to increase the `client_max_body_size` setting (default is 1M) to match the `max_request_size` defined in conduwuit.toml. ## You're done @@ -222,7 +227,7 @@ sudo systemctl enable conduwuit ## How do I know it works? You can open [a Matrix client](https://matrix.org/ecosystem/clients), enter your -homeserver and try to register. +homeserver address, and try to register. You can also use these commands as a quick health check (replace `your.server.name`). @@ -237,10 +242,10 @@ curl https://your.server.name:8448/_conduwuit/server_version curl https://your.server.name:8448/_matrix/federation/v1/version ``` -- To check if your server can talk with other homeservers, you can use the +- To check if your server can communicate with other homeservers, use the [Matrix Federation Tester](https://federationtester.matrix.org/). If you can -register but cannot join federated rooms check your config again and also check -if the port 8448 is open and forwarded correctly. +register but cannot join federated rooms, check your configuration and verify +that port 8448 is open and forwarded correctly. # What's next? diff --git a/docs/deploying/kubernetes.md b/docs/deploying/kubernetes.md index 0cbfbbc0..2750e3fb 100644 --- a/docs/deploying/kubernetes.md +++ b/docs/deploying/kubernetes.md @@ -1,9 +1,9 @@ # Continuwuity for Kubernetes Continuwuity doesn't support horizontal scalability or distributed loading -natively, however a community maintained Helm Chart is available here to run +natively. However, a community-maintained Helm Chart is available here to run conduwuit on Kubernetes: -This should be compatible with continuwuity, but you will need to change the image reference. +This should be compatible with Continuwuity, but you will need to change the image reference. -Should changes need to be made, please reach out to the maintainer as this is not maintained/controlled by the Continuwuity maintainers. +If changes need to be made, please reach out to the maintainer, as this is not maintained or controlled by the Continuwuity maintainers. diff --git a/docs/deploying/nixos.md b/docs/deploying/nixos.md index 2fdcbe5c..29517416 100644 --- a/docs/deploying/nixos.md +++ b/docs/deploying/nixos.md @@ -1,75 +1,130 @@ # Continuwuity for NixOS -Continuwuity can be acquired by Nix (or [Lix][lix]) from various places: +NixOS packages Continuwuity as `matrix-continuwuity`. This package includes both the Continuwuity software and a dedicated NixOS module for configuration and deployment. -* The `flake.nix` at the root of the repo -* The `default.nix` at the root of the repo -* From Continuwuity's binary cache +## Installation methods -### NixOS module +You can acquire Continuwuity with Nix (or [Lix][lix]) from these sources: -The `flake.nix` and `default.nix` do not currently provide a NixOS module (contributions -welcome!), so [`services.matrix-conduit`][module] from Nixpkgs can be used to configure -Continuwuity. +* Directly from Nixpkgs using the official package (`pkgs.matrix-continuwuity`) +* The `flake.nix` at the root of the Continuwuity repo +* The `default.nix` at the root of the Continuwuity repo -### Conduit NixOS Config Module and SQLite +## NixOS module -Beware! The [`services.matrix-conduit`][module] module defaults to SQLite as a database backend. -Continuwuity dropped SQLite support in favor of exclusively supporting the much faster RocksDB. -Make sure that you are using the RocksDB backend before migrating! +Continuwuity now has an official NixOS module that simplifies configuration and deployment. The module is available in Nixpkgs as `services.matrix-continuwuity` from NixOS 25.05. -There is a [tool to migrate a Conduit SQLite database to -RocksDB](https://github.com/ShadowJonathan/conduit_toolbox/). +Here's a basic example of how to use the module: -If you want to run the latest code, you should get Continuwuity from the `flake.nix` -or `default.nix` and set [`services.matrix-conduit.package`][package] -appropriately to use Continuwuity instead of Conduit. +```nix +{ config, pkgs, ... }: + +{ + services.matrix-continuwuity = { + enable = true; + settings = { + global = { + server_name = "example.com"; + # Listening on localhost by default + # address and port are handled automatically + allow_registration = false; + allow_encryption = true; + allow_federation = true; + trusted_servers = [ "matrix.org" ]; + }; + }; + }; +} +``` + +### Available options + +The NixOS module provides these configuration options: + +- `enable`: Enable the Continuwuity service +- `user`: The user to run Continuwuity as (defaults to "continuwuity") +- `group`: The group to run Continuwuity as (defaults to "continuwuity") +- `extraEnvironment`: Extra environment variables to pass to the Continuwuity server +- `package`: The Continuwuity package to use +- `settings`: The Continuwuity configuration (in TOML format) + +Use the `settings` option to configure Continuwuity itself. See the [example configuration file](../configuration/examples.md#example-configuration) for all available options. ### UNIX sockets -Due to the lack of a Continuwuity NixOS module, when using the `services.matrix-conduit` module -a workaround like the one below is necessary to use UNIX sockets. This is because the UNIX -socket option does not exist in Conduit, and the module forcibly sets the `address` and -`port` config options. +The NixOS module natively supports UNIX sockets through the `global.unix_socket_path` option. When using UNIX sockets, set `global.address` to `null`: ```nix -options.services.matrix-conduit.settings = lib.mkOption { - apply = old: old // ( - if (old.global ? "unix_socket_path") - then { global = builtins.removeAttrs old.global [ "address" "port" ]; } - else { } - ); +services.matrix-continuwuity = { + enable = true; + settings = { + global = { + server_name = "example.com"; + address = null; # Must be null when using unix_socket_path + unix_socket_path = "/run/continuwuity/continuwuity.sock"; + unix_socket_perms = 660; # Default permissions for the socket + # ... + }; + }; }; - ``` -Additionally, the [`matrix-conduit` systemd unit][systemd-unit] in the module does not allow -the `AF_UNIX` socket address family in their systemd unit's `RestrictAddressFamilies=` which -disallows the namespace from accessing or creating UNIX sockets and has to be enabled like so: +The module automatically sets the correct `RestrictAddressFamilies` in the systemd service configuration to allow access to UNIX sockets. -```nix -systemd.services.conduit.serviceConfig.RestrictAddressFamilies = [ "AF_UNIX" ]; -``` +### RocksDB database -Even though those workarounds are feasible a Continuwuity NixOS configuration module, developed and -published by the community, would be appreciated. +Continuwuity exclusively uses RocksDB as its database backend. The system configures the database path automatically to `/var/lib/continuwuity/` and you cannot change it due to the service's reliance on systemd's StateDir. + +If you're migrating from Conduit with SQLite, use this [tool to migrate a Conduit SQLite database to RocksDB](https://github.com/ShadowJonathan/conduit_toolbox/). ### jemalloc and hardened profile -Continuwuity uses jemalloc by default. This may interfere with the [`hardened.nix` profile][hardened.nix] -due to them using `scudo` by default. You must either disable/hide `scudo` from Continuwuity, or -disable jemalloc like so: +Continuwuity uses jemalloc by default. This may interfere with the [`hardened.nix` profile][hardened.nix] because it uses `scudo` by default. Either disable/hide `scudo` from Continuwuity or disable jemalloc like this: ```nix -let - conduwuit = pkgs.unstable.conduwuit.override { - enableJemalloc = false; - }; -in +services.matrix-continuwuity = { + enable = true; + package = pkgs.matrix-continuwuity.override { + enableJemalloc = false; + }; + # ... +}; +``` + +## Upgrading from Conduit + +If you previously used Conduit with the `services.matrix-conduit` module: + +1. Ensure your Conduit uses the RocksDB backend, or migrate from SQLite using the [migration tool](https://github.com/ShadowJonathan/conduit_toolbox/) +2. Switch to the new module by changing `services.matrix-conduit` to `services.matrix-continuwuity` in your configuration +3. Update any custom configuration to match the new module's structure + +## Reverse proxy configuration + +You'll need to set up a reverse proxy (like nginx or caddy) to expose Continuwuity to the internet. Configure your reverse proxy to forward requests to `/_matrix` on port 443 and 8448 to your Continuwuity instance. + +Here's an example nginx configuration: + +```nginx +server { + listen 443 ssl; + listen [::]:443 ssl; + listen 8448 ssl; + listen [::]:8448 ssl; + + server_name example.com; + + # SSL configuration here... + + location /_matrix/ { + proxy_pass http://127.0.0.1:6167$request_uri; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + } +} ``` [lix]: https://lix.systems/ -[module]: https://search.nixos.org/options?channel=unstable&query=services.matrix-conduit -[package]: https://search.nixos.org/options?channel=unstable&query=services.matrix-conduit.package -[hardened.nix]: https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/profiles/hardened.nix#L22 -[systemd-unit]: https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/services/matrix/conduit.nix#L132 +[hardened.nix]: https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/profiles/hardened.nix diff --git a/docs/server_reference.md b/docs/server_reference.md new file mode 100644 index 00000000..e34bc51e --- /dev/null +++ b/docs/server_reference.md @@ -0,0 +1,21 @@ +# Command-Line Help for `continuwuity` + +This document contains the help content for the `continuwuity` command-line program. + +**Command Overview:** + +* [`continuwuity`↴](#continuwuity) + +## `continuwuity` + +a very cool Matrix chat homeserver written in Rust + +**Usage:** `continuwuity [OPTIONS]` + +###### **Options:** + +* `-c`, `--config ` — Path to the config TOML file (optional) +* `-O`, `--option