4.7 KiB
# Installing Trunk-Server Locally (no HTTPS)
## Prerequisites:
1. **Set static IP for trunk-server**
2. **Set DNS for admin account**: Point `api` to the trunk-server IP.
3. **Install Ubuntu Server 24.04**
4. **Update system:**
```bash
sudo apt update
sudo apt upgrade
-
Add subdomains to
/etc/hosts:127.0.0.1 openmhz.test account.openmhz.test api.openmhz.test admin.openmhz.test media.openmhz.test -
Flush DNS cache:
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder -
Create a file in your user's home directory for AWS credentials:
mkdir ~/.aws nano credentialsAdd the following content to the file:
[default] aws_access_key_id = [..] aws_secret_access_key = [..]
Install Docker (from Docker Docs)
-
Update and install prerequisites:
sudo apt update sudo apt-get install ca-certificates curl sudo install -m 0755 -d /etc/apt/keyrings -
Add Docker's official GPG key:
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc sudo chmod a+r /etc/apt/keyrings/docker.asc -
Add Docker repository to APT sources:
echo \ "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \ $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \ sudo tee /etc/apt/sources.list.d/docker.list > /dev/null -
Update system and install Docker:
sudo apt update sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
Setting up MINIO (on another machine/VM)
- It is possible to run MinIO on the same machine (though not recommended).
- Follow the MinIO installation guide for Linux: MinIO Installation Docs
- For a small home setup, use Single-Node Single-Drive (SNSD) or Standalone mode.
High-Level MinIO Crash Course:
- Create a bucket (this is where you will store audio from TrunkServer).
- Set Access Policy for the bucket to Public (Reminder: This is for local, NON-Internet only).
- Create an Access Key and Secret:
- Copy the secret as you can only view it once. If lost, create a new key and delete the old one.
Install Trunk Server
-
Clone the repository:
git clone https://github.com/openmhz/trunk-server cd trunk-server -
Copy example environment file:
cp test.env.example test.env -
Edit the environment file:
nano test.envAdd the following:
export S3_PROFILE='default' export S3_REGION='us-east-1' export S3_ENDPOINT='http://minio.domain.com:9000' export S3_BUCKET='bucketname'Save and exit.
-
Adjust
uploads.jsto work with MinIO path:nano ~/trunk-server/backend/controllers/uploads.js- In Nano, press
ALT+nto show line numbers. - Around line 50, add the following crucial line:
const client = new S3Client({ requestHandler: new NodeHttpHandler({ httpsAgent: agent, }), credentials: fromIni({ profile: s3_profile }), endpoint: s3_endpoint, region: s3_region, maxAttempts: 2, forcePathStyle: true, });
- In Nano, press
-
Build and start the server:
./docker-test.sh build # This will take a while ./docker-test.sh up -d # This starts the server as a daemon -
Make sure you have the following commands available when running
./docker-test.sh:./docker-test.sh build ./docker-test.sh up -d ./docker-test.sh down
Creating Accounts (without an email server)
-
Go to
account.(yourtrunkservername).(yourdomain).com. -
Click Register.
-
Fill out the form and click Register (nothing will happen right away).
-
Connect to the right Docker container:
docker exec -i -t $(docker ps -a | grep mongo | awk '{print $1}') /bin/bash -
Access MongoDB shell:
mongosh -
Select the
scannerdatabase:use scanner -
Find and update user to confirm email:
db.users.find() db.users.updateOne( { "_id" : ObjectId("63a620d0a63b087b005f6726") }, { $set: { "confirmEmail" : true }, $currentDate: { lastModified: true } } )
Useful Commands
TrunkServer Logs:
docker-compose logs --follow --tail 50
Build, Stop, and Start TrunkServer:
./docker-test.sh build