streama icon indicating copy to clipboard operation
streama copied to clipboard

Docker: Streama not using MySQL

Open lunibo opened this issue 4 years ago • 4 comments

Issue description

Streama isn´t using mysql

Steps to Reproduce

  1. Create docker-compose.yml with mysql and streama
  2. docker-compose up -d
  3. Open Streama in Chrome/Firefox

Expected Behaviour

Stream should connect to MySQL and create tables

Actual Behaviour

Streama is accessible, but does not use the database. After each restart, all data is gone

Environment Information

  • Operating System: Ubuntu 19.10
  • Streama version: v1.8.2
  • Container Version (If Applicable): gkiko/streama:latest

docker-compose.yml

` streama:

image: gkiko/streama:latest depends_on: - mysql restart: always networks: - webserver volumes: - ./streama:/data environment: ACTIVE_PROFILE: mysql MYSQL_HOST: mysql MYSQL_PORT: 3306 MYSQL_DB: DB MYSQL_USER: DB_User MYSQL_PASSWORD: AGoodPassword labels: - 'traefik.enable=true' - 'traefik.frontend.rule=Host:streama.domain.tld' `

lunibo avatar Apr 13 '20 18:04 lunibo

I updated the MySQL settings in the application.yml file ( https://github.com/streamaserver/streama/blob/790f380223e04d225805c9607f01b5c49da01884/grails-app/conf/application.yml ) and placed in /config/ directory. I then launch the JAR like so:

java -Dspring.config.location=/config/ -Dgrails.env=mysql -jar streama.jar

rascal999 avatar May 15 '20 09:05 rascal999

Thx for the tip

lunibo avatar May 15 '20 12:05 lunibo

I've also tried specifying the IP of both containers, and setting MYSQL_HOST to the mysql container's IP, but the database remains empty after changing settings and adding a movie.

I suspect the root of the issue is that it's not actually activating the mysql profile, but instead it runs against the production profile. If you tail the container logs on startup, it gives this note:

INFO streama.Application - The following profiles are active: production

A persistant and Docker-y workaround is here, which basically does what @rascal999 suggested without having to edit the application.yml: https://github.com/streamaserver/streama/issues/197#issuecomment-453204502

This is what my streama service looks like that is using mysql:

        streama:
            image: gkiko/streama:latest
            volumes:
                - /data/videos:/data
            depends_on:
                - mysql
            working_dir: '/app/streama'
            entrypoint: 'java'
            command: ["-Dgrails.env=mysql", "-jar", "streama.jar"]
            environment:
                ACTIVE_PROFILE: mysql
                MYSQL_HOST: mysql
                MYSQL_PORT: 3306
                MYSQL_DB: streama
                MYSQL_USER: streama
                MYSQL_PASSWORD: ${SQL_PASS}

Side Note: I think the issue is with the Docker container, not with Streama to whomever triages this tracker.

sk33z3r avatar Jun 02 '20 16:06 sk33z3r

I created a Docker image (just1not2/streama) that should work well with MySQL as data backend and solve your problems: https://github.com/just1not2/docker-image-streama.

just1not2 avatar Feb 19 '22 23:02 just1not2