Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
97 changes: 18 additions & 79 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,79 +1,18 @@
# For local development only - uncomment these vars
# OSSE_PROTOCOL="http"
# OSSE_HOST="localhost"
# OSSE_SERVER_PORT="4200"
# OSSE_API_PORT="8000"
# OSSE_BROADCAST_PORT="9003"
# OSSE_BROADCAST_INTERNAL_PORT="9004"
# OSSE_REDIS_PORT="9005"
# OSSE_SERVER_URL="localhost:4200"
# OSSE_DIRECTORIES="~/Music"
# OSSE_ALLOW_REGISTRATION=true


APP_NAME=osse
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_TIMEZONE=UTC
APP_URL=http://localhost

APP_LOCALE=en
APP_FALLBACK_LOCALE=en
APP_FAKER_LOCALE=en_US

APP_MAINTENANCE_DRIVER=file
# APP_MAINTENANCE_STORE=database

PHP_CLI_SERVER_WORKERS=4

BCRYPT_ROUNDS=12

LOG_CHANNEL=stack
LOG_STACK=single
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug

DB_CONNECTION=sqlite
# DB_HOST=127.0.0.1
# DB_PORT=3306
# DB_DATABASE=laravel
# DB_USERNAME=root
# DB_PASSWORD=

SESSION_DRIVER=redis
SESSION_LIFETIME=120
SESSION_ENCRYPT=false
SESSION_PATH=/
SESSION_DOMAIN=.localhost

BROADCAST_CONNECTION=redis
FILESYSTEM_DISK=local
QUEUE_CONNECTION=database

CACHE_STORE=redis
CACHE_PREFIX=cache_

MEMCACHED_HOST=127.0.0.1

REDIS_CLIENT=phpredis
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

MAIL_MAILER=log
MAIL_HOST=127.0.0.1
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS="[email protected]"
MAIL_FROM_NAME="${APP_NAME}"

AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=
AWS_USE_PATH_STYLE_ENDPOINT=false

VITE_APP_NAME="${APP_NAME}"
OSSE_DOMAIN=osse.localhost
# Can be local or prod
OSSE_ENV=prod
# Internal ports (never exposed publicly, but they need to not be in use)
OSSE_API_PORT=8000
OSSE_BROADCAST_PORT=8090
# 4200 is also in use if in development mode.
# Redis instance (include the domain and the port). Valkey works fine too!
OSSE_REDIS_HOST="localhost:6379"

# The paths to scan for music. See examples below. Only absolute paths are supported (no ~ or env vars). Separate directories with comma.
export OSSE_DIRECTORIES=""
# export OSSE_DIRECTORIES="/home/me/Music,/mnt/server1/files"
# If true, allow new accounts to be created. Once you make your account, set this to false.
export OSSE_ALLOW_REGISTRATION=true

