Git Product home page Git Product logo

koel-docker's Introduction

https://travis-ci.org/menardorama/koel-docker#

koel-docker

This project helps in creating a docker image for koel app. The main idea is to reduce the installation steps and easily launch the application so that we can start enjoying music as soon as possible :)

Usage

We should provide environment variables to connect to database and to login to the app. We can also provide the path to media folder that contains all the songs to be played.

Environment variables

DB_CONNECTION

Database connection name, which corresponds to the database driver. Possible values are:

  • mysql (MySQL- default)
  • pgsql (PostgreSQL)
  • sqlsrv (Microsoft SQL Server)

This project currently works only for mysql and pgsql. Work in progress for sqlsrv.

DB_HOST

Database hostname, ip or name of the machine where database runs

DB_DATABASE

Name of the database to be connected

DB_USERNAME and DB_PASSWORD

username/password to connect to a database

ADMIN_EMAIL, ADMIN_NAME and ADMIN_PASSWORD

Default account details to get started with koel app

Path to media folder

You can link any folder containing songs by adding as a docker volume at /media

-v PATH_TO_MUSIC_ALBUMS:/media

Examples

Plain docker

Running mysql using docker

docker run --name=koel_database \
-e MYSQL_ROOT_PASSWORD=root \
-e MYSQL_DATABASE=koel_prod \
-e MYSQL_USER=koel \
-e MYSQL_PASSWORD=koel \
-d \
mysql

MYSQL_ ROOT_PASSWORD is mandatory while running mysql. This password is set for superuser root.

You do not need to create a new user koel. You can use the superuser root. This is only an example.

Running pgsql using docker

docker run --name=koel_database \
-e POSTGRES_DB=koel_prod \
-e POSTGRES_USER=koel \
-e POSTGRES_PASSWORD=koel \
-d \
postgres

POSTGRES_USER will be postgres by default if not given.

Then you can pass the necessary environment variables and path to media folder to docker run command to launch the app using docker.

docker run -it \
--link=koel_database \
-e DB_CONNECTION=mysql \
-e DB_HOST=koel_database \
-e DB_DATABASE=koel_prod \
-e DB_USERNAME=koel \
-e DB_PASSWORD=koel \
-e [email protected] \
-e ADMIN_NAME=admin \
-e ADMIN_PASSWORD=admin \
-v ~/Music:/media \
-p 8000:8000 \
nithyanatarajan/koel

Note: DB_CONNECTION has to be mysql or pgsql or sqlsrv based on the database you are using.

You should be able to access the app at http://localhost:8000

Alternate way to pass environment variables

Instead of passing environment variables as arguments, you can add a settings.json file in the format given in example/settings.json.

For our example, the file may look like this.

{
    "DB_CONNECTION": "mysql",
    "DB_HOST": "koel_database",
    "DB_DATABASE": "koel_prod",
    "DB_USERNAME": "koel",
    "DB_PASSWORD": "koel",
    "ADMIN_EMAIL": "[email protected]",
    "ADMIN_NAME": "admin",
    "ADMIN_PASSWORD": "admin"
}

You can add this file as a volume to docker run command.

-v $PWD/example:/config

For our example, the docker run command may look like this.

docker run -it \
--link=koel_database \
-v $PWD/example:/config \
-v $HOME/Music:/media \
-p 8000:8000 \
nithyanatarajan/koel

Using Doker swarm

 docker service create --name="koel"  --replicas 1 --publish 8001:8000 \
 --mount type=bind,src=//mnt/Music,dst=/media \
 --env DB_DATABASE=koel --env DB_USERNAME=koel --env DB_PASSWORD=koel --env DB_CONNECTION=pgsql --env DB_HOST=192.168.1.1 \
 --env [email protected] --env ADMIN_NAME=admin --env ADMIN_PASSWORD=admin \
 menardorama/koel-docker

Using docker compose

One way of avoiding running database (mysql/postgres) and the app seperately is to use docker-compose.

The docker compose file for koel using postgres may look like this.

version: '2'
services:
  app:
    image: local/koel
    ports:
    - "8000:8000"
    links:
    - postgres
    volumes:
    - $PWD/config:/config
    - $HOME/Music:/media
  postgres:
    image: postgres
    environment:
      POSTGRES_DB: koel_prod
      POSTGRES_USER: koel
      POSTGRES_PASSWORD: koel

Remember to change your settings.json file accoringly.

{ "DB_CONNECTION": "pgsql", "DB_HOST": "postgres", }

To run the app using docker compose, use the command,

docker-compose up

Refer docker-compose docs for more details.

koel-docker's People

Contributors

menardorama avatar nithyanatarajan avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.