Error running built binary, CONDUIT_CONFIG not set? #423

Closed
opened 2024-02-05 03:07:37 +00:00 by hyperswine · 3 comments
hyperswine commented 2024-02-05 03:07:37 +00:00 (Migrated from gitlab.com)

Description

I did cargo build --release and then tried running it:

$ sudo /home/cswine/Downloads/conduit/target/release/conduit
thread 'main' panicked at src/main.rs:51:55:
The CONDUIT_CONFIG env var needs to be set. Example: /etc/conduit.toml
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

I double checked CONDUIT_CONFIG and it was already set:

$ echo $CONDUIT_CONFIG
/etc/matrix-conduit/conduit.toml

the .toml is:

[global]
# The server_name is the pretty name of this server. It is used as a suffix for user
# and room ids. Examples: matrix.org, conduit.rs

# The Conduit server needs all /_matrix/ requests to be reachable at
# https://your.server.name/ on port 443 (client-server) and 8448 (federation).

# If that's not possible for you, you can create /.well-known files to redirect
# requests. See
# https://matrix.org/docs/spec/client_server/latest#get-well-known-matrix-client
# and
# https://matrix.org/docs/spec/server_server/r0.1.4#get-well-known-matrix-server
# for more information

# YOU NEED TO EDIT THIS
server_name = "<our matrix server>"

# This is the only directory where Conduit will save its data
database_path = "/var/lib/matrix-conduit/"
database_backend = "rocksdb"

# The port Conduit will be running on. You need to set up a reverse proxy in
# your web server (e.g. apache or nginx), so all requests to /_matrix on port
# 443 and 8448 will be forwarded to the Conduit instance running on this port
# Docker users: Don't change this, you'll need to map an external port to this.
port = 6167

# Max size for uploads
max_request_size = 20_000_000 # in bytes

# Enables registration. If set to false, no users can register on this server.
allow_registration = true

allow_federation = true
allow_check_for_updates = true

# Server to get public keys from. You probably shouldn't change this
trusted_servers = ["matrix.org"]

#max_concurrent_requests = 100 # How many requests Conduit sends to other servers at the same time
#log = "warn,state_res=warn,rocket=off,_=off,sled=off"

address = "127.0.0.1" # This makes sure Conduit can only be reached using the reverse proxy
#address = "0.0.0.0" # If Conduit is running in a container, make sure the reverse proxy (ie. Traefik) can reach it.

I also tried installing the .deb and running matrix-conduit, and got the same error. I did the other steps on DEPLOY.md and saw

● conduit.service                                loaded failed failed  Conduit Matrix Server

maybe I did something wrong or am misunderstanding how it works?

System Configuration

Linux vmi1535056 5.15.0-92-generic #102-Ubuntu SMP Wed Jan 10 09:33:48 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux

Conduit Version:
Database backend (default is sqlite): rocksdb

### Description I did `cargo build --release` and then tried running it: ``` $ sudo /home/cswine/Downloads/conduit/target/release/conduit thread 'main' panicked at src/main.rs:51:55: The CONDUIT_CONFIG env var needs to be set. Example: /etc/conduit.toml note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace ``` I double checked `CONDUIT_CONFIG` and it was already set: ``` $ echo $CONDUIT_CONFIG /etc/matrix-conduit/conduit.toml ``` the `.toml` is: ``` [global] # The server_name is the pretty name of this server. It is used as a suffix for user # and room ids. Examples: matrix.org, conduit.rs # The Conduit server needs all /_matrix/ requests to be reachable at # https://your.server.name/ on port 443 (client-server) and 8448 (federation). # If that's not possible for you, you can create /.well-known files to redirect # requests. See # https://matrix.org/docs/spec/client_server/latest#get-well-known-matrix-client # and # https://matrix.org/docs/spec/server_server/r0.1.4#get-well-known-matrix-server # for more information # YOU NEED TO EDIT THIS server_name = "<our matrix server>" # This is the only directory where Conduit will save its data database_path = "/var/lib/matrix-conduit/" database_backend = "rocksdb" # The port Conduit will be running on. You need to set up a reverse proxy in # your web server (e.g. apache or nginx), so all requests to /_matrix on port # 443 and 8448 will be forwarded to the Conduit instance running on this port # Docker users: Don't change this, you'll need to map an external port to this. port = 6167 # Max size for uploads max_request_size = 20_000_000 # in bytes # Enables registration. If set to false, no users can register on this server. allow_registration = true allow_federation = true allow_check_for_updates = true # Server to get public keys from. You probably shouldn't change this trusted_servers = ["matrix.org"] #max_concurrent_requests = 100 # How many requests Conduit sends to other servers at the same time #log = "warn,state_res=warn,rocket=off,_=off,sled=off" address = "127.0.0.1" # This makes sure Conduit can only be reached using the reverse proxy #address = "0.0.0.0" # If Conduit is running in a container, make sure the reverse proxy (ie. Traefik) can reach it. ``` I also tried installing the `.deb` and running `matrix-conduit`, and got the same error. I did the other steps on `DEPLOY.md` and saw ``` ● conduit.service loaded failed failed Conduit Matrix Server ``` maybe I did something wrong or am misunderstanding how it works? ### System Configuration <!-- Other data that might help us debug this issue, like os, conduit version, database backend --> Linux vmi1535056 5.15.0-92-generic #102-Ubuntu SMP Wed Jan 10 09:33:48 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux Conduit Version: Database backend (default is sqlite): rocksdb
hyperswine commented 2024-02-05 03:12:34 +00:00 (Migrated from gitlab.com)

