Deploy EzyPlatform with Docker

Updated at 1763718609000
Our deployment diagram can be as follows: Sơ đồ triển khai ezyplatform sử dụng docker.png

Here we keep the database outside of the container, but you can also run the database inside the container if you prefer — both options work fine.

Creating the docker-compose.yaml file

You can create a docker-compose.yaml file with the following content:

services:
    mysql:
      image: mysql:8.0
      container_name: ezyplatform-mysql
      restart: unless-stopped
      environment:
        - MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD:-ezyplatform2025}
        - MYSQL_DATABASE=${MYSQL_DATABASE:-ezyplatform}
        - MYSQL_USER=${MYSQL_USER:-ezyplatform}
        - MYSQL_PASSWORD=${MYSQL_PASSWORD:-ezyplatform2025}
      ports:
        - "13306:3306"
      volumes:
        - mysql-data:/var/lib/mysql
      networks:
        - ezyplatform-network
      healthcheck:
        test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
        timeout: 20s
        retries: 10
    ezyplatform:
      image: youngmonkeys/ezyplatform-only
      container_name: ezyplatform
      restart: unless-stopped
      depends_on:
        mysql:
          condition: service_healthy
      environment:
        - DATASOURCE_JDBC_URL=${DATASOURCE_JDBC_URL:-jdbc:mysql://mysql:3306/ezyplatform}
        - DATASOURCE_DRIVER_CLASS_NAME=${DATASOURCE_DRIVER_CLASS_NAME:-com.mysql.cj.jdbc.Driver}
        - DATASOURCE_USERNAME=${MYSQL_USER:-ezyplatform}
        - DATASOURCE_PASSWORD=${MYSQL_PASSWORD:-ezyplatform2025}
        - EZY_CREATE_TABLE_MANUALLY=${EZY_CREATE_TABLE_MANUALLY:-false}
        - EZY_ENCRYPTION_KEY=${EZY_ENCRYPTION_KEY:-4vxCmBJSDjivQrgIsnIACtBGSbJlNJ6j}
        - EZY_SOCKET_START=${EZY_SOCKET_START:-false}
      ports:
        - "9090:9090"
        - "8080:8080"
        - "3005:3005"
        - "2208:2208"
        - "2611:2611/udp"
      networks:
        - deploy-network
        - ezyplatform-network
      volumes:
        - ezyplatform-data:/app/ezyplatform
volumes:
  mysql-data: {}
  ezyplatform-data: {}
networks:
  ezyplatform-network: {}
  deploy-network:
    name: ${DEPLOY_NETWORK_NAME:-deploy-network}
    external: ${DEPLOY_NETWORK_EXTERNAL:-false}

In this configuration:

  1. Ports 9090 and 8080 are for HTTP; you will need to expose these ports.
  2. Ports 3005, 2208, and 2611 are for socket services. If your project does not require them, you can remove them.

Running the services

You can run the stack with:

docker compose up

If you want to run it in console mode.

Or:

docker compose up -d

If you want to run it in the background.

After starting successfully, you can access http://server_ip:9090. However, you may want to complete the installation only after configuring your load balancer.

Load balancer configuration

You can configure your load balancer to attach domain names and SSL certificates to your project. For example:

  1. https://yourdomain.comhttp://server_ip:8080
  2. https://admin.yourdomain.comhttp://server_ip:9090

After that, you can proceed with setting up the EzyPlatform admin just like in the standard non-Docker installation.

Table Of Contents