How to add demo data in docker image creation?

so that admin user already created no need to create Initial Admin Account.

To clarify what Girindra is asking, how do we specify whether or not to load demo data when deploying with docker?

1 Like

You almost certainly want to load all of the demo data, because if you have a john.doe account with the password of moqui then random people will be able to login as admin.

To selectively load data once an environment has started you can go to the data import screen and just load a certain component or data type.

If you really have to run moqui and load all the demo data, you can see the various options for running moqui here:

~/moqui$ java -jar moqui.war --help
Determined runtime from existing runtime subdirectory: /home/desktop/moqui/runtime
Canonicalized runtimePath: /home/desktop/moqui/runtime
Determined conf by default (dev conf file): conf/MoquiDevConf.xml
------------------------------------------------
Current runtime directory (moqui.runtime): /home/desktop/moqui/runtime
Current configuration file (moqui.conf): conf/MoquiDevConf.xml
To set these properties use something like: java -Dmoqui.conf=conf/MoquiProductionConf.xml -jar moqui.war ...
------------------------------------------------
Executable WAR : java -jar moqui.war [command] [arguments]
Expanded WAR   : java -cp . MoquiStart [command] [arguments]
help, -? ---- Help (this text)
load -------- Run data loader
    types=<type>[,<type>] ------- Data types to load (can be anything, common are: seed, seed-initial, install, demo, ...)
    components=<name>[,<name>] -- Component names to load for data types; if none specified loads from all
    location=<location> --------- Location of data file to load
    timeout=<seconds> ----------- Transaction timeout for each file, defaults to 600 seconds (10 minutes)
    no-fk-create ---------------- Don't create foreign-keys, for empty database to avoid referential integrity errors
    dummy-fks ------------------- Use dummy foreign-keys to avoid referential integrity errors
    use-try-insert -------------- Try insert and update on error instead of checking for record first
    disable-eeca ---------------- Disable Entity ECA rules
    disable-audit-log ----------- Disable Entity Audit Log
    disable-data-feed ----------- Disable Entity DataFeed
    raw ------------------------- For raw data load to an empty database; short for no-fk-create, use-try-insert, disable-eeca, disable-audit-log, disable-data-feed
    conf=<moqui.conf> ----------- The Moqui Conf XML file to use, overrides other ways of specifying it
    no-run-es ------------------- Don't Try starting and stopping ElasticSearch in runtime/elasticsearch
    If no -types or -location argument is used all known data files of all types will be loaded.
[default] ---- Run embedded Jetty server
    port=<port> ---------------- The http listening port. Default is 8080
    threads=<max threads> ------ Maximum number of threads. Default is 100
    conf=<moqui.conf> ---------- The Moqui Conf XML file to use, overrides other ways of specifying it
    no-run-es ------------------- Don't Try starting and stopping OpenSearch in runtime/opensearch or ElasticSearch in runtime/elasticsearch

========== Shutting down Moqui Executable (closing jars, etc) ==========

For example:

java -jar moqui.war load types=demo conf=conf/MoquiProductionConf.xml

For changing a docker compose file here: moqui-framework/moqui-ng-my-compose.yml at 695824b0a55f43797abdf7d249a28012f56db596 · moqui/moqui-framework · GitHub to:

    command: load types=demo conf=conf/MoquiProductionConf.xml

After doing running that (that won’t start up moqui), so then after change it back to moqui-framework/moqui-ng-my-compose.yml at 695824b0a55f43797abdf7d249a28012f56db596 · moqui/moqui-framework · GitHub

Hope that helps.

2 Likes

Thanks a lot @michael solution is very helpful .

1 Like

Thanks @michael. I think this line is the one we were missing. We will try adding ‘load types=demo’.

1 Like