赞
踩
Archery是一个开源的Web应用,基于Python开发,利用Flask作为后端框架,前端采用Vue.js,构建了一个现代化的数据操作界面。提供了SQL审核、数据查询、报表生成等功能,同时支持多种数据库接入,包括Hive、MySQL、Oracle、SQL Server等。
#检查是否安装docker及docker-compose
docker --version
docker-compose --version
如果没安装docker或者docker-compose。
教程:Ubuntu20.04 LTS国内源安装指定版本Docker_ubuntu 20.04.1 lts 安装docker-CSDN博客
Docker安装和卸载(centos)_centos卸载docker-CSDN博客
#docker-compose安装
#下载docker-compose文件
sudo curl -L https://github.com/docker/compose/releases/download/v2.20.2/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
#添加可执行权限
sudo chmod +x /usr/local/bin/docker-compose
#测试安装结果
docker-compose --version
#下载安装文件
cd /home/
wget https://github.com/hhyo/archery/archive/v1.11.0.tar.gz
#解压
tar -zxvf v1.11.0.tar.gz
#重命名
mv Archery-1.11.0 archery
#进入docker-compose文件所在位置
cd src/docker-compose/
#/home/archery/src/docker-compose
#内容如下cat docker-compose.yml version: '3' services: redis: image: redis:5 container_name: redis restart: always command: redis-server --requirepass 123456 expose: - "6379" healthcheck: test: [ "CMD", "redis-cli", "ping" ] interval: 5s timeout: 5s retries: 5 mysql: image: mysql:5.7 container_name: mysql restart: always ports: - "3306:3306" volumes: - "./mysql/my.cnf:/etc/mysql/my.cnf" - "./mysql/datadir:/var/lib/mysql" environment: MYSQL_DATABASE: archery MYSQL_ROOT_PASSWORD: 123456 healthcheck: test: ["CMD", "mysqladmin", "ping"] interval: 5s timeout: 5s retries: 5 goinception: image: hanchuanchuan/goinception container_name: goinception restart: always ports: - "4000:4000" volumes: - "./inception/config.toml:/etc/config.toml" archery: # 下方的镜像地址仅为示例, 请前往以下地址确认你需要的版本: # dockerhub https://hub.docker.com/r/hhyo/archery # github packages https://github.com/hhyo/Archery/pkgs/container/archery # 如有需要, 也可以自行build docker 镜像, 替换为自己的镜像 image: hhyo/archery:v1.10.0 container_name: archery restart: always depends_on: redis: condition: service_healthy mysql: condition: service_healthy ports: - "9123:9123" volumes: - "./archery/settings.py:/opt/archery/local_settings.py" - "./archery/soar.yaml:/etc/soar.yaml" - "./archery/docs.md:/opt/archery/docs/docs.md" - "./archery/downloads:/opt/archery/downloads" - "./archery/sql/migrations:/opt/archery/sql/migrations" - "./archery/logs:/opt/archery/logs" - "./archery/keys:/opt/archery/keys" entrypoint: "bash /opt/archery/src/docker/startup.sh" env_file: - .env
#部署
docker-compose up -d
然后查看是否启动成功
docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
52da46df8ddc registry.cn-hangzhou.aliyuncs.com/docker_image-ljx/mysql:5.7 "docker-entrypoint.s…" 5 hours ago Up 4 seconds (health: starting) 0.0.0.0:3306->3306/tcp, :::3306->3306/tcp, 33060/tcp mysql
efc34350d7df registry.cn-hangzhou.aliyuncs.com/docker_image-ljx/archery:v1.10.0 "bash /opt/archery/s…" 23 hours ago Up 4 seconds 0.0.0.0:9123->9123/tcp, :::9123->9123/tcp archery
92352a46d78a registry.cn-hangzhou.aliyuncs.com/docker_image-ljx/goinception "/usr/local/bin/dumb…" 23 hours ago Up 3 seconds 0.0.0.0:4000->4000/tcp, :::4000->4000/tcp goinception
caa42b1b499c registry.cn-hangzhou.aliyuncs.com/docker_image-ljx/redis:5 "docker-entrypoint.s…" 23 hours ago Up 2 seconds (health: starting) 6379/tcp redis
#确认运行成功后,进入archery容器
docker exec -ti archery /bin/bash
#进行如下操作初始化表结构
cd /opt/archery
source /opt/venv4archery/bin/activate
python3 manage.py makemigrations sql
python3 manage.py migrate
# 数据初始化
python3 manage.py dbshell<sql/fixtures/auth_group.sql
python3 manage.py dbshell<src/init_sql/mysql_slow_query_review.sql
# 创建管理用户
python3 manage.py createsuperuser
用户名: admin 电子邮件地址: admin@qq.com Password: admin123 ( 实际操作中密码是不显示的 ) Password (again): admin123 密码跟 用户名 太相似了。 密码长度太短。密码必须包含至少 9 个字符。 这个密码太常见了。 Bypass password validation and create user anyway? [y/N]: y Superuser created successfully.
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
地址:<主机IP>:9123
,用户名和密码就是上一步创建的。
至此安装步骤完毕。
选择添加实例
然后填入数据库相关信息
点击保存
SQL上线,点击提交SQL。
然后选择数据库实例,填入sql。
在触发检测的时候可以检查SQL是否有误。
修改正确后就可以提交了
我们可以看到数据库里已经多出了这一条数据
执行成功后还可以查看或者下载回滚SQL对该操作进行回滚。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。