changed the description

changed the description
girlbossceo commented 2024-02-05 03:19:10 +00:00 (Migrated from gitlab.com)

sudo does not pass your current environment to the command being ran by default.

You need to either use sudo -E ("preserve environment"), or explicitly set the variable at runtime such as sudo CONDUIT_CONFIG=path/to/conduit.toml matrix-conduit.

Or just use the systemd unit that comes with the deb instead of running this as root.

sudo does not pass your current environment to the command being ran by default. You need to either use `sudo -E` ("preserve environment"), or explicitly set the variable at runtime such as `sudo CONDUIT_CONFIG=path/to/conduit.toml matrix-conduit`. Or just use the systemd unit that comes with the deb instead of running this as root.
CobaltCause commented 2024-02-05 06:13:35 +00:00 (Migrated from gitlab.com)
  1. Don't run Conduit as root, it should be run as its own user (or even better, using systemd's DynamicUser = true feature). Running it as root will likely make Conduit unable to modify some of its own files once you later start having it properly run as its own user.
  2. You need a line like this in your systemd service to tell Conduit where to look for its configuration.

Closing this as it isn't a bug but a misconfiguration.

1. Don't run Conduit as root, it should be run as its own user (or even better, using systemd's `DynamicUser = true` feature). Running it as root will likely make Conduit unable to modify some of its own files once you later start having it properly run as its own user. 2. You need a line like [this](https://gitlab.com/famedly/conduit/-/blob/72a13d83539a4df7c0f126b5854642e210c506b0/debian/matrix-conduit.service#L38) in your systemd service to tell Conduit where to look for its configuration. Closing this as it isn't a bug but a misconfiguration.
Sign in to join this conversation.
No labels
Android
CS::needs customer feedback
CS::needs follow up
CS::needs on prem installation
CS::waiting
Chrome
Design:: Ready
Design:: in progress
Design::UX
E2EE
Edge
Firefox
GDPR
Iteration 13 IM
Linux
MacOS
Need::Discussion
Need::Steps to reproduce
Need::Upstream fix
Needs:: Planning
Needs::Dev-Team
Needs::More information
Needs::Priority
Needs::Product
Needs::Refinement
Needs::Severity
Priority::1-Critical
Priority::2-Max
Priority::3-Impending
Priority::4-High
Priority::5-Medium
Priority::6-Low
Priority::7-None
Progress::Backlog
Progress::Review
Progress::Started
Progress::Testing
Progress::Triage
Progress::Waiting
Reporter::Sentry
Safari
Target::Community
Target::Customer
Target::Internal
Target::PoC
Target::Security
Team:Customer-Success
Team:Design
Team:Infrastructure
Team:Instant-Messaging
Team:Product
Team:Workflows
Type::Bug
Type::Design
Type::Documentation
Type::Feature
Type::Improvement
Type::Support
Type::Tests
Windows
blocked
blocked-by-spec
cla-signed
conduit
contribution::advanced
contribution::easy
contribution::help needed
from::review
iOS
p::ti-tenant
performance
product::triage
proposal
refactor
release-blocker
s: dart_openapi_codegen
s::Famedly-Patient
s::Org-Directory
s::Passport-Generator
s::Requeuest
s:CRM
s:Famedly-App
s:Famedly-Web
s:Fhiroxide
s:Fhiroxide-cli
s:Fhiroxide-client
s:Fhirs
s:Hedwig
s:LISA
s:Matrix-Dart-SDK
s:Role-Manager
s:Synapse
s:User-Directory
s:WFS-Matrix
s:Workflow Engine
s:dtls
s:famedly-error
s:fcm-shared-isolate
s:matrix-api-lite
s:multiple-tab-detector
s:native-imaging
severity::1
severity::2
severity::3
severity::4
technical-debt
voip
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: Matthias/conduit#423
No description provided.