首页 > 数据库 >数据库审计-archery-v1.10.0-docker部署安装

数据库审计-archery-v1.10.0-docker部署安装

时间:2024-02-20 11:59:03浏览次数:37  
标签:opt archery compose v1.10 py django docker

安装docker
1.安装依赖包
yum install -y yum-utils device-mapper-persistent-data lvm2
2.添加阿里镜像仓库
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
3.安装docker
yum -y install docker-ce

安装docker compose
curl -L "https://github.com/docker/compose/releases/download/1.24.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose

下载Releases文件(https://github.com/hhyo/archery/releases/),解压后进入docker-compose文件夹

修改配置文件
路径:src/docker-compose/archery/settings.py
DEBUG = False
# 设置ALLOWED_HOSTS,建议限制内网访问
ALLOWED_HOSTS = [
    '*'
]
# 请求大小限制,如果提交SQL语句过大可以修改该值
DATA_UPLOAD_MAX_MEMORY_SIZE = 15728640
# 密码校验,用户注册和添加密码校验规则
AUTH_PASSWORD_VALIDATORS = [
    {
        'NAME' :  'django.contrib.auth.password_validation.UserAttributeSimilarity                                                                                                             Validator' ,
    },
    {
        'NAME' :  'django.contrib.auth.password_validation.MinimumLengthValidator' ,
        'OPTIONS' : {
            'min_length' : 9,
        }
    },
    {
        'NAME' :  'django.contrib.auth.password_validation.CommonPasswordValidator                                                                                                             ' ,
    },
    {
        'NAME' :  'django.contrib.auth.password_validation.NumericPasswordValidato                                                                                                             r' ,
    },
]

DATABASES = {
    'default' : {
        'ENGINE' :  'django.db.backends.mysql' ,
        'NAME' :  'archery' , # 数据库名称
        'USER' :  'archery' , # 数据库用户
        'PASSWORD' :  'xxxxx' , # 数据库密码
        'HOST' :  'xxx' , # 数据库HOST,如果是docker启动并且关联,可以使用                                                                                                             容器名连接
        'PORT' :  '3306' ,  # 数据库端口
        'OPTIONS' : {
            'init_command' :  "SET sql_mode='STRICT_TRANS_TABLES'" , # SQL_MODE,为                                                                                                             了兼容 select *  group by ,可以按需调整
            'charset' :  'utf8mb4'
        },
        'TEST' : {
            'NAME' :  'test_archery' ,
            'CHARSET' :  'utf8mb4' ,
        },
    }
}

Q_CLUSTER = {
    'name' :  'archery' ,
    'workers' : 4,
    'recycle' : 500,
    'timeout' : 60,
    'compress' : True,
    'cpu_affinity' : 1,
    'save_limit' : 0,
    'queue_limit' : 50,
    'label' :  'Django Q' ,
    'django_redis' :  'default' ,
    'sync' : False  # 本地调试可以修改为True,使用同步模式

}

CACHES = {
    "default" : {
        "BACKEND" :  "django_redis.cache.RedisCache" ,
        "LOCATION" :  "redis://xxx:6379/5" , # redis://host:port/db
        "OPTIONS" : {
            "CLIENT_CLASS" :  "django_redis.client.DefaultClient" ,
            "PASSWORD" :  "xxxx"

        }
    }
}

修改docker-compose.yml
路径:src/docker-compose/docker-compose.yml
redis与mysql为独立部署 
version:  '3'

services:

  goinception:
    image: hanchuanchuan/goinception
    container_name: goinception
    restart: always
    ports:
      -  "4000:4000"
    volumes:
      -  "./inception/config.toml:/etc/config.toml"

  archery:
    image: hhyo/archery:v1.10.0
    container_name: archery
    restart: always
    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:  "dockerize -wait tcp://xxxx:3306 -wait tcp://xxxx:6379 -timeout 60s /opt/archery/src/docker/startup.sh"
    env_file:
      - .env

修改config.toml
路径:src/docker-compose/inception/config.toml 调整数据库连接信息
backup_host =  "10.127.127.97"
backup_port = 3306
backup_user =  "xx"
backup_password =  "xxxx"

# 启动 
docker-compose -f docker-compose.yml up -d 
# 表结构初始化 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
# 退出容器 exit
# 日志查看和问题排查 docker logs archery -f --tail=50 访问地址: http://xx.xx.xx.xx:9123 审计oracle数据库SQL发生各种报错:
替换容器里/opt/archery/sql/engines/oracle.py文件,重新打包镜像,启动即可。
文件链接:https://pan.baidu.com/s/1000aLwbuYfAujIj1VXA6HQ?pwd=hl3y
提取码:hl3y

蛮好用的sql审核平台,点赞!!!


 

标签:opt,archery,compose,v1.10,py,django,docker
From: https://www.cnblogs.com/muzisanshi/p/18022786

相关文章

  • Docker Compose - 向远程主机部署服务
    问题描述通常,我们本地编写docker-compose.yml文件,然后运行测试。但是,我们需要在arm64环境中进行测试,无法在本地直接运行测试。我们希望可以在本地编写,然后本地使用docker-composeup直接在远程arm主机上运行测试。该笔记将介绍:在本地运行docker-compose命令,但是在远......
  • Docker-Compose简单入门使用
    Dockercompose使用DockerCompose官方文档:https://docs.docker.com/compose/一、DockerCompose安装如果安装使用DockerDesktop默认就安装了DockerCompose,dockerCompose安装参考:https://www.cnblogs.com/morang/p/devops-docker24-composev2-install.htmlhttps://blog......
  • Docker 使用遇到的问题解决 更改Tag
    dockertagconsul:1.15.4consul:latestdockerrmiconsul:1.15.4删除制定版本在运行时,有些镜像拉取时报错我这里 时 consu,只能制定版本下载1.15.4Errorresponsefromdaemon:manifestforconsul:latestnotfound:manifestunknown:manifestunknown ......
  • docker 清理无用的磁盘和镜像
    要增加Docker镜像的磁盘空间,实际上是要增加Docker存储驱动所在的磁盘空间或分区大小。以下是几种常见的方法:清理Docker系统:使用dockersystemprune命令清理无用的容器、镜像、卷和网络。使用dockerimageprune清理所有未被容器引用的镜像。迁移Docker存储目录:停止Docker......
  • docker login 私有仓库harbor 502 Bad Gateway的报错
    具体报错:Logindidnotsucceed,error:Errorresponsefromdaemon:loginattempttohttp://harbor.com/v2/failedwithstatus:502BadGateway其实harbor在网页端是可以登录的,但是dockerlogin-uadmin-p1harbor.oldboyedu.com的时候依旧是提示报错的一般这种报错......
  • Docker 安装 SqlServer 和连接
    dockerpullmcr.microsoft.com/mssql/server:2019-latest--拉取dockerrun-e"ACCEPT_EULA=Y"-e"MSSQL_SA_PASSWORD=MyName2024"-p14330:1433--namesql1--hostnamesql1-dmcr.microsoft.com/mssql/server:2019-latest--运行-d是你......
  • Docker安装Tomcat容器
    Docker安装Tomcat容器查看原文安装Tomcat#查找官方镜像dockersearchtomcat#下载最新版Tomcat镜像(其实此命令就等同于:dockerpulltomcat:latest)dockerpulltomcat#下载指定版本的Nginx镜像(xxx指具体版本号)dockerpulltomcat:xxx#检查当前所有Docker下载......
  • Docker安装Redis容器
    Docker安装Redis容器查看原文安装Redis#下载redis镜像dockerpullredis:5#检查当前所有Docker下载的镜像dockerimagesredis配置文件创建以下文件及文件夹,方便配置及管理redismkdir-p/docker/redismkdir-p/docker/redis/datatouch/docker/redis/redis.conf......
  • Docker安装MySQL容器
    Docker安装MySQL容器查看原文安装MySQL#查找官方镜像dockersearchmysql#下载mysql镜像sudodockerpullmysql:5.7#检查当前所有Docker下载的镜像dockerimages启动MySQL容器dockerrun-p3306:3306--namemysql\-v/usr/local/docker/mysql/conf:/etc/mysq......
  • Docker图形化工具
    Docker图形化工具查看原文docker图形页面管理工具常用的有三种:DockerUI、Portainer、ShipyardDockerUI是Portainer的前身,这三个工具通过dockerapi来获取管理的资源信息安装portainer镜像#查看portainer镜像dockersearchportainer#portainer镜像下载dockerpullpor......