-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy_docker.sh
More file actions
executable file
·118 lines (104 loc) · 3.52 KB
/
Copy pathdeploy_docker.sh
File metadata and controls
executable file
·118 lines (104 loc) · 3.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
#!/bin/bash
# Docker Deployment Script for Infosec News Reader
set -e
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
echo -e "${BLUE}================================${NC}"
echo -e "${BLUE} Docker Deployment Script${NC}"
echo -e "${BLUE}================================${NC}"
# Check if Docker is installed
if ! command -v docker &> /dev/null; then
echo -e "${RED}Error: Docker is not installed${NC}"
echo -e "${YELLOW}Please install Docker first:${NC}"
echo -e " Ubuntu/Debian: curl -fsSL https://get.docker.com | sh"
echo -e " Rocky Linux: yum install -y docker"
exit 1
fi
# Check if Docker Compose is installed
if ! command -v docker-compose &> /dev/null; then
echo -e "${RED}Error: Docker Compose is not installed${NC}"
echo -e "${YELLOW}Please install Docker Compose first:${NC}"
echo -e " curl -L \"https://github.com/docker/compose/releases/download/v2.20.0/docker-compose-$(uname -s)-$(uname -m)\" -o /usr/local/bin/docker-compose"
echo -e " chmod +x /usr/local/bin/docker-compose"
exit 1
fi
# Create necessary directories
echo -e "${BLUE}Creating directories...${NC}"
mkdir -p data logs ssl
# Create environment file if it doesn't exist
if [ ! -f .env ]; then
echo -e "${BLUE}Creating .env file...${NC}"
cat > .env << EOF
# Infosec News Reader Environment Variables
FLASK_SECRET_KEY=$(openssl rand -hex 32)
OPENAI_API_KEY=
EOF
echo -e "${GREEN}Created .env file${NC}"
fi
# Create environment.json if it doesn't exist
if [ ! -f environment.json ]; then
echo -e "${BLUE}Creating default environment.json...${NC}"
cat > environment.json << EOF
{
"organization": {
"name": "Your Organization",
"industry": "Technology",
"size": "Medium",
"compliance_requirements": ["GDPR", "HIPAA", "SOX"]
},
"operating_systems": {
"endpoints": [],
"servers": [],
"mobile": []
},
"applications": [],
"network_devices": [],
"cloud_services": [],
"email_system": {},
"databases": [],
"security_tools": [],
"critical_assets": [],
"network_segments": []
}
EOF
echo -e "${GREEN}Created default environment.json${NC}"
fi
# Build and start services
echo -e "${BLUE}Building and starting services...${NC}"
docker-compose up -d --build
# Wait for services to be ready
echo -e "${BLUE}Waiting for services to be ready...${NC}"
sleep 30
# Check service status
echo -e "${BLUE}Checking service status...${NC}"
docker-compose ps
# Test the application
echo -e "${BLUE}Testing application...${NC}"
if curl -f http://localhost/ > /dev/null 2>&1; then
echo -e "${GREEN}Application is running successfully!${NC}"
else
echo -e "${YELLOW}Application might still be starting up...${NC}"
echo -e "${YELLOW}Check logs with: docker-compose logs -f${NC}"
fi
echo -e "${GREEN}================================${NC}"
echo -e "${GREEN} Deployment Complete!${NC}"
echo -e "${GREEN}================================${NC}"
echo ""
echo -e "${BLUE}Access your application at:${NC}"
echo -e " http://$(hostname -I | awk '{print $1}')"
echo ""
echo -e "${BLUE}Useful commands:${NC}"
echo -e " View logs: docker-compose logs -f"
echo -e " Stop services: docker-compose down"
echo -e " Restart services: docker-compose restart"
echo -e " Update application: docker-compose up -d --build"
echo ""
echo -e "${BLUE}Next steps:${NC}"
echo -e "1. Configure your environment at /environment"
echo -e "2. Set up your OpenAI API key in .env file"
echo -e "3. Customize RSS feeds in config.py"
echo -e "4. Set up SSL/TLS for production use"