archery-在rockylinux8上用docker部署sql审计平台
1.安装docker[rootarchery ~]# rpm -qa | grep podman[rootarchery ~]# rpm -q podmanpackage podman is not installed[rootarchery ~]# dnf install -y yum-utils device-mapper-persistent-data lvm2[rootarchery ~]# yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repoAdding repo from: https://download.docker.com/linux/centos/docker-ce.repo[rootarchery ~]# yum -y install docker-ce docker-ce-cli containerd.ioInstalled:container-selinux-2:2.229.0-2.moduleel8.10.01896b18fa106.noarch containerd.io-1.6.32-3.1.el8.x86_64docker-buildx-plugin-0.14.0-1.el8.x86_64 docker-ce-3:26.1.3-1.el8.x86_64docker-ce-cli-1:26.1.3-1.el8.x86_64 docker-ce-rootless-extras-26.1.3-1.el8.x86_64docker-compose-plugin-2.27.0-1.el8.x86_64 fuse-overlayfs-1.13-1.moduleel8.10.01896b18fa106.x86_64fuse3-3.3.0-19.el8.x86_64 fuse3-libs-3.3.0-19.el8.x86_64libcgroup-0.41-19.el8.x86_64 libslirp-4.4.0-2.moduleel8.10.01896b18fa106.x86_64slirp4netns-1.2.3-1.moduleel8.10.01896b18fa106.x86_64Complete![rootarchery ~]# systemctl enable dockerCreated symlink /etc/systemd/system/multi-user.target.wants/docker.service → /usr/lib/systemd/system/docker.service.[rootarchery ~]# systemctl start docker[rootarchery ~]# docker -vDocker version 26.1.3, build b72abbb[rootarchery ~]# vim /etc/docker/daemon.json{builder: {gc: {defaultKeepStorage: 20GB,enabled: true}},experimental: false,features: {buildkit: true},live-restore: true,registry-mirrors: [https://docker.211678.top,https://docker.1panel.live,https://hub.rat.dev,https://docker.m.daocloud.io,https://do.nark.eu.org,https://dockerpull.com,https://dockerproxy.cn,https://docker.awsl9527.cn/]}[rootarchery ~]# systemctl daemon-reload systemctl restart docker2.部署docker-compose源码安装[rootarchery ~]# curl -L https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose[rootarchery ~]# chmod x /usr/local/bin/docker-compose[rootarchery ~]# ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose[rootarchery ~]# docker-compose --versionDocker Compose version v2.33.13.部署archery[rootarchery ~]# curl https://codeload.github.com/hhyo/Archery/tar.gz/refs/tags/v1.11.3 -o Archery-1.11.3.tar.gz[rootarchery ~]# ll-rw-r--r-- 1 root root 11403081 Feb 27 18:05 Archery-1.11.3.tar.gz[rootarchery ~]# tar -zxvf Archery-1.11.3.tar.gz[rootarchery ~]# cd Archery-1.11.3/src/docker-compose/[rootarchery ~/Archery-1.11.3/src/docker-compose]# vim docker-compose.ymlversion: 3services:redis:image: redis:5container_name: redisrestart: alwayscommand: redis-server --requirepass P88w0rdexpose:- 6379healthcheck:test: [ CMD, redis-cli, ping ]interval: 5stimeout: 5sretries: 5mysql:image: mysql:5.7container_name: mysqlrestart: alwaysports:- 3306:3306volumes:- ./mysql/my.cnf:/etc/mysql/my.cnf- ./mysql/datadir:/var/lib/mysqlenvironment:MYSQL_DATABASE: archeryMYSQL_ROOT_PASSWORD: P88w0rdhealthcheck:test: [CMD, mysqladmin, ping][rootarchery ~/Archery-1.11.3/src/docker-compose]# docker-compose up -dWARN[0000] /root/Archery-1.11.3/src/docker-compose/docker-compose.yml: the attribute version is obsolete, it will be ignored, please remove it to avoid potential confusion[] Running 5/5✔ Network docker-compose_default Created 0.3s✔ Container mysql Healthy 7.2s✔ Container goinception Started 2.4s✔ Container redis Healthy 7.7s✔ Container archery Started 8.3s[] Running 6/6✔ Network docker-compose_default Created 0.5s✔ Container inception Started 35.6s✔ Container goinception Started 35.1s✔ Container archery Started 35.8s✔ Container redis Started 34.1s✔ Container mysql Started 35.3s然后开始初始化该项目的数据库表#表结构初始化[rootarchery ~/Archery-1.11.3/src/docker-compose]# docker exec -ti archery /bin/bashroot0f266b96e188:/opt# cd /opt/archeryroot0f266b96e188:/opt/archery# source /opt/venv4archery/bin/activate(venv4archery) root0f266b96e188:/opt/archery# python3 manage.py makemigrations sql2025-02-28 08:26:33,920 - environ.environ - INFO - /opt/archery/.env not found - if youre not configuring your environment separately, check this.Migrations for sql:sql/migrations/0001_initial.py- Create model SlowQuery- Create model SlowQueryHistory- Create model ArchiveConfig- Create model AuditEntry- Create model CloudAccessKey- Create model Config- Create model DataMaskingRules- Create model Instance- Create model InstanceTag- Create model Permission- Create model QueryLog- Create model ResourceGroup- Create model SqlWorkflow- Create model Tunnel- Create model WorkflowAuditDetail- Create model WorkflowLog- Create model WorkflowAuditSetting- Create model WorkflowAudit- Create model SqlWorkflowContent- Create model QueryPrivilegesApply- Create model ParamTemplate- Create model ParamHistory- Add field instance_tag to instance- Add field resource_group to instance- Add field tunnel to instance- Create model DataMaskingColumns- Create model ArchiveLog- Add field dest_instance to archiveconfig- Add field resource_group to archiveconfig- Add field src_instance to archiveconfig- Create model AliyunRdsConfig- Create model Users- Create model TwoFactorAuthConfig- Create model QueryPrivileges- Create model InstanceDatabase- Create model InstanceAccount(venv4archery) root0f266b96e188:/opt/archery# python3 manage.py migrate2025-02-28 08:26:48,483 - environ.environ - INFO - /opt/archery/.env not found - if youre not configuring your environment separately, check this.Operations to perform:Apply all migrations: admin, auth, contenttypes, django_q, sessions, sqlRunning migrations:Applying contenttypes.0001_initial... OKApplying contenttypes.0002_remove_content_type_name... OKApplying auth.0001_initial... OKApplying auth.0002_alter_permission_name_max_length... OKApplying auth.0003_alter_user_email_max_length... OKApplying auth.0004_alter_user_username_opts... OKApplying auth.0005_alter_user_last_login_null... OKApplying auth.0006_require_contenttypes_0002... OKApplying auth.0007_alter_validators_add_error_messages... OKApplying auth.0008_alter_user_username_max_length... OKApplying auth.0009_alter_user_last_name_max_length... OKApplying auth.0010_alter_group_name_max_length... OKApplying auth.0011_update_proxy_permissions... OKApplying auth.0012_alter_user_first_name_max_length... OKApplying sql.0001_initial... OKApplying admin.0001_initial... OKApplying admin.0002_logentry_remove_auto_add... OKApplying admin.0003_logentry_add_action_flag_choices... OKApplying django_q.0001_initial... OKApplying django_q.0002_auto_20150630_1624... OKApplying django_q.0003_auto_20150708_1326... OKApplying django_q.0004_auto_20150710_1043... OKApplying django_q.0005_auto_20150718_1506... OKApplying django_q.0006_auto_20150805_1817... OKApplying django_q.0007_ormq... OKApplying django_q.0008_auto_20160224_1026... OKApplying django_q.0009_auto_20171009_0915... OKApplying django_q.0010_auto_20200610_0856... OKApplying django_q.0011_auto_20200628_1055... OKApplying django_q.0012_auto_20200702_1608... OKApplying django_q.0013_task_attempt_count... OKApplying django_q.0014_schedule_cluster... OKApplying sessions.0001_initial... OK数据初始化(venv4archery) root0f266b96e188:/opt/archery# python3 manage.py dbshell2025-02-28 08:30:11,356 - environ.environ - INFO - /opt/archery/.env not found - if youre not configuring your environment separately, check this.(venv4archery) root0f266b96e188:/opt/archery# python3 manage.py dbshell2025-02-28 08:30:25,619 - environ.environ - INFO - /opt/archery/.env not found - if youre not configuring your environment separately, check this.创建管理用户(venv4archery) root0f266b96e188:/opt/archery# python3 manage.py createsuperuser2025-02-28 08:37:18,652 - environ.environ - INFO - /opt/archery/.env not found - if youre not configuring your environment separately, check this.用户名: admin电子邮件地址: admin126.comPassword:Password (again):密码跟 电子邮件地址 太相似了。Bypass password validation and create user anyway? [y/N]: ySuperuser created successfully.(venv4archery) root0f266b96e188:/opt/archery# exitexit[rootarchery ~/Archery-1.11.3/src/docker-compose]# docker restart archeryarchery[rootarchery ~/Archery-1.11.3/src/docker-compose]# docker psCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES0f266b96e188 hhyo/archery:v1.11.3 bash /opt/archery/s… 22 minutes ago Up 23 seconds 0.0.0.0:9123-9123/tcp, :::9123-9123/tcp archery57fc84185a87 redis:5 docker-entrypoint.s… 22 minutes ago Up 22 minutes (healthy) 6379/tcp redisda7fde2aa3ba hanchuanchuan/goinception /usr/local/bin/dumb… 22 minutes ago Up 22 minutes 0.0.0.0:4000-4000/tcp, :::4000-4000/tcp goinception3fe992b10f6d mysql:5.7 docker-entrypoint.s… 22 minutes ago Up 22 minutes (healthy) 0.0.0.0:3306-3306/tcp, :::3306-3306/tcp, 33060/tcp mysql然后浏览器访问 http://10.9.254.235:9123/ admin P88w0rd
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/2424267.html
如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!