myesn commented on issue #3166:
URL: 
https://github.com/apache/incubator-shenyu/issues/3166#issuecomment-1092405683

   @JooKS-me **Thank you very much for your reply**, I have compiled the 
following information for your reference.
   
   All of the following steps are performed on the `Raspberry Pi`:
   
   **1.** Download and extract [v2.4.2 Souce 
code(tar.gz)](https://github.com/apache/incubator-shenyu/archive/refs/tags/v2.4.2.tar.gz)
   **2.** Open and edit the contents of 
`incubator-shenyu-2.4.2/shenyu-dist/shenyu-admin-dist/Dockerfile` and 
`incubator-shenyu-2.4.2/shenyu-dist/shenyu-bootstrap-dist/Dockerfile` files:
   
   ```
   # 1. Replace `FROM openjdk:8-jre-alpine` with:
   FROM openjdk:8u322-jre
   
   # 2. Replace `apk --no-cache add procps` with:
   RUN apt-get update && \
       apt-get install -y --no-install-recommends procps && \
       rm -rf /var/lib/apt/lists/*
   ```
   
   **3.** Switch to the `incubator-shenyu-2.4.2/shenyu-dist` directory and 
execute the following command (Total time 10:51 min):
   ```bash
   mvn clean install -Dmaven.javadoc.skip=true -B -Drat.skip=true 
-Djacoco.skip=true -DskipITs -DskipTests -Prelease,docker
   ```
   
   Although the following warning appears during the build process, the final 
result is `BUILD SUCCESS`:
   
   ```
   [INFO] --- maven-assembly-plugin:3.0.0:single (admin-bin) @ 
shenyu-admin-dist ---
   [INFO] Reading assembly descriptor: 
/home/ubuntu/shenyu/incubator-shenyu-2.4.2/shenyu-dist/shenyu-admin-dist/src/main/assembly/binary.xml
   [WARNING] The assembly descriptor contains a filesystem-root relative 
reference, which is not cross platform compatible /
   [WARNING] Cannot include project artifact: 
org.apache.shenyu:shenyu-admin-dist:pom:2.4.2; it doesn't have an associated 
file or directory.
   
   [INFO] --- maven-assembly-plugin:3.0.0:single (bootstrap-bin) @ 
shenyu-bootstrap-dist ---
   [INFO] Reading assembly descriptor: 
/home/ubuntu/shenyu/incubator-shenyu-2.4.2/shenyu-dist/shenyu-bootstrap-dist/src/main/assembly/binary.xml
   [WARNING] The assembly descriptor contains a filesystem-root relative 
reference, which is not cross platform compatible /
   [WARNING] Cannot include project artifact: 
org.apache.shenyu:shenyu-bootstrap-dist:pom:2.4.2; it doesn't have an 
associated file or directory.
   ```
   
   <details>
        <summary>docker images output</summary>
        
   ```
   ubuntu@ubuntu:~/shenyu/docker/shenyu-v2.4.2$ docker images
   REPOSITORY                TAG         IMAGE ID       CREATED          SIZE
   apache/shenyu-bootstrap   2.4.2       c2ed2d3e9c8e   28 minutes ago   557MB
   apache/shenyu-bootstrap   latest      c2ed2d3e9c8e   28 minutes ago   557MB
   apache/shenyu-admin       2.4.2       260bf5284967   34 minutes ago   426MB
   apache/shenyu-admin       latest      260bf5284967   34 minutes ago   426MB
   openjdk                   8u322-jre   285c82c72a84   8 days ago       265MB
   portainer/portainer-ce    2.11.1      8000bafa387b   8 weeks ago      267MB
   mariadb                   10.2.41     9af1a2a8b723   2 months ago     325MB
   ```  
   </details>
   
   **4.** Execute the following command to download the `v2.4.2 install.sh` 
file (auto-execute), the script will create a `shenyu-v2.4.2` directory, since 
the database does not support `arm64` architecture, this script will terminate 
when it outputs `Pulling db(docker.io/mysql:5.7)`:
   
   ```bash
   curl 
https://raw.githubusercontent.com/apache/incubator-shenyu/v2.4.2/shenyu-dist/shenyu-docker-compose-dist/src/main/resources/install.sh
 | bash -s v2.4.2 mysql
   ```
   
   **5.** Open the `shenyu-v2.4.2/docker-compose.yaml` file and modify the 
following:
   ```
   1. Replace the `v2.4.2` tag character in the `image` value in the 
`shenyu-bootstrap` service with `2.4.2`
   2. Replace the `v2.4.2` tag character in the `image` value in the 
`shenyu-admin` service with `2.4.2`
   3. Add a new environment variable `shenyu.register.props.checked=false` to 
the `environment` of the `shenyu-admin` service
   4. Replace the `image` value in the `db` service with `mariadb:10.2.41` 
([[type: refactor] Change mysql image to mariadb in docker-compose 
yaml](https://github.com/apache/incubator-shenyu/pull/3210))
   ```
   
   <details>
        <summary>docker-compose.yaml</summary>
        
   ```yaml
   #
   # 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.
   #
   
   version: "2.1"
   services:
     shenyu-bootstrap:
       image: apache/shenyu-bootstrap:2.4.2
       container_name: shenyu-bootstrap
       ports:
         - "9195:9195"
       volumes:
         - ./shenyu-bootstrap/logs/:/opt/shenyu-bootstrap/logs
         - ./shenyu-bootstrap/conf/:/opt/shenyu-bootstrap/conf
       links:
         - shenyu-admin:admin
       depends_on:
         - shenyu-admin
       environment:
         - shenyu.sync.websocket.urls=ws://admin:9095/websocket
     shenyu-admin:
       image: apache/shenyu-admin:2.4.2
       container_name: shenyu-admin
       environment:
         - spring.profiles.active=mysql
         - 
spring.datasource.url=jdbc:mysql://db:3306/shenyu?useUnicode=true&characterEncoding=utf-8&useSSL=false
         - spring.datasource.username=root
         - spring.datasource.password=xyzj1a2y3
         - shenyu.register.props.checked=false
       volumes:
         - ./shenyu-admin/logs/:/opt/shenyu-admin/logs
         - ./shenyu-admin/conf/:/opt/shenyu-admin/conf
         - ./shenyu-admin/ext-lib/:/opt/shenyu-admin/ext-lib
       ports:
         - "9095:9095"
       links:
         - db:db
       depends_on:
         db:
           condition: service_healthy
     db:
       image: mariadb:10.2.41
       container_name: db
       environment:
         MYSQL_ROOT_PASSWORD: xyzj1a2y3
         MYSQL_DATABASE: shenyu
       ports:
         - 3310:3306
       healthcheck:
         test: [ "CMD", "mysqladmin", "ping", "-h", "localhost", "-uroot", 
"-pxyzj1a2y3" ]
         interval: 6s
         timeout: 5s
         retries: 10
   ```  
   </details>
   
   **6.** Execute `docker-compose up -d` command to start the service 
collection, all `3` services are created and started successfully, then execute 
`docker-compose logs -f shenyu-admin` to view the logs:
   
   [shenyu-admin 
logs](https://gist.github.com/myesn/f7cb2f2a73376325ac47fc0db268dd98)
   
   From the logs, we can see that the `shenyu-admin` program is using the `h2` 
profile, but the `environment` variable configured in `docker-compose.yaml` is 
`mysql`.
   
   So I went inside the `shenyu-admin` container to check the environment 
variables and found no problems:
   
   <details>
        <summary>shenyu-admin environment variables inside the 
container</summary>
   
   ```
   ubuntu@ubuntu:~/shenyu/docker/shenyu-v2.4.2$ docker-compose exec 
shenyu-admin bash
   root@e289bd63ba2a:/opt/shenyu-admin# printenv
   shenyu.register.props.checked=false
   spring.profiles.active=mysql
   spring.datasource.username=root
   
spring.datasource.url=jdbc:mysql://db:3306/shenyu?useUnicode=true&characterEncoding=utf-8&useSSL=false
   spring.datasource.password=xyzj1a2y3
   HOSTNAME=e289bd63ba2a
   JAVA_HOME=/usr/local/openjdk-8
   PWD=/opt/shenyu-admin
   LOCAL_PATH=/opt/shenyu-admin
   HOME=/root
   LANG=C.UTF-8
   TERM=xterm
   SHLVL=1
   
PATH=/usr/local/openjdk-8/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
   JAVA_VERSION=8u322
   _=/usr/bin/printenv
   ```
   </details>
   
   **7.** So I opened the `docker-compose.yaml` file and replaced 
`spring.profiles.active=mysql` with `SPRING_PROFILES_ACTIVE=mysql` in the 
`environment` of the `shenyu-admin` service:
   
   <details>
        <summary>docker-compose.yaml</summary>  
   
   ```
   #
   # 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.
   #
   
   version: "2.1"
   services:
     shenyu-bootstrap:
       image: apache/shenyu-bootstrap:2.4.2
       container_name: shenyu-bootstrap
       ports:
         - "9195:9195"
       volumes:
         - ./shenyu-bootstrap/logs/:/opt/shenyu-bootstrap/logs
         - ./shenyu-bootstrap/conf/:/opt/shenyu-bootstrap/conf
       links:
         - shenyu-admin:admin
       depends_on:
         - shenyu-admin
       environment:
         - shenyu.sync.websocket.urls=ws://admin:9095/websocket
     shenyu-admin:
       image: apache/shenyu-admin:2.4.2
       container_name: shenyu-admin
       environment:
         - SPRING_PROFILES_ACTIVE=mysql
         - 
spring.datasource.url=jdbc:mysql://db:3306/shenyu?useUnicode=true&characterEncoding=utf-8&useSSL=false
         - spring.datasource.username=root
         - spring.datasource.password=xyzj1a2y3
         - shenyu.register.props.checked=false
       volumes:
         - ./shenyu-admin/logs/:/opt/shenyu-admin/logs
         - ./shenyu-admin/conf/:/opt/shenyu-admin/conf
         - ./shenyu-admin/ext-lib/:/opt/shenyu-admin/ext-lib
       ports:
         - "9095:9095"
       links:
         - db:db
       depends_on:
         db:
           condition: service_healthy
     db:
       image: mariadb:10.2.41
       container_name: db
       environment:
         MYSQL_ROOT_PASSWORD: xyzj1a2y3
         MYSQL_DATABASE: shenyu
       ports:
         - 3310:3306
       healthcheck:
         test: [ "CMD", "mysqladmin", "ping", "-h", "localhost", "-uroot", 
"-pxyzj1a2y3" ]
         interval: 6s
         timeout: 5s
         retries: 10
   ```
   </details>
   
   **8.** Execute `docker-compose down -v` (for a clearer view of the logs), 
then execute `docker-compose up -d` again, wait for a successful start and then 
execute `docker-compose logs -f shenyu-admin` to view the logs:
   
   [shenyu-admin 
logs](https://gist.github.com/myesn/9514ab10066955615dde424d1c7a145d)
   
   From the output log, we can see that `active profile` is already correctly 
configured for `mysql`, but there is a `Communications link failure` error, 
which causes the program to run abnormally.
   
   That's all the steps and the process.


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to