Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing full featured example #63

Closed
btxtiger opened this issue Jun 28, 2021 · 7 comments
Closed

Missing full featured example #63

btxtiger opened this issue Jun 28, 2021 · 7 comments
Labels
Question Questions, help requests and more

Comments

@btxtiger
Copy link

btxtiger commented Jun 28, 2021

Is your feature request related to a problem? Please describe.
This project seems to be great. But I am really missing a full featured example config. It is really hard to find each tiny snippet everywhere.

Describe the solution you'd like
Full featured example

Additional context
This is my docker-compose file. I can't get it running because I haven't found yet, how to advise dockware/play to use a different database port (I guess). Of course I am not using the default ports 80, 3306 aso. These are important ports that are either already allocated, oder have to stay free for other tools.
The default shopware setup has .env variables like APP_ENV, APP_SECRET, APP_URL, ... . How can I adjust them?

@btxtiger
Copy link
Author

btxtiger commented Jun 28, 2021

After a lot trial and error, I came to this setup. Feel free to include this in the docs. I'm sure it will help a lot of more developers. Would be also helpful if the unclear points could be clarified (APP_SECRET, APP_SECRET, SHOPWARE_ES_INDEX_PREFIX).

Update: It seems APP_SECRET and APP_SECRET are some keys that are generated on installation required to connect the shopware.com account. However it is unclear how to generate those keys using dockware.

Local .env

# APP_ENV=development
APP_ENV=prod
APP_SECRET=1 # what is this?
INSTANCE_ID=1 # what is this?

APP_URL=https://myshop.com
TRUSTED_PROXIES=REMOTE_ADDR # https://forum.shopware.com/discussion/62801/shopware-6-mit-ssl-hinter-reverse-proxy#Comment_259420

DATABASE_URL=mysql://root:root@localhost:3306/shopware
# MAILER_URL=smtp://localhost:1025
COMPOSER_HOME=/var/www/html/var/cache/composer
SHOPWARE_HTTP_CACHE_ENABLED=1

# REDIS_SESSION_HOST=redis
# REDIS_SESSION_PORT=6379
# REDIS_CACHE_HOST=redis
# REDIS_CACHE_PORT=6379

# SHOPWARE_ES_ENABLED=0
# SHOPWARE_ES_HOSTS=elasticsearch:9200
# SHOPWARE_ES_INDEXING_ENABLED=0
# SHOPWARE_ES_INDEX_PREFIX=abc # what is this?

DOCKER_MYSQL_INIT_ROOT_PASSWORD=your_db_root_password
DOCKER_MYSQL_INIT_ROOT_HOST=172.%.%.%
DOCKER_MYSQL_INIT_HOST=172.%.%.%
DB_DATABASE=shopware_docker
DB_USERNAME=docker
DB_PASSWORD=your_db_user_password

Local docker-compose.yml

version: "3"

services:
        
    shopware:
      image: dockware/play:latest
      container_name: shopware_app
      environment:
        PHP_VERSION: 8.0
      volumes:
        - "shop_volume:/var/www/html"
        - ./.env:/var/www/html/.env
      ports:
         - "8766:80"
      networks:
         - web

    db:
        image: mysql:5.7
        container_name: shopware_db
        networks:
            - web
        command:
            - '--default-authentication-plugin=mysql_native_password'
            - '--character-set-server=utf8mb4'
            - '--collation-server=utf8mb4_unicode_ci'
            - '--skip-name-resolve'
        volumes:
            - db_volume:/var/lib/mysql/:cached
        environment:
            MYSQL_ALLOW_EMPTY_PASSWORD: 'false'
            ### Database initialization config:
            MYSQL_ROOT_HOST: ${DOCKER_MYSQL_INIT_ROOT_HOST}
            MYSQL_ROOT_PASSWORD: ${DOCKER_MYSQL_INIT_ROOT_PASSWORD}
            MYSQL_HOST: ${DOCKER_MYSQL_INIT_HOST}
            MYSQL_USER: ${DB_USERNAME}
            MYSQL_PASSWORD: ${DB_PASSWORD}
            MYSQL_DATABASE: ${DB_DATABASE}
        # ports:
        #     - 3305:3306 # Access from outside not necessary
        restart: always

    # redis:
    #     image: redis:5.0.6
    #     container_name: shopware_redis
    #     networks:
    #         - web
    
    # elasticsearch:
    #     container_name: shopware_elasticsearch
    #     image: elastic/elasticsearch:7.1.1
    #     environment:
    #         - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
    #         - discovery.type=single-node

