In this post, you will learn how to install Koel Music Streaming Server using Docker on a free Onracle Free Tier Ubuntu 20.04 machine.
Pre-requisites
In this lab, I am using Ubuntu 20.04 VM in Oracle Cloud Free tier as an example. All following commands are based on this Ubuntu 20.04 version Oracle Cloud platform. Please adjust it accordingly if you are using different system or platform.- Deploy Docker, Docker-Compose, Portainer and NPM (Nginx Proxy Manager)
- Run Free Arm-based Oracle Linux (Install Docker/Docker Compose/Portainer/Ubuntu Virtual Desktop)
- Install Docker, Docker-Compose, Portainer & Nginx on CentOS 8 & Ubuntu 20.04
- Deploy Aria2 Docker To Download Files to Cloud Drives (Google Drive, One Drive etc)
1 System update:
apt update -y && apt upgrade -y
2 Increase SWAP size to at least 1024MB
wget https://raw.githubusercontent.com/51sec/swap/main/swap.sh && bash swap.sh
3 Install Docker and Docker-Compose:
apt install docker.io -y
apt install docker-compose -y
4 Install Portainer (Optional):
docker volume create portainer_data
docker run -d -p 9000:9000 --name portainer --restart always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce:latest
5 Install NPM (Nginx Proxy Manager) (Optional)
docker run -d -p 80:80 -p 81:81 -p 443:443 --name npm --restart unless-stopped -v ./letsencrypt:/etc/letsencrypt -v ./data:/data jc21/nginx-proxy-manager:latest
6 Install htop program (Optional)
7 Enable BBR on Ubuntu 20.04 (Optional)
Open the following configuration file vi /etc/sysctl.conf
to enable enable TCP BBR.
vi /etc/sysctl.conf
At the end of the config file, add the following lines.
net.core.default_qdisc=fq
net.ipv4.tcp_congestion_control=bbr
Save the file, and refresh your configuration by using this command,
sysctl -p
Output:
root@vps:~# sysctl -p
net.core.default_qdisc = fq
net.ipv4.tcp_congestion_control = bbr
Now, Verify if BBR is enabled in your system,
sysctl net.ipv4.tcp_congestion_control
Output:
root@vps:~# sysctl net.ipv4.tcp_congestion_control
net.ipv4.tcp_congestion_control = bbr
Done!
8 Enable IPv6 and Limit Log File Size (Optional)
cat > /etc/docker/daemon.json << EOF
{
"log-driver": "json-file",
"log-opts": {
"max-size": "20m",
"max-file": "3"
},
"ipv6": true,
"fixed-cidr-v6": "fd00:dead:beef:c0::/80",
"experimental":true,
"ip6tables":true
}
EOF
Restart Docker service:
systemctl restart docker
Koel Docker Installation Steps
Koel has an official Docker image: koel/docker. The latest version is now at phanan/koel:latest.1 Run with docker-compose and MySQL
docker-compose is the easiest way to get started. It will start both the database container and this image. Clone this repository and edit docker-compose.mysql.yml. Make sure to replace passwords !
2 Check out the ./docker-compose.mysql.yml file for more details.
version: '3'
services:
koel:
image: phanan/koel
depends_on:
- database
ports:
- 80:80
environment:
- DB_CONNECTION=mysql
- DB_HOST=database
- DB_USERNAME=koel
- DB_PASSWORD=<koel_password>
- DB_DATABASE=koel
volumes:
- music:/music
- covers:/var/www/html/public/img/covers
- search_index:/var/www/html/storage/search-indexes
database:
image: mysql/mysql-server:5.7
volumes:
- db:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=<root_password>
- MYSQL_DATABASE=koel
- MYSQL_USER=koel
- MYSQL_PASSWORD=<koel_password>
volumes:
db:
driver: local
music:
driver: local
covers:
driver: local
search_index:
driver: local
3 Then run docker-compose:
docker-compose -f ./docker-compose.mysql.yml up -d
To stop and remove running containers we brought up, using following two commands:
mv docker-compose.mysql.yml docker-compose.yml
docker-compose down
root@koel-ubuntu-1:~# docker-compose down
Stopping root_koel_1 ... done
Stopping root_database_1 ... done
Removing root_koel_1 ... done
Removing root_database_1 ... done
Removing network root_default
root@koel-ubuntu-1:~#
First Run - Init the api and default admin account
- Generate APP_KEY
- Create an admin user
- Initialize the database
docker exec --user www-data -it <container_name_for_koel> bash
# Once inside the container, you can run commands:
$ php artisan koel:init --no-assets
docker exec -it root_koel_1 php artisan koel:init
$ docker exec -it <container_name_for_koel> php artisan koel:admin:change-password
No comments:
Post a Comment