# Storage (config, cache, database). Path will be created if not present.
LARAVEL_STORAGE_PATH="~/.config/osse-2"
4 changes: 3 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@ jobs:
with:
php-version: '8.4'
- uses: actions/checkout@v4
- name: Move to osse-core
run: cd osse-core
- name: Copy .env
run: php -r "file_exists('.env') || copy('.env.example', '.env');"
run: php -r "file_exists('.env') || copy('.env.testing', '.env');"
- name: Install Dependencies
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist
- name: Generate key
Expand Down
28 changes: 1 addition & 27 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,28 +1,2 @@
/.phpunit.cache
/node_modules
/public/build
/public/hot
/public/storage
/storage/*.key
/storage/pail
/vendor
.env
.env.backup
.env.production
.phpactor.json
.phpunit.result.cache
Homestead.json
Homestead.yaml
auth.json
npm-debug.log
yarn-error.log
/.fleet
/.idea
/.nova
/.vscode
/.zed
osse.db
public/dist
storage/osse_setup
certs/
user-conf/
Caddyfile
6 changes: 0 additions & 6 deletions .gitmodules

This file was deleted.

6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,10 @@ Osse is a free and open source music player and server. This repository is the *

> Interested in helping us test? Use the below instructions for an installation.

Docker is the recommended method of installation. You can also use Podman. Alternatively, you can run Osse on your local machine by installing it's dependencies.
Systemd files are available in this repo (outdated)

Devices with constrained resources should use the manual installation for performance reasons. Systemd files are available in this repo.

- [Docker/Podman installation](https://github.com/aMytho/osse/wiki/Installation-(Docker-Podman))
- [Manual Installation](https://github.com/aMytho/osse/wiki/Installation-(Manual-System))
- [Docker/Podman installation (outdated)](https://github.com/aMytho/osse/wiki/Installation-(Docker-Podman))

## Providing Feedback

Expand Down
52 changes: 52 additions & 0 deletions deployment/Caddyfile.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
frankenphp
admin off
auto_https disable_redirects
storage file_system {
root $HOME/.local/share/caddy
}
}

https://${OSSE_DOMAIN} {
# Laravel sanctum
handle_path /api/sanctum/csrf-cookie {
root * osse-core/public
php_server {
env REQUEST_URI sanctum/csrf-cookie
try_files {path} index.php
}
}

# Laravel login
handle_path /api/login {
root * osse-core/public
php_server {
env REQUEST_URI login
try_files {path} index.php
}
}

# Laravel API (all other backend routes)
handle_path /api/* {
root * osse-core/public
php_server {
try_files {path} index.php
}
}


# Broadcast server
handle_path /broadcast/* {
reverse_proxy 127.0.0.1:${OSSE_BROADCAST_PORT}
}

# Web frontend (this is replaced in the root osse script as it changes based on env)
handle {
root * osse-web/dist/osse-web/browser/

WEB_FRONTEND_TEMPLATE
}

encode zstd br gzip
}

4 changes: 4 additions & 0 deletions deployment/php.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
; deployment/php.ini
memory_limit = 2G
max_execution_time = 0
opcache.enable_cli = 1
1 change: 0 additions & 1 deletion osse-broadcast
Submodule osse-broadcast deleted from 2972c9
3 changes: 3 additions & 0 deletions osse-broadcast/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.git
.github

40 changes: 40 additions & 0 deletions osse-broadcast/.github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Build Go Project

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
build:
name: Build Go Binary
runs-on: ubuntu-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: stable

- name: Install Dependencies
run: go mod tidy

- name: Build for Linux (x86_64)
run: |
GOOS=linux GOARCH=amd64 go build -o bin/osse-broadcast-linux-amd64

- name: Build for Linux (ARM64)
run: |
GOOS=linux GOARCH=arm64 go build -o bin/osse-broadcast-linux-arm64

- name: Upload Binaries
uses: actions/upload-artifact@v4
with:
name: go-binaries
path: bin/
2 changes: 2 additions & 0 deletions osse-broadcast/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bin/
.env
12 changes: 12 additions & 0 deletions osse-broadcast/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM golang:1.24-alpine

WORKDIR /usr/src/app

# pre-copy/cache go.mod for pre-downloading dependencies and only redownloading them in subsequent builds if they change
COPY go.mod go.sum ./
RUN go mod download

COPY . .
RUN go build -v -o /usr/local/bin/osse-broadcast .

ENTRYPOINT [ "sh", "prod-run.sh" ]
7 changes: 7 additions & 0 deletions osse-broadcast/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Osse-Broadcast

This is the SSE server for the Osse music server.

Osse is written in PHP. This works great for requests, but not so great for long lived connections.

This server is in go, highly concurrent, and much lighter than the Laravel Reverb implementation.
13 changes: 13 additions & 0 deletions osse-broadcast/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module osse-broadcast

go 1.24.1

require (
github.com/redis/go-redis/v9 v9.7.3
github.com/tmaxmax/go-sse v0.10.0
)

require (
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
)
12 changes: 12 additions & 0 deletions osse-broadcast/go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
github.com/bsm/ginkgo/v2 v2.12.0 h1:Ny8MWAHyOepLGlLKYmXG4IEkioBysk6GpaRTLC8zwWs=
github.com/bsm/ginkgo/v2 v2.12.0/go.mod h1:SwYbGRRDovPVboqFv0tPTcG1sN61LM1Z4ARdbAV9g4c=
github.com/bsm/gomega v1.27.10 h1:yeMWxP2pV2fG3FgAODIY8EiRE3dy0aeFYt4l7wh6yKA=
github.com/bsm/gomega v1.27.10/go.mod h1:JyEr/xRbxbtgWNi8tIEVPUYZ5Dzef52k01W3YH0H+O0=
github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44=
github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78=
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc=
github.com/redis/go-redis/v9 v9.7.3 h1:YpPyAayJV+XErNsatSElgRZZVCwXX9QzkKYNvO7x0wM=
github.com/redis/go-redis/v9 v9.7.3/go.mod h1:bGUrSggJ9X9GUmZpZNEOQKaANxSGgOEBRltRTZHSvrA=
github.com/tmaxmax/go-sse v0.10.0 h1:j9F93WB4Hxt8wUf6oGffMm4dutALvUPoDDxfuDQOSqA=
github.com/tmaxmax/go-sse v0.10.0/go.mod h1:u/2kZQR1tyngo1lKaNCj1mJmhXGZWS1Zs5yiSOD+Eg8=
32 changes: 32 additions & 0 deletions osse-broadcast/internal/config/config.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package config

import (
"log"
"os"
)

type OsseConfig struct {
HttpHost string
RedisHost string
OsseClientOrigin string
}

func GetOsseConfig() OsseConfig {
httpHost := getEnvVar("OSSE_BROADCAST_PORT")
redisHost := getEnvVar("OSSE_REDIS_HOST")
osseClientOrigin := getEnvVar("OSSE_DOMAIN")

return OsseConfig{httpHost, redisHost, osseClientOrigin}
}

func getEnvVar(key string) string {
result, varExists := os.LookupEnv(key)

if !varExists {
log.Println("The environment variable " + key + " was not set. Please set this var in the osse config file.")
log.Println("Osse Broadcast is shutting down!")
os.Exit(1)
}

return result
}
Loading
Loading