Open Praktikant1981 opened 8 months ago
Hi
what do you mean by "taking over the data"? or what is still used from the internal server?
if you have a different MySQL container, then you just need to change the .env connection string to that host and then the dockware or Shopware container connects to a remote DB on another container
all database data is then on that container and not in dockware anymore
thanks for the quick reply.
version: "3"
services:
shopware:
image: dockware/play:latest
container_name: shopware
ports:
- "80:80"
networks:
- web
db:
image: mysql:5.7
container_name: mysql
networks:
- web
environment:
- MYSQL_ROOT_PASSWORD=hidden
- MYSQL_USER=shopuser
- MYSQL_PASSWORD=secret
- MYSQL_DATABASE=shopware
networks:
web:
external: false
with the .env with the content
DATABASE_URL=mysql://shopuser:secret@db:3306/shopware
unfortunately the data is written to the "internal" database.
I've also
env_file:
- .env
still integrated into the docker-compose.yml. The “internal” database was also used here.
I would also be happy to post the logs here, maybe you can then say more about what the problem is?!
sorry, pressed wrong, shouldn't be closed yet
hi just tried it and after switching .env I immediately get this error
Warning: Failed to load plugins. Message: An exception occurred while executing a query: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'shopware.plugin' doesn't exist
which is OK, because it points to the new database which is currently empty of course
docker exec -it shopware bash vi .env
then scroll down and change the DATABASE_URL host
then
php bin/console cache:clear
can you try this
Thanks for the support.
I create the .env in the same directory as the docker-compose.yml Actually, the entries should be taken over from the local .env when starting. If I change the .env in docker, the changes are only available until the docker is restarted.
how do I get the local .env to overwrite the necessary parts in docker?
Simply mount yor local .env to the container as .env.local and you are fine ?
volumes:
- .env:/var/www/html/env.local
did you solved it?
I already thought something like that. But I actually know that such parameters are actually passed to the container using docker-compose. Above all, the entire .env on the Docker is then overwritten. But if there's no way to simply pass the values, I'll probably have to do it that way. Thanks again for the super quick help
We also have the issue to get the database to run on RDS on AWS, we managed to solve it with this hack:
"entryPoint": [
"sh",
"-c"
],
"command": [
"sed 's/^DATABASE_URL=.*$/DATABASE_URL=mysql:\\/\\/USER:PASSWORD@URL:3306\\/shopware/' -i /var/www/html/.env && /entrypoint.sh ||echo failed"
],
Hi, I would like to take up this topic too. So far all attempts have failed.
https://docs.dockware.io/faq/dockware-and-other-images
It is described here that it is possible to use an “external” MYSQL server. I don't know what I'm doing wrong but the container simply doesn't take over the data from the .env but the internal server is always used. What can I do or what am I doing wrong?
Maybe someone has managed it and can tell you how to do it?!
Thank you in advance!