How keep data plugin/themes after docker-compose

2 weeks ago
Hello,
My docker compose is :
version: "3.4"
services:
    nopcommerce_web:
        build: .
        container_name: nopcommerce
        ports:
            - "8010:80"
            - "8011:80"
            - "8012:80"        
        depends_on:
            - nopcommerce_database
        environment:
          ASPNETCORE_ENVIRONMENT: ${ASPNETCORE_ENVIRONMENT}          
          ConnectionStrings__ConnectionString: ${CONNECTIONSTRING}
    nopcommerce_database:
        image: "mcr.microsoft.com/mssql/server:2019-latest"
        container_name: nopcommerce_mssql_server
        expose:
          - "1433"
        environment:
            SA_PASSWORD: ${SA_PASSWORD}
            ACCEPT_EULA: "Y"
            MSSQL_PID: "Express"
        ports:
          - "1433:1433"
        volumes:
          - nopcommerce_db:/var/opt/mssql
volumes:
  nopcommerce_data:        
  nopcommerce_db:

With the connection string, if I use docker-compose down and docker-compose up -d, the information for the connection string is okay, but I lose my theme or plugin installed.
I don't want to create a volume for the entire website because I would like to personalize multiple pages if necessary.
Thanks for your help


-->I find the solution, we need modify dockerignores and dockerfile to includes plugins
2 weeks ago
In your case, to preserve the themes or plugins installed in your nopCommerce, you need to bind volumes for those specific directories.
2 weeks ago
I copied the plugin files from the Dockerfile. When I restart docker-compose, I do indeed have the plugin installed. The data is saved in a database, I suppose? So, the result is the same as if I had used a volume?
2 weeks ago
In the site's \App_Data folder there is plugins.json file that indicates which plugins are installed.
Once a plugin is installed, then it creates its settings in the [Setting] table of the DB.

The "Default store theme" is selected (per store) on the Admin > General Settings  page.  Thus that setting is in the [Setting] table of the DB. (storeinformationsettings.defaultstoretheme)
2 weeks ago
When I create a volum to plugins.json I have this error : Storing keys in a directory '/app/App_Data/DataProtectionKeys' that may not be persisted outside of the container. Protected data will be unavailable when container is destroyed.
Unhandled exception. System.AggregateException: One or more errors occurred. (Access to the path '/app/App_Data/plugins.json' is denied.).
My docker-compose:
version: "3.4"
services:
    nopcommerce_web:
        build: .
        container_name: nopcommerce
        ports:
            - "8012:80"        
        depends_on:
            - nopcommerce_database
        environment:
          ASPNETCORE_ENVIRONMENT: ${ASPNETCORE_ENVIRONMENT}          
          ConnectionStrings__ConnectionString: ${CONNECTIONSTRING}
        volumes:
          - plugins_json_volume:/app/App_Data/plugins.json
    nopcommerce_database:
        image: "mcr.microsoft.com/mssql/server:2019-latest"
        container_name: nopcommerce_mssql_server
        expose:
          - "1433"
        environment:
            SA_PASSWORD: ${SA_PASSWORD}
            ACCEPT_EULA: "Y"
            MSSQL_PID: "Express"
        ports:
          - "1433:1433"
        volumes:
          - nopcommerce_db:/var/opt/mssql
volumes:
  nopcommerce_db:
  plugins_json_volume:
2 weeks ago
As per the error message, it's unable to access the file at ‘/app/App_Data/plugins.json’
This can be because
- file does not exist.  Is the "/app/" folder correct?
- the app doesn’t have the necessary permissions. (Give read, write, and execute permissions for the file.)
- the user running the Docker container might not have the necessary permissions to access the file.