streama
streama copied to clipboard
Docker: Streama not using MySQL
Issue description
Streama isn´t using mysql
Steps to Reproduce
- Create docker-compose.yml with mysql and streama
- docker-compose up -d
- 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' `
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
Thx for the tip
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.
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.