HattoriHenzo commented on issue #4704:
URL: https://github.com/apache/rocketmq/issues/4704#issuecomment-2588429530

   [late answer] I was able to configure my setup and here a the different 
steps. The `rockermq ` project has all the required files and the documents to 
help you configure your IDE, but you have to do some changes and adapt some 
part to match your local configuration:
   
   1. My OS: **Window 11 Pro**
   2. Read and configure your IDE according to the [CONTRIBUTION 
GUIDE](https://eventmesh.apache.org/community/contribute/contribute/)
   3. Create a folder, lets say `rocketmq` where you will clone 3 different 
projects:
       - [rocketmq](https://github.com/apache/rocketmq)
       - [rocketmq-docker](https://github.com/apache/rocketmq-docker)
       - [rocketmq-dashboard](https://github.com/apache/rocketmq-dashboard) 
   4. In the `rocketmq-docker` project you will find a folder named `scripts` 
in the following path: `rocketmq-docker/scripts`. Copy this folder in your root 
folder `rocketmq`. This folder contains the scripts to start `rocketmq ` 
component (proxy, nameserver and broker)
   
   At this point I have created custom `compose.yaml`, `Dockerfiles ` and a 
build file to run `rocketmq ` in docker compose. The compose file in mostly 
inspired by the one provided in the 
[documentation](https://rocketmq.apache.org/docs/quickStart/03quickstartWithDockercompose).
 
   The important modification in the compose file are:
   
   - the use of custom docker images of `rocketmq ` components build locally
   - the integration of the image of the dashboard built locally
   
   5. To activate the debugging mode, you have to uncomment  line **67** in the 
`rocketmq\scripts\runbroker-customize.sh` file. This mean you should configure 
your IDE to communicate with the same port in container
   6. The same thing is applied for the `rocketmq-dashboard` project with a 
different port already configured in the `compose.yaml` file
   
   ## Warning 1: because of some issue with the `proxy ` component, I had to 
use the image available on the docker hub
   ## Warning 2: a common error that will appear is the following **connect to 
<null> failed** with the dashboard container. You will the find some solutions 
in the **Troubleshoopting.md** file in the rocketmq repository.
   
   
![image](https://github.com/user-attachments/assets/206790d5-b6b3-474f-94d9-1423e2545e39)
   
   7. You will find the content of the files I am using to build my local 
project. You can bring any modification, I will be happy have you point of vue.
   
   **compose.yaml**
   
   ```
   version: '3.8'
   services:
     namesrv:
       image: hattorihenzo/rocketmq-broker-dev:latest
       container_name: rmqnamesrv
       ports:
         - 9876:9876
       networks:
         - rocketmq
       command: sh mqnamesrv
     broker:
       image: hattorihenzo/rocketmq-broker-dev:latest
       container_name: rmqbroker
       ports:
         - 9555:9555
         - 10909:10909
         - 10911:10911
         - 10912:10912
       environment:
         - NAMESRV_ADDR=rmqnamesrv:9876
       depends_on:
         - namesrv
       networks:
         - rocketmq
       command: sh mqbroker
     proxy:
       image: apache/rocketmq:5.3.1
       container_name: rmqproxy
       networks:
         - rocketmq
       depends_on:
         - broker
         - namesrv
       ports:
         - 8080:8080
         - 8081:8081
       restart: on-failure
       environment:
         - NAMESRV_ADDR=rmqnamesrv:9876
       command: sh mqproxy
     dashboard:
       image: hattorihenzo/rocketmq-dashboard-dev:latest
       container_name: rmqdashboard
       networks:
         - rocketmq
       ports:
         - 9090:8282
         - 5005:5005
       environment:
         - 
JAVA_OPTS=-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005 
-Drocketmq.namesrv.addr=rmqnamesrv:9876
         - NAMESRV_ADDR=rmqnamesrv:9876
   networks:
     rocketmq:
       driver: bridge
   
   ```
   
   **Dockerfile.broker**
   
   ```
   #
   # Licensed to the Apache Software Foundation (ASF) under one or more
   # contributor license agreements.  See the NOTICE file distributed with
   # this work for additional information regarding copyright ownership.
   # The ASF licenses this file to You under the Apache License, Version 2.0
   # (the "License"); you may not use this file except in compliance with
   # the License.  You may obtain a copy of the License at
   #
   #      http://www.apache.org/licenses/LICENSE-2.0
   #
   # Unless required by applicable law or agreed to in writing, software
   # distributed under the License is distributed on an "AS IS" BASIS,
   # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   # See the License for the specific language governing permissions and
   # limitations under the License.
   #
   
   
################################################################################
   # Build stage 1 `builder`:
   # Download and extract RocketMQ
   
################################################################################
   FROM eclipse-temurin:8-jdk-alpine AS builder
   
   ARG version=dev
   
   COPY rocketmq/distribution/target/rocketmq-5.3.2-SNAPSHOT.zip rocketmq.zip
   
   RUN unzip rocketmq.zip; \
       mkdir -p /tmp/rocketmq-${version}; \
       mv rocketmq*/* /tmp/rocketmq-${version}
   
   
   
################################################################################
   # Build stage 2:
   # Make the actual RocketMQ docker image
   
################################################################################
   FROM eclipse-temurin:8-jdk-alpine
   
   ARG user=rocketmq
   ARG group=rocketmq
   ARG uid=3000
   ARG gid=3000
   
   ARG version=dev
   
   # Rocketmq version
   ENV ROCKETMQ_VERSION=${version}
   
   # Rocketmq home
   ENV ROCKETMQ_HOME=/home/rocketmq/rocketmq-${ROCKETMQ_VERSION}
   
   # Expose namesrv port
   EXPOSE 9876
   # Expose broker ports
   EXPOSE 10909 10911 10912
   # Expose Debugger port
   EXPOSE 9555
   
   # RocketMQ is run with user `rocketmq`, uid = 3000
   # If you bind mount a volume from the host or a data container,
   # ensure you use the same uid
   RUN addgroup --gid ${gid} ${group} \
       && adduser --uid ${uid} -G ${group} ${user} -s /bin/bash -D \
       && apk add --no-cache bash gettext nmap-ncat openssl busybox-extras which
   
   # Copy customized scripts
   COPY scripts/ ${ROCKETMQ_HOME}/bin/
   
   # Copy RocketMQ artifact from builder
   COPY --from=builder --chown=${uid}:${gid} /tmp/rocketmq-${version}/ 
${ROCKETMQ_HOME}
   
   
   # Override customized scripts for namesrv
   # Override customized scripts for broker
   # Export Java options
   # Add ${JAVA_HOME}/lib/ext as java.ext.dirs
   RUN mv ${ROCKETMQ_HOME}/bin/runserver-customize.sh 
${ROCKETMQ_HOME}/bin/runserver.sh \
       && mv ${ROCKETMQ_HOME}/bin/runbroker-customize.sh 
${ROCKETMQ_HOME}/bin/runbroker.sh \
       && chmod -R a+x ${ROCKETMQ_HOME}/bin/ \
       && export JAVA_OPT=" -Duser.home=/opt" \
       && sed -i 
's/${JAVA_HOME}\/jre\/lib\/ext/${JAVA_HOME}\/jre\/lib\/ext:${JAVA_HOME}\/lib\/ext/'
 ${ROCKETMQ_HOME}/bin/tools.sh \
       && chown -R ${uid}:${gid} ${ROCKETMQ_HOME}
   
   USER ${user}
   
   WORKDIR ${ROCKETMQ_HOME}/bin
   
   ENTRYPOINT ["./docker-entrypoint.sh"]
   # Dummy overridable parameter parsed by entrypoint
   CMD ["dummy"]
   
   ```
   
   **Dockerfile.dashboard**
   
   ```
   #
   # Licensed to the Apache Software Foundation (ASF) under one or more
   # contributor license agreements.  See the NOTICE file distributed with
   # this work for additional information regarding copyright ownership.
   # The ASF licenses this file to You under the Apache License, Version 2.0
   # (the "License"); you may not use this file except in compliance with
   # the License.  You may obtain a copy of the License at
   #
   #     http://www.apache.org/licenses/LICENSE-2.0
   #
   # Unless required by applicable law or agreed to in writing, software
   # distributed under the License is distributed on an "AS IS" BASIS,
   # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   # See the License for the specific language governing permissions and
   # limitations under the License.
   #
   
   FROM eclipse-temurin:8-jdk-alpine
   
   #EXPOSE 5005
   
   VOLUME /tmp
   
   WORKDIR /opt/rocketmq/dashboard
   
   COPY rocketmq-dashboard/target/rocketmq-dashboard-*.jar 
rocketmq-dashboard.jar
   
   ENV JAVA_OPTS=""
   
   ENTRYPOINT [ "sh", "-c", "java $JAVA_OPTS -jar rocketmq-dashboard.jar" ]
   #CMD ["java", "$JAVA_OPTS", "-jar", "rocketmq-dashboard.jar"]
   ```
   
   **rocketmq-build.cmd**
   
   ```
   rem build and package with broker maven file
   call mvn -f rocketmq/pom.xml -Prelease-all -DskipTests clean package -U
   
   rem build and package with dashboard maven file
   call mvn -f rocketmq-dashboard/pom.xml clean package -Dmaven.test.skip=true 
-U
   
   rem build the broker Dockerfile
   call docker build --no-cache -f Dockerfile.broker -t 
hattorihenzo/rocketmq-broker-dev .
   
   rem build the dashboarc Dockerfile
   call docker build --no-cache -f Dockerfile.dashboard -t 
hattorihenzo/rocketmq-dashboard-dev .
   
   rem shutdown the docker compose
   call docker compose down
   
   rem run docker compose
   call docker compose up -d
   
   ```
   
   The content of you folder should look like this:
   
   
![image](https://github.com/user-attachments/assets/e6952f36-8158-4826-9b26-dc9fda98f6da)
   
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to