Install ampache

Create the images share

Under the /mnt/data (the encrypted disk) let's create a new directory, e.g. videos. This will be assigned to administrators group

mkdir /mnt/data/musics
chown services:services /mnt/data/musics
chmod 776 /mnt/data/musics

Create a couple of groups, the first will have write access

groupadd share_musics
groupadd share_musics_readonly

Add the users. Johnd will have readonly access

usermod -a -G share_musics main
usermod -a -G share_musics_readonly johnd

Edit the samba config to add the new share. You can add the "veto files=..." to hide certain dirs

Add to he end of ** /etc/samba/smb.conf **

[Musics]
comment = Musics
path = /mnt/data/musics
read only = no
guest ok = no
create mask = 0775
directory mask = 0775
force_user = services
force_group = services
read list = @share_musics_readonly
write list = @share_musics

Create the application dirs

mkdir -p /mnt/data/apps/ampache/mariadb
mkdir -p /mnt/data/apps/ampache/config
chmod 777 /mnt/data/apps/ampache/mariadb
chmod 777 /mnt/data/apps/ampache/config
chmod 777 /mnt/data/apps/ampache

Go to Portainer/stacks and add the stack

Remember to change the mysql passwords on the docker compose. Here i use somepass

version: '2'

networks:
  ampache:
    name: ampache
    driver: bridge

services:
  ampachedb:
    image: mariadb
    container_name: mariadb-ampache
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: sompass
      MYSQL_DATABASE: ampache
      MYSQL_USER: someuser
      MYSQL_PASSWORD: somepass
    networks:
      - ampache
      - dockernet
    volumes:
      - /mnt/data/apps/ampache/mariadb:/var/lib/mysql

  ampache:
    image: ampache/ampache  
    container_name: ampache 
    networks:
      - ampache   
      - dockernet
    volumes:
      - /mnt/data/musics:/media
      - /mnt/data/apps/ampache/config:/var/www/config
    ports:
      - 12000:80

    restart: unless-stopped 

Go in /mnt/data/apps/ampache/config wget https://raw.githubusercontent.com/ampache/ampache/develop/config/ampache.cfg.php.dist chmod * 777

Go on port 12000 and setup all the database connections Add the user main Go to the "Admin", the thing between the wheel and door... Setup a catalog with the path "/media" and just wait :)

Setup ldap

Create a groupOfUniqueNames under ou=groups,cn=kendar,cn=org named ampache (it will not be used until i understand it)

From portainer enter on the ampache container with command prompt

apt update
apt install php-ldap

Restart the container

edit the file with the following data ** /mnt/data/apps/ampache/config/ampache.cfg.php **

auth_methods = "ldap,mysql"
auto_create = true
ldap_url = "ldap://192.168.44.1/"
ldap_username = "cn=admin,dc=kendar,dc=org"
ldap_password = "secret"
ldap_objectclass = "inetOrgPerson"
ldap_search_dn = "ou=users,dc=kendar,dc=org"
ldap_filter = "(uid=%v)"
;ldap_require_group = "cn=ampache,ou=groups,dc=kendar,dc=org"

NOTE THAT SHOULD STILL CHECK THE ldaprequiregroup

Now you could login :)


Last modified on: June 08, 2020