Skip to content

Commit

Permalink
Merge pull request #29 from Honeybrain/S2/refacto
Browse files Browse the repository at this point in the history
🏗️ Change architecture
  • Loading branch information
valentinbreiz authored Aug 22, 2023
2 parents 473483d + 9fabb67 commit b67c8b6
Show file tree
Hide file tree
Showing 26 changed files with 111 additions and 230 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/modules-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
echo -n "$DOCKER_PASSWORD" | docker --config $DOCKER_CONFIG login --username $DOCKER_USER --password-stdin
- name: Build the FTP image
run: |
cd modules/ftp
cd docker/modules/ftp
docker build -t $DOCKER_USER/hb_modules_ftp .
- name: Push the FTP image
run: |
Expand All @@ -37,7 +37,7 @@ jobs:
echo -n "$DOCKER_PASSWORD" | docker --config $DOCKER_CONFIG login --username $DOCKER_USER --password-stdin
- name: Build the Dummy PC image
run: |
cd modules/dummy_pc
cd docker/modules/dummy_pc
docker build -t $DOCKER_USER/hb_modules_pc .
- name: Push the Dummy PC image
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/update-vps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ jobs:
port: ${{ secrets.VPS_PORT }}
script: |
cd /home/honeybrain/Honeybrain/Honeypot
./auto_update_vps.sh > /home/honeybrain/Honeybrain/update.log
./scripts/auto_update_vps.sh > /home/honeybrain/Honeybrain/update.log
37 changes: 8 additions & 29 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@ FRONTEND_DIR = ../Frontend
INSTALLER_DIR = ../Installer

PROTO_DIR = protos
DOCKER_COMPOSE_FILE = docker-compose-dev.yml
DOCKER_COMPOSE_PROD_FILE = docker-compose-prod.yml
DOCKER_COMPOSE_FILE = ./docker/compose/docker-compose.yml
DOCKER_COMPOSE_IPS_FILE = ./docker/compose/docker-compose-ips.yml
ROOT = .

.PHONY: grpc backend-grpc frontend-grpc installer-grpc run check-setup build stop logs

check-setup:
@echo "🚀 Checking setup..."
@bash scripts/check-setup.sh $(BACKEND_DIR) $(FRONTEND_DIR) $(INSTALLER_DIR)
@bash scripts/check_setup.sh $(BACKEND_DIR) $(FRONTEND_DIR) $(INSTALLER_DIR)
@echo "✅ Setup is okay!"

grpc: check-setup backend-grpc frontend-grpc installer-grpc
Expand All @@ -32,38 +33,16 @@ installer-grpc:

run:
@echo "🚀 Starting Docker services in detached mode..."
docker compose -f $(DOCKER_COMPOSE_FILE) up -d
@bash scripts/start_honeybrain.sh $(DOCKER_COMPOSE_FILE) $(DOCKER_COMPOSE_IPS_FILE)
@echo "✅ Docker services started successfully!"

build: grpc
@echo "🚀 Starting Docker services with build..."
docker compose -f $(DOCKER_COMPOSE_FILE) build
@bash scripts/build_honeybrain.sh $(DOCKER_COMPOSE_FILE) $(DOCKER_COMPOSE_IPS_FILE)
@echo "✅ Docker images built successfully!"

stop:
@echo "🚀 Stopping Docker services..."
docker compose -f $(DOCKER_COMPOSE_FILE) down
@bash scripts/stop_honeybrain.sh $(DOCKER_COMPOSE_FILE) $(DOCKER_COMPOSE_IPS_FILE)
@echo "✅ Docker services stopped successfully!"

logs:
@echo "📜 Following Docker service logs..."
docker compose -f $(DOCKER_COMPOSE_FILE) logs -f

run-prod:
@echo "🚀 Starting Docker services in detached mode..."
docker compose -f $(DOCKER_COMPOSE_PROD_FILE) up -d
@echo "✅ Docker services started successfully!"

build-prod: check-setup grpc
@echo "🚀 Starting Docker services with build..."
docker compose -f $(DOCKER_COMPOSE_PROD_FILE) build
@echo "✅ Docker images built successfully!"

stop-prod:
@echo "🚀 Stopping Docker services..."
docker compose -f $(DOCKER_COMPOSE_PROD_FILE) down
@echo "✅ Docker services stopped successfully!"

logs-prod:
@echo "📜 Following Docker service logs..."
docker compose -f $(DOCKER_COMPOSE_PROD_FILE) logs -f

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
144 changes: 0 additions & 144 deletions docker-compose-prod.yml

This file was deleted.

37 changes: 37 additions & 0 deletions docker/compose/docker-compose-ips.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
version: "3"
services:
fail2ban:
build:
context: ../dockerfile/fail2ban
container_name: fail2ban
restart: "unless-stopped"
network_mode: host
cap_add:
- NET_ADMIN
- NET_RAW
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- "../../logs/suricata/fast.log:/var/log/suricata.log"
- "../../logs/fail2ban:/var/log/fail2ban"
- "../../config/fail2ban:/data"
- "/var/lib/docker/containers/:/container-logs/:ro"
- "../../config/nginx/block.conf:/etc/nginx/block.conf"
- "../../config/nginx/nginx.conf:/etc/nginx/nginx.conf"
env_file:
- "../../config/fail2ban/fail2ban.env"
depends_on:
- suricata

suricata:
image: jasonish/suricata:latest
container_name: suricata
network_mode: host
cap_add:
- NET_ADMIN
- NET_RAW
- SYS_NICE
volumes:
- "../../logs/suricata/fast.log:/var/log/suricata/fast.log"
- "../../config/suricata/suricata.yaml:/etc/suricata/suricata.yaml"
- "../../config/suricata/suricata.rules:/var/lib/suricata/rules/suricata.rules"
command: -i ${NETWORK_INTERFACE:-null}
Loading

0 comments on commit b67c8b6

Please sign in to comment.