Development¶
Dev Containers and VSCode¶
To set up a development environment for OwnTone, the project includes an example Dev Containers configuration.
Dev Containers
To learn more about Dev Containers and how to use them check out the documentation at:
Dev Containers config for OwnTone includes all the necessary and some nice to have tooling:
- C-tools to build and develop for owntone-server, including autotools, dependencies, etc.
- Javascript-tools to build and develop the OwnTone web interface.
- Python-tools to build and run the OwnTone documentation with mkdocs.
Prerquisites¶
- Install Docker.
- Install Visual Studio Code.
- Install the Remote - Containers extension for Visual Studio Code.
Initial setup¶
The Dev Container and VSCode example configuration files are located in the project folder .dev/devcontainer
and .dev/vscode
.
To make use of them follow these steps:
- Copy the directories or run
make vscode
from inside the.dev
folder. - Open your project in Visual Studio Code.
- Open the Command Palette (
Ctrl+Shift+P
) and selectDev Containers: Reopen in Container
. - VSCode will build the container and reopen the project inside the container. Be patient, the first run will take several minutes to complete.
Usage¶
Inside the container you can follow the build instructions (see Building):
-
Build owntone-server
-
Build web interface
Running owntone-server
from inside the container with the predefined run/debug configuration will use the conf file .devcontainer/data/devcontainer-owntone.conf
as owntone.conf
.
Configure the mount configuration in .devcontainer/devcontainer.json
to use a different music folder or mount the log folder to a local directory.
// Mounts volumes to keep files / state between container rebuilds
"mounts": [
//...
// Bind mounts for owntone config file and logs, cache, music directories
//"source=<path-to-local-logs-dir>,target=/data/logs,type=bind,consistency=cached",
//"source=<path-to-local-cache-dir>,target=/data/cache,type=bind,consistency=cached",
//"source=<path-to-local-music-dir>,target=/data/music,type=bind,consistency=cached",
"source=${localWorkspaceFolder}/.devcontainer/data/devcontainer-owntone.conf,target=/data/conf/owntone.conf,type=bind,consistency=cached"
],
Dev Container configuration¶
The Dev Container example uses an Ubuntu image as base. It contains some additional (opinionated) tools to customize the shell prompt and some terminal niceties:
Take a look at .devcontainer/devcontainer.env
if you want to disable any of those.
Additional terminal tools installed are: