Requirements:

Name Value
Java 12+
InfluxDB 1.x
Docker Engine  
Docker Compose v1  

Others:

  • languages:Kotlin
  • frameworks:Spring Boot,JDBI
  • test frameworks:Junit5,Spring Boot Test,Flyway,H2
  • build tool:Gradle
  • data storage:MySQL, InfluxDB

Components:

  • ArchGuard backend - connect scanner and show data.
  • ArchGuard frontend - visualization results & dashboard
  • Chapi - Chapi is A common language meta information convertor, convert different languages to same meta-data model.

Setup

Backend setup

clone:

git clone https://github.com/archguard/archguard
or
git clone git@github.com:archguard/archguard.git

run

cd archguard/server && ./gradlew bootrun
  • Spring default port:8080
  • MySQL default port: 3306
  • InfluxDB default port: 8086

如果需要修改端口,请同步更新docker compose配置config/infrastructure/docker-compose.local.yml 和 后端配置application-local.properties

Frontend setup

important!: start backend before frontend.

git clone https://github.com/archguard/archguard-frontend
or
git clone git@github.com:archguard/archguard-frontend.git

run

cd archguard-frontend && cd archguard
yarn install
yarn start

After start, visit:http://localhost:8081/

其他

Mac(M1)中如何运行

  1. 下载ArchGuard相关文件 git仓库:https://github.com/archguard/archguard

    下载方式(两种方式均可):

    1. git clone https://github.com/archguard/archguard.git or git clone git@github.com:archguard/archguard.git
    2. https://github.com/archguard/archguard/archive/refs/heads/master.zip
  2. 本地启动后端(ArchGuard backend)

    进入上面下载文件中的主目录

    ./gradlew bootrun
    

    启动成功标识:

image-20220410121806261

  1. 修改docker-compose文件

    version: '3.8'
    services:
      archguard-frontend:
        image: "archguard/archguard-frontend:latest"
        container_name: archguard-frontend
        depends_on:
          - archguard-backend
        ports:
          - "11080:80"
        networks:
          - dependence_network
       
      archguard-backend:
        image: "archguard/archguard-backend:latest"
        container_name: archguard-backend
        environment:
          app_env: debug
        volumes:
          - "~/.m2:/root/.m2"
          - "~/.gradle:/root/.gradle"
        healthcheck:
          test: curl -f http://localhost:8080/api/actuator/health || exit 1
          timeout: 10s
          retries: 5
        networks:
          - dependence_network
        restart: on-failure:10
       
      archguard_influxdb:
        image: "influxdb:1.8"
        container_name: archguard_influxdb
        ports:
          - '8086:8086'
        networks:
          - dependence_network
        healthcheck:
          test: curl -f http://localhost:8086/ping || exit 1
          timeout: 10s
          retries: 5
        volumes:
          - ./archguard_influxdb:/var/lib/influxdb
        environment:
          - INFLUXDB_DB=db0
          - INFLUXDB_ADMIN_USER=admin
          - INFLUXDB_ADMIN_PASSWORD=admin
       
    networks:
      dependence_network:
       
    
  2. 启动docker-compose

    docker-compose up
    
  3. 进入archguard-frontend运行容器中,修改nginx的配置

    • 进入容器,其中,为archguard-frontend运行时的容器ID,可通过docker ps查看到
    docker exec -it <CONTAINER ID>
    
    • 修改nginx配置
    vi /etc/nginx/conf.d/default.conf
    

    这里的ip调整为宿主机的ip

image-20220410122533914

  • 重新nginx配置

       /usr/sbin/nginx -s reload
    
  1. 最后即可在浏览器中正常访问

    http://127.0.0.1:11080/home
    

image

  1. 如果想使用docker运行,则需要先去

    https://hub.docker.com/_/openjdk?tab=tags&page=1
    

    自行寻找一个镜像,镜像必须要支持ARM64,否则在m1下会报错

img.png

然后更改dockerfile,把的来源更改掉,换成所选择掉镜像。 因为所有的alpine镜像都不支持ARM,所以 apk 命令也无法使用,自行百度设置一下容器内部时间,然后执行dockerfile即可


Table of contents