mirror of
https://git.maid.zone/stuff/soundcloak.git
synced 2025-12-10 05:39:38 +05:00
fix prefs, move to go tool, refine docs and etc
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
# Setup
|
||||
## Prerequisites
|
||||
1. [golang](https://go.dev) (I recommend version 1.24.0)
|
||||
1. [golang](https://go.dev) (I recommend version 1.25.1)
|
||||
2. [git](https://git-scm.com)
|
||||
|
||||
## The setup
|
||||
@@ -16,41 +16,15 @@ git clone https://git.maid.zone/stuff/soundcloak
|
||||
cd soundcloak
|
||||
```
|
||||
|
||||
3. Download templ:
|
||||
3. Download required JS modules:
|
||||
|
||||
Currently it's just HLS.js
|
||||
|
||||
```sh
|
||||
go install github.com/a-h/templ/cmd/templ@latest
|
||||
go tool soundcloakctl js download
|
||||
```
|
||||
|
||||
*You might need to add go binaries to your PATH (add this line to your .bashrc / .zshrc / whatever)*
|
||||
|
||||
```sh
|
||||
export PATH=${PATH}:`go env GOPATH`/bin
|
||||
```
|
||||
|
||||
4. Download regexp2cg:
|
||||
|
||||
Not really required, but helps speed up some parts of the code that use regular expressions by generating code for them instead of compiling in runtime.
|
||||
|
||||
```sh
|
||||
go install github.com/dlclark/regexp2cg@main
|
||||
```
|
||||
|
||||
5. Download soundcloakctl:
|
||||
|
||||
Soundcloakctl is helper for soundcloak.
|
||||
|
||||
```sh
|
||||
go install git.maid.zone/stuff/soundcloakctl@master
|
||||
```
|
||||
|
||||
6. Download requried JS modules:
|
||||
|
||||
```sh
|
||||
soundcloakctl js download
|
||||
```
|
||||
|
||||
7. Build binary:
|
||||
4. Build binary:
|
||||
|
||||
This uses the `build` script, which generates code from templates, generates code for regular expiressions, and then builds the binary.
|
||||
|
||||
@@ -69,27 +43,13 @@ git pull
|
||||
|
||||
2. Update dependencies/tools:
|
||||
|
||||
You can skip some parts if the tools/dependencies have not been updated.
|
||||
```sh
|
||||
go get # for go packages
|
||||
go mod download # update tools and dependencies
|
||||
|
||||
go install github.com/a-h/templ/cmd/templ@latest # templ cli
|
||||
|
||||
go install github.com/dlclark/regexp2cg@main # regexp2 codegen cli. not required unless you've installed it
|
||||
|
||||
go install git.maid.zone/stuff/soundcloakctl@master # soundcloakctl
|
||||
|
||||
soundcloakctl js download # re-download JS modules
|
||||
go tool soundcloakctl js download # re-download JS modules
|
||||
```
|
||||
|
||||
3. Clean precompressed static files
|
||||
|
||||
Those are created by the webserver in order to more efficiently serve static files. They have the `.br` and `.gzip` extension. You can easily remove them from all directories using soundcloakctl:
|
||||
```sh
|
||||
soundcloakctl clean
|
||||
```
|
||||
|
||||
4. Run codegen and build the binary:
|
||||
3. Run codegen and build the binary:
|
||||
```sh
|
||||
./build
|
||||
```
|
||||
|
||||
@@ -42,10 +42,24 @@ Soundcloak will now be up at `127.0.0.1:4664` (or the address you specified in y
|
||||
|
||||
## Regular method
|
||||
|
||||
** Not recommended for deployment. **
|
||||
|
||||
Refer to the [developer guide](DEV_GUIDE.md#setup)
|
||||
|
||||
### Extras
|
||||
|
||||
Not required but can help. If using docker, it already does this stuff for you.
|
||||
|
||||
- Precompressing static files
|
||||
|
||||
For more effective file serving: `go tool soundcloakctl -nozstd precompress`
|
||||
|
||||
You will have to run `go tool soundcloakctl clean` and re-run the above command each time static files change.
|
||||
|
||||
- Config codegen
|
||||
|
||||
Can help reduce binary size (if you don't use certain features) and performance (not by much): `go tool soundcloakctl config codegen`
|
||||
|
||||
You will have to re-run this each time you change config or config structure changes
|
||||
|
||||
# Updating your instance
|
||||
|
||||
## Docker
|
||||
@@ -57,22 +71,9 @@ git fetch origin
|
||||
git pull
|
||||
```
|
||||
|
||||
2. Stop the container:
|
||||
|
||||
2. Rebuild and restart the container:
|
||||
```sh
|
||||
docker compose down
|
||||
```
|
||||
|
||||
3. Build the container with updated source code:
|
||||
|
||||
```sh
|
||||
docker compose build
|
||||
```
|
||||
|
||||
4. Start the container:
|
||||
|
||||
```sh
|
||||
docker compose up -d
|
||||
docker compose up --build -d
|
||||
```
|
||||
|
||||
Use `docker-compose` instead of `docker compose` if that fails.
|
||||
|
||||
Reference in New Issue
Block a user