volumes:
    db_volume:
        driver: local
    shop_volume:
        driver: local


networks:
  web:
    external: false

@boxblinkracer
Copy link
Collaborator

boxblinkracer commented Jun 28, 2021

hi

thank you for this

i think this is a bit too much :)

you can just spawn a simple docker database and connect to it with the connection string.
please note, the "host" address when connection from container A to container B inside a docker infrastructure is the "container name" of your yaml

i guess this page is what you where looking for?

https://docs.dockware.io/faq/dockware-and-other-images

there are also lots of examples in our github repo
https://github.com/dockware/examples

i hope this helps you

@boxblinkracer boxblinkracer added the Question Questions, help requests and more label Jun 28, 2021
@btxtiger
Copy link
Author

@boxblinkracer To be honest, I never use these docker one-line start image commands, except for few use-cases with testing. In most cases always docker-compose. Despite I really very appreciate this project, I found the docs very confusing when being new to dockware.

However for me is everything clear for now. Except I don't understand why the dockware/play image comes with example data included and not starting with the installer (that can install example data itself), is this possible anyway? Otherwise I have to delete them every time

@boxblinkracer
Copy link
Collaborator

hi,
first of all, great that you like it :)

there are also some videos with step by step explanation..maybe this helps too:
https://www.youtube.com/watch?v=BVCM03M6FLc

i dont know what you mean with one-liner...i never said anything about a one liner :)
i also use almost everytime a docker-compose.yml too.
i was more referring to the shopware .env file where a connection string needs to be provided, and in that string you have to use the docker name of your database container :)

regarding the demo data....for us, there are 2 types of projects....
either one with a custom database and lots of modifications (so like a huge customer project)
or plugin projects where you want demo data anyway.
so both play and dev images come with demo data to be able to immediately play around or develop custom plugins....
if it would be the case for a customer project, one would have its own database anyway.

so i'm not quite sure why you would need a blank shopware?
if you have some scripts, on what needs to be reset, then we could try to add it in the entrypoint.
still it needs to be installed at build time, in order to allow a speedy launch of a few seconds :)

@btxtiger
Copy link
Author

Okay, seems I have a rare use-case.
We had Shopware 6 as custom installed docker setup before, but always had strange issues with permissions. After updating to 6.4.1.2 noting worked anymore. No plugin update, no theme change, activation/deactivation, always failing with "Warning: chmod(): Operation not permitted". So we decided to start a new clean instance, because we are not on production and still connecting our backend that manages most of the data. Thats why I needed a clean DB :)

This use-case will come back, when the shop is running on prod and we need to have it running locally for further development. Then our backend would sync all necessary dummy data, and that would get mixed up with the demo data.

However for now after deleting the demo data by hand and copy our APP_SECRET and INSTANCE_ID, it is working good.

@boxblinkracer
Copy link
Collaborator

hi

ok so 2 things that could help

a) i dont know what happened to the permission but this fixes it
"sudo chmod www-data:www-data -R /var/www/html"
i think we will add a doc page soon in the FAQs

b) what we do in this case is this
we have our custom shop based on dockware/essentials...that comes without an installed shop instance...so no mixed files and no confusions with any version that does not match our actual shop version...just our plain source code in there...
and we also just import an anonymized and clean dump of our production database when launching the image

maybe it helps you :)

@btxtiger
Copy link
Author

btxtiger commented Jul 1, 2021

Thanks for the support. Its working for now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Question Questions, help requests and more
Projects
None yet
Development

No branches or pull requests

2 participants