sha256:363fe3006de27de296bfeb956f4db4d0947e9c887a6344282fce9db5d27c1db9
Last pushed
about 1 month by bhupindersingh119
Type
Compose
Manifest digest
sha256:363fe3006de27de296bfeb956f4db4d0947e9c887a6344282fce9db5d27c1db9
# Generated by docker/package.py. No source folder or .env file is needed.
name: apdd-client
services:
app:
image: "docker.io/bhupindersingh119/apdd-app:1.0.2"
ports:
- "127.0.0.1:8080:8080"
environment:
DB_HOST: db
DB_PORT: "3306"
DB_NAME: automated_phishing_detector
DB_USER: apdd
DB_PASSWORD_FILE: /run/apdd/mysql-password
SUPABASE_URL: "https://luuooupqftndcktpictb.supabase.co"
SUPABASE_PUBLISHABLE_KEY: "sb_publishable_jR6ysI_tr1Fi8okr98XmHw_dbQIdqkI"
volumes:
- backend_data:/app/backend/data
- settings:/run/apdd:ro
depends_on:
db:
condition: service_healthy
restart: unless-stopped
healthcheck:
test: ["CMD", "python", "-c", "import json, urllib.request; h=json.load(urllib.request.urlopen('http://127.0.0.1:8080/api/v1/health', timeout=10)); assert h['model']['mode']=='xgboost' and h['opensquat']['status']=='ready'"]
interval: 30s
timeout: 15s
retries: 3
start_period: 60s
db:
image: mysql:8.4
entrypoint: ["/bin/sh", "/usr/local/bin/apdd-mysql-start.sh"]
environment:
MYSQL_DATABASE: automated_phishing_detector
MYSQL_USER: apdd
MYSQL_PASSWORD_FILE: /run/apdd/mysql-password
MYSQL_ROOT_PASSWORD_FILE: /run/apdd/mysql-root-password
volumes:
- mysql_data:/var/lib/mysql
- settings:/run/apdd
configs:
- source: mysql_start
target: /usr/local/bin/apdd-mysql-start.sh
- source: schema
target: /docker-entrypoint-initdb.d/01-apdd.sql
restart: unless-stopped
healthcheck:
test: ["CMD-SHELL", "MYSQL_PWD=\"$$(cat /run/apdd/mysql-password)\" mysql --protocol=TCP -h 127.0.0.1 -uapdd automated_phishing_detector -e 'SELECT scan_id FROM scan_shap_values LIMIT 0' >/dev/null 2>&1"]
interval: 5s
timeout: 5s
retries: 30
start_period: 30s
volumes:
mysql_data:
backend_data:
settings:
# Inline configs travel with the published package, so no bind mounts are needed.
configs:
mysql_start:
content: |
#!/bin/sh
# Generate credentials once per installation; keep them outside container images.
set -eu
umask 077
mkdir -p /run/apdd
if [ ! -s /run/apdd/mysql-password ]; then
openssl rand -hex 32 > /run/apdd/mysql-password
fi
if [ ! -s /run/apdd/mysql-root-password ]; then
openssl rand -hex 32 > /run/apdd/mysql-root-password
fi
# The app runs as UID 10001 and receives this volume read-only.
chown 10001:10001 /run/apdd/mysql-password
chmod 400 /run/apdd/mysql-password /run/apdd/mysql-root-password
exec /usr/local/bin/docker-entrypoint.sh mysqld
schema:
content: |
-- ================================================
-- IT7510 CAPSTONE PROJECT
-- Automated Phishing Domain Detector
-- Week 7 - Database Development
-- ================================================
-- 1st Step: Create the project database
CREATE DATABASE IF NOT EXISTS automated_phishing_detector;
-- 2nd Step: Using the database in which we want tables
USE automated_phishing_detector;
-- 3rd Step: Creating the app_users table in the MySQL
CREATE TABLE IF NOT EXISTS app_users (
-- creates a automatic user number
user_id INT AUTO_INCREMENT PRIMARY KEY,
-- THE Supabase user ID
supabase_user_id CHAR(36) NOT NULL UNIQUE,
-- Date and time that user was added
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
);
-- Step 4: Creating the domains table
CREATE TABLE IF NOT EXISTS domains (
-- Automatic domain number in the table
domain_id INT AUTO_INCREMENT PRIMARY KEY,
-- Store the domain name
domain_name VARCHAR(253) NOT NULL UNIQUE,
-- Date and Time the domain was added
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
);
-- 5th Step: Creating the scan_results table
CREATE TABLE IF NOT EXISTS scan_results (
-- Automatic scan the number
scan_id INT AUTO_INCREMENT PRIMARY KEY,
-- User who made the scan
user_id INT NULL,
-- The domain that was scanned
domain_id INT NOT NULL,
-- THE Date and Time of the scan
scan_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
-- storing the prediction result
prediction_result VARCHAR(25) NOT NULL,
-- Store the risk score
risk_score DECIMAL(5,2) NOT NULL,
-- Analyst review information
review_status VARCHAR(20) NOT NULL DEFAULT 'Pending',
analyst_decision VARCHAR(30) NULL,
analyst_note TEXT NULL,
reviewed_at TIMESTAMP NULL DEFAULT NULL,
-- CONNECT the scan to the app_users
FOREIGN KEY (user_id)
REFERENCES app_users(user_id),
-- Connect the scan to the domains
FOREIGN KEY (domain_id)
REFERENCES domains(domain_id)
);
-- Checking the tables that are created now
SHOW TABLES;
-- ==================================================
-- WEEK 8 DATABASE DEVELOPMENT --
-- ==================================================
-- Creating the domain_features table now
CREATE TABLE IF NOT EXISTS domain_features (
feature_id INT NOT NULL AUTO_INCREMENT,
scan_id INT NOT NULL,
domain_age INT NULL,
registration_period INT NULL,
domain_length INT NOT NULL,
hyphen_count INT NOT NULL,
digit_count INT NOT NULL,
shannon_entropy DECIMAL(8,5) NOT NULL,
brand_keyword_detection TINYINT NOT NULL,
typosquatting_similarity DECIMAL (5,4) NOT NULL,
ssl_certificate_age INT NULL,
tld VARCHAR(63) NOT NULL,
PRIMARY KEY (feature_id),
UNIQUE KEY uq_domain_features_scan_id (scan_id),
CONSTRAINT fk_domain_features_scan
FOREIGN KEY (scan_id)
REFERENCES scan_results(scan_id)
);
-- Creating the new table model_outputs table
CREATE TABLE IF NOT EXISTS model_outputs (
output_id INT NOT NULL AUTO_INCREMENT,
scan_id INT NOT NULL,
model_name VARCHAR(50) NOT NULL,
confidence_score DECIMAL(5,4) NOT NULL,
explanation TEXT NULL,
PRIMARY KEY (output_id),
CONSTRAINT fk_model_outputs_scan
FOREIGN KEY (scan_id)
REFERENCES scan_results(scan_id)
);
-- Selecting the project database
USE automated_phishing_detector;
-- Checking that the all 5 project tables are available
SHOW TABLES;
-- ==================================================
-- WEEK 15 DATABASE DEVELOPMENT
-- Creating the new table for the SHAP explanations
-- ==================================================
-- Store SHAP values for each scan in a new table without changing the existing five tables.
CREATE TABLE IF NOT EXISTS scan_shap_values (
scan_id INT NOT NULL PRIMARY KEY,
shap_values JSON NOT NULL,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT fk_scan_shap_values_scan
FOREIGN KEY (scan_id)
REFERENCES scan_results(scan_id)
ON DELETE CASCADE
);
-- Verify that all the 6 project tables are available
SHOW TABLES;
services:
app:
image: docker.io/bhupindersingh119/apdd-app:1.0.2@sha256:533c7dffd56aedd1d0b962c3bb4e51ae371d4222b0ade2dac44c070b5753ef5a
db:
image: docker.io/library/mysql:8.4@sha256:0f51e63e537a1f176423fa03ef559aabe6fa4372a53160a44bc7e75da7d15364
docker compose -f oci://bhupindersingh119/apdd:1.0.2 upUse the above command to pull and run the Compose file. Learn more.
MySQL is a widely used, open-source relational database management system (RDBMS).
Pulls
1B+
Stars
16200
Last Updated
3 days