Marble ERP and H2.-

I want to start my own Marble ERP.
My best option this time is to download from GitHub in a virtual machine.
I am looking for an installation not for development, but “pre-production”.
I want to try the ERP features with almost real business’ data.
Note that, in this pre-production environment, I will need data persistence.
In this case, it’s a good idea to set up the MoquiProductionConf.xml with a configuration for H2?
If H2 is good enough for pre-production environment, what will be the content of the MoquiProductionConf.xml?

1 Like

I would use this docker file: moqui-framework/docker/moqui-acme-postgres.yml at master · moqui/moqui-framework · GitHub

I use that file for multiple deployments. The biggest flaw is no automatic backups, but you can see moqui-framework/docker/postgres_backup.sh at master · moqui/moqui-framework · GitHub for how to set them up.

The typical way to deploy with that is to:
ssh into server (can be a vm)
install git, docker, docker compose, java 11 (I use https://sdkman.io/)

git clone your moqui framework, runtime, and ./gradlew getComponentSet or getComponent for your needed components
./gradlew addRuntime # just like a gradlew build but also creates a moqui-plus-runtime.war for docker deployments
cd docker
# Change the database password and encryption passwords to production level (or pre-production level), set the DEFAULT_HOST and VIRTUAL_HOST to your domain (make sure to point your dns is pointing to your server, change any other configuration (I change the timezone), if you want you can try to change the opensearch password (probably should)
./build-compose-up.sh moqui-acme-postgres.yml

This is my standard production deployment at the moment, and is how moqui.org and demo.moqui.org are deployed

Thank you, but right now, I choose directly to use
“git clone github_com/moqui/moqui-framework.git moqui”
in an Ubuntu 22.04.5 LTS virtual machine.
I prefer this approach because the Java issues with Docker.
Just saying, the name I put to this VM 2 years ago is “docker02”. No joke.
But, I am trying an approach like a newbie to Moqui’s deployment, closer to beginners.
No docker at all -in this opportunity.

I also have a production environment where I use a Moqui clone directly, without Docker, and it seems to work well so far. I have Debian 12. Here are some recommendations based on my experience so far:

  • When pulling changes use the gradle task gitPullAll; if you use git directly, then if you have components installed, you will need to go in each component folder(eg.: runtime/component/myComp) and also run git pull from there

Here is my service file in /etc/systemd/system/moqui.service:

[Unit]
Description=Java Service

[Service]
User=danut
# The configuration file application.properties should be here:
WorkingDirectory=/home/danut/moqui-framework
ExecStart=java -Dmoqui.conf=conf/MoquiProductionConf.xml -jar moqui.war port=8085
SuccessExitStatus=143
TimeoutStopSec=10
Restart=on-failure
RestartSec=5

[Install]
WantedBy=multi-user.target

Note that for some reason by default it was loading the MoquiDevConf.xml instead of MoquiProductionConf.xml, thats why I added the -Dmoqui.conf switch there.
Now for the production configuration you can customize it for your specific case, I’m just leaving my conf here if you want to take a look at it. Note that I use a managed Postgresql database installed directly on the host system, not in Docker.

moqui-framework/runtime/conf/MoquiProductionConf.xml:

<!-- NOTE: for default settings, examples, and comments see the MoquiDefaultConf.xml file at
    https://github.com/moqui/moqui-framework/blob/master/framework/src/main/resources/MoquiDefaultConf.xml -->
<moqui-conf xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://moqui.org/xsd/moqui-conf-3.xsd">

    <server-stats stats-skip-condition="pathInfo?.startsWith('/rpc') || pathInfo?.startsWith('/rest') || pathInfo?.startsWith('/status')"/>

    <!-- NOTE: using the environment variable is relatively secure in a container environment, but for more security set it here instead -->
    <entity-facade crypt-pass="${entity_ds_crypt_pass}" query-stats="true">
        <!-- add datasource elements here to configure databases -->
    </entity-facade>

        <!-- Locale and Time Zone Properties -->
    <default-property name="default_locale" value="en_US"/>
    <default-property name="default_time_zone" value="Europe/Bucharest"/>
    <default-property name="database_time_zone" value="Europe/Bucharest"/>

        <!-- Properties for the primary (transactional group) datasource -->
    <default-property name="entity_ds_db_conf" value="postgres"/>
    <default-property name="entity_ds_host" value="127.0.0.1"/>
    <default-property name="entity_ds_port" value=""/>
    <default-property name="entity_ds_database" value="moqui"/>
    <default-property name="entity_ds_url" value="jdbc:postgresql://localhost:5432/${entity_ds_database}"/>
    <default-property name="entity_ds_schema" value=""/>
    <default-property name="entity_ds_user" value="[dbuser]"/>
    <default-property name="entity_ds_password" value="[dbpass]" is-secret="true"/>
    <default-property name="entity_ds_crypt_pass" value="MoquiDefaultPassword:[cryptpass]" is-secret="true"/>
    <default-property name="entity_ds_crypt_pass_old" value="MoquiDefaultPassword:[cryptpass]" is-secret="true"/>
    <default-property name="entity_add_missing_runtime" value="false"/>
    <default-property name="entity_add_missing_startup" value="true"/>
    <default-property name="entity_lock_track" value="false"/>
    <default-property name="entity_statement_timeout" value="false"/>
    <default-property name="entity_empty_db_load" value="seed,seed-initial,install"/>
    <default-property name="entity_on_start_load_types" value="none"/>
    <default-property name="entity_on_start_load_components" value=""/>

    <user-facade>
        <password encrypt-hash-type="SHA-256" min-length="8" min-digits="1" min-others="0"
                  history-limit="5" change-weeks="0" email-require-change="false" email-expire-hours="48"/>
        <login-key encrypt-hash-type="SHA-256" expire-hours="144"/><!-- default expire 6 days, 144 hours -->
        <login max-failures="3" disable-minutes="5" history-store="true" history-incorrect-password="false"/>
    </user-facade>
</moqui-conf>
1 Like