Info Security Memo
  • Blog
  • Sitemap
    • Categories
  • Contact
  • About
  • Resources
  • Tools
  • 51sec.org

Build Confidence

Focusing on Information Security 

Info Security Notes

5 Mins Docker Series - Koel

12/2/2022

0 Comments

 
5 Mins Docker Series - Koel
Koel is a web-based audio streaming service written in the Laravel PHP framework. It allows you to stream your personal music collection and access it from anywhere in the world. It supports multiple media formats, including AAC, OGG, WMA, FLAC, and APE.

Demo siet: https://demo.koel.dev/

Project site: https://koel.dev/

Koel has the official iOS and Android mobile app, Koel Player. It can connect to your koel-powered server and enjoy the music whenever you may roam, without the unfortunate limitations of the mobile web version. It is also Open-Source, of course. 

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. 

For more details about docker, Portainer, NPM configuration, please check following posts:
  1. Deploy Docker, Docker-Compose, Portainer and NPM (Nginx Proxy Manager)
  2. Run Free Arm-based Oracle Linux (Install Docker/Docker Compose/Portainer/Ubuntu Virtual Desktop)
  3. Install Docker, Docker-Compose, Portainer & Nginx on CentOS 8 & Ubuntu 20.04
  4. Deploy Aria2 Docker To Download Files to Cloud Drives (Google Drive, One Drive etc)
Commands list after run "sudo -i":

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)


apt install htop -y

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)


Add customized self defined IPv6 address segment to enable container's IPv6 fucntion. And limit log file's size and numbers in case log file to fill all hard drive's space. 

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.

If you do not have your own vps, you also can experience it by using https://labs.play-with-docker.com/

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



First Run - Init the api and default admin account


On the first run, you will need to:
  • Generate APP_KEY
  • Create an admin user
  • Initialize the database

All these steps are achieved by running koel:init once:

Replace <container_name_for_koel> in the command by the actual container name.

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


--no-assets option tells the init command to skip building the front-end assets, as they have been generated by Koel's "Release" GitHub action.



Once inited, it creates one admin account automatically with the following credentials: email: [email protected] password: KoelIsCool

Make sure to change this unsecure password with the user interface (click on your profile picture) or by running the following command:

$ docker exec -it <container_name_for_koel> php artisan koel:admin:change-password


Videos

 







References












via Blogger http://blog.51sec.org/2022/12/5-mins-docker-series-koel.html
December 02, 2022 at 05:20PM Docker
0 Comments



Leave a Reply.

    Categories

    All
    Architecture
    Blog
    Checkpoint
    Cisco
    Cloud
    CyberArk
    F5
    Fortigate
    Guardium
    Juniper
    Linux
    Network
    Others
    Palo Alto
    Qualys
    Raspberry Pi
    Security
    SIEM
    Software
    Vmware
    VPN
    Wireless

    Archives

    March 2024
    February 2024
    January 2024
    December 2023
    November 2023
    October 2023
    September 2023
    August 2023
    July 2023
    June 2023
    May 2023
    April 2023
    March 2023
    February 2023
    January 2023
    December 2022
    November 2022
    October 2022
    September 2022
    August 2022
    July 2022
    June 2022
    May 2022
    April 2022
    March 2022
    February 2022
    January 2022
    December 2021
    November 2021
    October 2021
    September 2021
    August 2021
    July 2021
    June 2021
    May 2021
    April 2021
    March 2021
    February 2021
    January 2021
    December 2020
    November 2020
    October 2020
    September 2020
    August 2020
    July 2020
    October 2019
    September 2019
    June 2019
    July 2018
    May 2018
    December 2017
    August 2017
    April 2017
    March 2017
    January 2017
    December 2016
    November 2016
    October 2016
    September 2016
    August 2016
    July 2016
    June 2016
    May 2016
    April 2016
    March 2016
    February 2016
    January 2016
    December 2015
    November 2015
    October 2015
    September 2015
    August 2015
    July 2015
    June 2015
    May 2015
    April 2015
    March 2015

    Print Page:

    RSS Feed

    Email Subscribe
Powered by Create your own unique website with customizable templates.
  • Blog
  • Sitemap
    • Categories
  • Contact
  • About
  • Resources
  • Tools
  • 51sec.org