From 58bf208fc01557fdfb9154c75817dd033a965520 Mon Sep 17 00:00:00 2001 From: Acetousk Date: Fri, 9 Aug 2024 18:22:59 -0600 Subject: [PATCH] Create docker-compose.yaml --- docker-compose.yaml | 92 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 docker-compose.yaml diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 000000000..2af8dc924 --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,92 @@ +# A Docker Compose application with Moqui, Postgres, OpenSearch, OpenSearch Dashboards, and virtual hosting through +# nginx-proxy supporting multiple moqui instances on different hostnames. + +# Run with something like this for detached mode: +# $ docker compose -f moqui-postgres-compose.yml -p moqui up -d +# Or to copy runtime directories for mounted volumes, set default settings, etc use something like this: +# $ ./compose-run.sh moqui-postgres-compose.yml +# This sets the project/app name to 'moqui' and the network will be 'moqui_default', to be used by external moqui containers + +# Test locally by adding the virtual host to /etc/hosts or with something like: +# $ curl -H "Host: moqui.local" localhost/Login + +# To run an additional instance of moqui run something like this (but with +# many more arguments for volume mapping, db setup, etc): +# $ docker run -e VIRTUAL_HOST=moqui2.local --name moqui2_local --network moqui_default moqui + +# To import data from the docker host using port 5432 mapped for 127.0.0.1 only use something like this: +# $ psql -h 127.0.0.1 -p 5432 -U moqui -W moqui < pg-dump.sql + +version: "2" +services: + moqui-server: + image: moqui + container_name: moqui-server + command: conf=conf/MoquiProductionConf.xml + restart: always + links: + - moqui-database + - moqui-search + volumes: + - ./runtime/conf:/opt/moqui/runtime/conf + - ./runtime/lib:/opt/moqui/runtime/lib + - ./runtime/classes:/opt/moqui/runtime/classes + - ./runtime/ecomponent:/opt/moqui/runtime/ecomponent + - ./runtime/log:/opt/moqui/runtime/log + - ./runtime/txlog:/opt/moqui/runtime/txlog + - ./runtime/sessions:/opt/moqui/runtime/sessions + # this one isn't needed when not using H2/etc: - ./runtime/db:/opt/moqui/runtime/db + environment: + - "JAVA_TOOL_OPTIONS=-Xms1024m -Xmx1024m" + - instance_purpose=production + - entity_ds_db_conf=postgres + - entity_ds_host=moqui-database + - entity_ds_port=5432 + - entity_ds_database=moqui + - entity_ds_schema=public + - entity_ds_user=moqui + - entity_ds_password=moqui + - entity_ds_crypt_pass='DEFAULT_CHANGE_ME!!!' + # configuration for ElasticFacade.ElasticClient, make sure the old moqui-elasticsearch component is NOT included in the Moqui build + - elasticsearch_url=https://moqui-search:9200 + # prefix for index names, use something distinct and not 'moqui_' or 'mantle_' which match the beginning of OOTB index names + - elasticsearch_index_prefix=default_ + - elasticsearch_user=admin + - elasticsearch_password=admin + # CHANGE ME - note that VIRTUAL_HOST is for nginx-proxy so it picks up this container as one it should reverse proxy + # this can be a comma separate list of hosts like 'example.com,www.example.com' + - VIRTUAL_HOST=moqui.local + # moqui will accept traffic from other hosts but these are the values used for URL writing when specified: + # - webapp_http_host=moqui.local + - webapp_http_port=80 + - webapp_https_port=443 + - webapp_https_enabled=true + # nginx-proxy populates X-Real-IP with remote_addr by default, better option for outer proxy than X-Forwarded-For which defaults to proxy_add_x_forwarded_for + - webapp_client_ip_header=X-Real-IP + - default_locale=en_US + - default_time_zone=US/Pacific + + moqui-search: + image: opensearchproject/opensearch:2.4.0 + container_name: moqui-search + restart: always + ports: + # change this as needed to bind to any address or even comment to not expose port outside containers + - 127.0.0.1:9200:9200 + - 127.0.0.1:9300:9300 + volumes: + # edit these as needed to map configuration and data storage + - ./opensearch/data:/usr/share/opensearch/data + # - ./opensearch/config/opensearch.yml:/usr/share/opensearch/config/opensearch.yml + # - ./opensearch/logs:/usr/share/opensearch/logs + environment: + - "OPENSEARCH_JAVA_OPTS=-Xms512m -Xmx512m" + - discovery.type=single-node + - network.host=_site_ + ulimits: + memlock: + soft: -1 + hard: -1 + nofile: + soft: 65536 + hard: 65536