2020-05-18 04:08:09 +02:00
---
2022-02-21 08:16:54 +01:00
title: Development environment
2020-05-18 04:08:09 +02:00
---
2023-03-20 13:52:27 +01:00
This page describes the different way to run LibreTime in a development environment.
The recommended development environment is the [docker-compose setup ](#docker-compose ).
2022-06-09 17:21:29 +02:00
## Docker-compose
To setup a docker-compose development environment, run the following commands:
```bash
# Clean and build
make clean
cp .env.dev .env
2022-12-07 13:03:49 +01:00
DOCKER_BUILDKIT=1 docker-compose build
2022-06-09 17:21:29 +02:00
# Setup
2023-04-11 19:30:46 +02:00
make dev-certs
2022-06-09 17:21:29 +02:00
docker-compose run --rm legacy make build
docker-compose run --rm api libretime-api migrate
# Run
docker-compose up -d
docker-compose logs -f
```
2023-03-20 13:52:27 +01:00
:::info
You may also use the following `make clean dev` shortcut:
```bash
make clean dev
docker-compose logs -f
```
:::
2022-02-09 09:37:52 +01:00
## Vagrant
2017-03-10 12:32:45 +01:00
2022-02-09 09:37:52 +01:00
To use Vagrant, you need to install a virtualization engine: [VirtualBox ](https://www.virtualbox.org ) or Libvirt. The [vagrant-vbguest] package on Github can help maintain guest extensions on host systems using VirtualBox.
2019-01-18 11:08:28 +01:00
2022-02-09 09:37:52 +01:00
:::tip
2019-01-18 11:08:28 +01:00
If you try run a libvirt provided box after using a VirtualBox one, you will receive an
error:
```
Error while activating network:
Call to virNetworkCreate failed: internal error: Network is already in use by interface vboxnet0.
```
This is fixed by stopping virtualbox and re-creating the vagrant box:
2022-02-09 09:37:52 +01:00
```bash
2019-01-18 11:08:28 +01:00
sudo systemctl stop virtualbox
2022-09-09 19:52:46 +02:00
vagrant destroy focal
vagrant up focal --provider=libvirt
2019-01-18 11:08:28 +01:00
```
2022-02-09 09:37:52 +01:00
:::
### Installing Libvirt
On Debian and Ubuntu:
1. Install Vagrant
2019-01-18 11:08:28 +01:00
```bash
2019-01-18 14:08:12 +01:00
sudo apt install vagrant vagrant-libvirt libvirt-daemon-system vagrant-mutate libvirt-dev
2021-04-08 19:33:32 +02:00
sudo usermod -aG libvirt $USER
2022-02-09 09:37:52 +01:00
```
2019-01-18 11:08:28 +01:00
2022-02-09 09:37:52 +01:00
2. Reboot your computer, and then run
2019-01-18 11:08:28 +01:00
2022-02-09 09:37:52 +01:00
```bash
2022-09-09 19:52:46 +02:00
vagrant box add bento/ubuntu-20.04 --provider=virtualbox
vagrant mutate bento/ubuntu-20.04 libvirt
vagrant up focal --provider=libvirt
2019-01-18 11:08:28 +01:00
```
2022-02-09 09:37:52 +01:00
On other distributions, you will need to install [libvirt ](https://libvirt.org/ ) and `vagrant-mutate` and then run
2019-01-18 11:08:28 +01:00
```bash
vagrant plugin install vagrant-libvirt
sudo usermod -a -G libvirt $USER
2019-01-18 14:08:12 +01:00
# Reboot
2019-01-18 11:08:28 +01:00
vagrant plugin install vagrant-mutate
2022-09-09 19:52:46 +02:00
vagrant box fetch bento/ubuntu-20.04
vagrant mutate bento/ubuntu-20.04 libvirt
vagrant up focal --provider=libvirt
2019-01-18 11:08:28 +01:00
```
2022-02-09 09:37:52 +01:00
### Starting LibreTime Vagrant
2017-03-10 12:32:45 +01:00
2019-01-18 11:08:28 +01:00
To get started you clone the repo and run `vagrant up` . The command accepts a parameter to
change the default provider if you have multiple installed. This can be done by appending
`--provider=virtualbox` or `--provider=libvirt` as applicable.
2017-03-10 12:32:45 +01:00
```bash
2022-03-29 13:07:38 +02:00
git clone https://github.com/libretime/libretime
2017-03-10 12:32:45 +01:00
cd libretime
2022-09-09 19:52:46 +02:00
vagrant up focal
2017-03-10 12:32:45 +01:00
```
2020-11-15 03:36:14 +01:00
If everything works out, you will find LibreTime on [port 8080 ](http://localhost:8080 )
and Icecast on [port 8000 ](http://localhost:8000 ).
2017-03-10 12:32:45 +01:00
2019-01-18 11:08:28 +01:00
Once you reach the web setup GUI you can click through it using the default values. To
2022-09-09 19:52:46 +02:00
connect to the vagrant machine you can run `vagrant ssh focal` in the libretime
2019-01-18 11:08:28 +01:00
directory.
2017-03-08 12:39:59 +01:00
2022-02-09 09:37:52 +01:00
### Alternative OS installations
2017-03-08 12:39:59 +01:00
2022-09-09 19:52:46 +02:00
With the above instructions LibreTime is installed on Ubuntu Focal. The Vagrant setup
2019-01-18 11:08:28 +01:00
offers the option to choose a different operation system according to you needs.
2017-03-08 12:39:59 +01:00
2022-09-09 19:52:46 +02:00
| OS | Command | Comment |
| ------------ | --------------------- | ------------------------------ |
| Ubuntu 20.04 | `vagrant up focal` | Install on Ubuntu Focal Fossa. |
2022-09-09 20:45:59 +02:00
| Debian 11 | `vagrant up bullseye` | Install on Debian Bullseye. |
2017-03-10 12:32:45 +01:00
2022-02-09 09:37:52 +01:00
### Troubleshooting
2017-03-10 12:32:45 +01:00
2019-01-18 11:08:28 +01:00
If anything fails during the initial provisioning step you can try running `vagrant provision`
2019-10-22 11:52:18 +02:00
to re-run the installer.
2017-03-08 12:39:59 +01:00
2019-10-22 11:52:18 +02:00
If you only want to re-run parts of the installer, use `--provision-with $step` . The
2020-06-02 20:01:31 +02:00
supported steps are `prepare` and `install` .
2022-02-09 09:37:52 +01:00
## Multipass
[Multipass ](https://multipass.run ) is a tool for easily setting up Ubuntu VMs on Windows, Mac, and Linux.
Similar to Docker, Multipass works through a CLI. To use, clone this repo and then create a new Multipass VM.
```
2022-03-29 13:07:38 +02:00
git clone https://github.com/libretime/libretime
2022-02-09 09:37:52 +01:00
cd libretime
2022-09-09 19:52:46 +02:00
multipass launch focal -n ltTEST --cloud-init cloud-init.yaml
2022-02-09 09:37:52 +01:00
multipass shell ltTEST
```
Multipass isn't currently able to do an automated install from the cloud-init script.
2023-04-21 11:50:37 +02:00
After you enter the shell for the first time, you will still need to [run the LibreTime installer ](../admin-manual/install/README.md ).
2022-02-09 09:37:52 +01:00
The IP address of your new VM can be found by running `multipass list` . Copy and paste it into your web browser to access the LibreTime interface and complete the setup wizard.
You can stop the VM with `multipass stop ltTEST` and restart with `multipass start ltTEST` .
If you want to delete the image and start again, run `multipass delete ltTEST && multipass purge` .
### Cloud-init options in cloud-init.yaml
You may wish to change the below fields as per your location.
```yaml
timezone: America/New York # change as needed
ntp:
pools: ["north-america.pool.ntp.org"]
servers: ["0.north-america.pool.ntp.org", "0.pool.ntp.org"]
```