Wonach suchst Du?
What are you looking for?

How to set up the metasfresh stack using Docker?

Overview

This manual describes the installation of the following services according to this overview:

Hardware Requirements

  Minimum Recommended
RAM 4 GB 8 GB (increases with db size)
CPU 1 VCPU 4 VCPU
HDD 10 GB 20 GB
OS Recommendation Linux server Ubuntu 22.04

Installation with Docker

Install Docker and Docker Compose

Install Docker and Docker Compose plugin via the official Docker repository.

  1. Install Docker.
  2. Install Docker Compose plugin.

Install metasfresh

  1. Clone the metasfresh-docker folder and change into the newly created directory.

    git clone https://github.com/metasfresh/metasfresh-docker.git
    cd metasfresh-docker/
    
  2. Next, with an editor of your choice (e.g., nano, vi) open the docker-compose.yml and adapt it as you need it.

    Note: You will find an example for this at the end of this guide.

  3. Comment environment and http://example.com:8080 and replace example.com:8080 with the URL and port, where the server should be reachable from the browser.

    ...
    environment:
      - WEBAPI_URL=http://example.com:8080
    ...
    

    Note: Port :8080 is only necessary if another port should be used as port 80.
    See also: How do I change the WebUI ports for metasfresh-Docker?

    IMPORTANT:
    If you are using an RPM-based distribution and/or the file /etc/timezone is not available on your Docker host, comment out or remove the line - /etc/timezone:/etc/timezone:ro from your docker-compose.yml file!
  4. Create the Docker containers.

    docker-compose build

  5. Now you can start and stop docker with the folowing commands:

    #start#
    docker-compose up -d
    #stop#
    docker-compose down
    

    Note: The first time you start the container, it may take a few minutes until the database is populated and the service is available.

Access

After successful installation you can access the WebUI via:

or

Next Steps

Example docker-compose.yml

db:
  build: db
  restart: always
  volumes:
    - ./volumes/db/data:/var/lib/postgresql/data
    - ./volumes/db/log:/var/log/postgresql
    - /etc/localtime:/etc/localtime:ro
    - /etc/timezone:/etc/timezone:ro
  environment:
    - METASFRESH_USERNAME=metasfresh
    - METASFRESH_PASSWORD=metasfresh
    - METASFRESH_DBNAME=metasfresh
    - DB_SYSPASS=System
app:
  build: app
  hostname: app
  links:
    - db:db
    - search:search
  expose:
    - "8282"
    - "61616"
  restart: always
  volumes:
    - ./volumes/app/log:/opt/metasfresh/log:rw
    - /etc/localtime:/etc/localtime:ro
    - /etc/timezone:/etc/timezone:ro
  environment:
    - METASFRESH_HOME=/opt/metasfresh
webapi:
  build: webapi
  links:
    - app:app
    - db:db
    - search:search
  #for accessing the api directly (eg. for debugging or connecting your
  #app to the metasfresh api) uncomment following lines:
  #ports:
    #- "8080:8080"
  restart: always
  volumes:
    - ./volumes/webapi/log:/opt/metasfresh-webui-api/log:rw
    - /etc/localtime:/etc/localtime:ro
    - /etc/timezone:/etc/timezone:ro
webui:
  build: webui
  links:
    - webapi:webapi
  ports:
    - "80:80"
    - "443:443"
  restart: always
  volumes:
    - /etc/localtime:/etc/localtime:ro
    - /etc/timezone:/etc/timezone:ro
  #uncomment and set to URL where metasfresh will be available from browsers
  environment:
    - WEBAPI_URL=http://myserver.com
    search:
      build: search
      ulimits:
        memlock:
          soft: -1
          hard: -1
        nofile:
          soft: 65536
          hard: 65536
      cap_add:
        - IPC_LOCK
      volumes:
        - ./volumes/search/data:/usr/share/elasticsearch/data
        - /etc/localtime:/etc/localtime:ro
        - /etc/timezone:/etc/timezone:ro
      environment:
        - "ES_JAVA_OPTS=-Xms128M -Xmx256m"
      restart: always

Making the reports visible for editing purposes

If you want to make the reports contained in the metasfresh app Docker image editable, you first have to move them outside as a volume in the docker-compose.yml.

# Added new reports volume to be able to
# to customize the Jasper Reports files
  volumes:
    - ./volumes/app/reports:/opt/metasfresh/reports:rw
    - ./volumes/app/log:/opt/metasfresh/log:rw
    - /etc/localtime:/etc/localtime:ro
    - /etc/timezone:/etc/timezone:ro
ATTENTION:
This is where the compiled Jasper files are located of course. So to change the reports you first have to pull the repository with the sources of the reports and then compile them with Jasper Reports.

Docker Container Visualization

See this forum post about this topic for recommendations on two widely used tools.

Feedback

If you have any questions or problems, feel free to ask for support in our official public forum:


View source file on GitHub.com