This guide will help you deploy the GhostSec platform on any server with Docker installed.
- A server with Docker and Docker Compose installed
- A domain name pointing to your server's IP address
- Basic knowledge of terminal/command line
- At least 2GB of RAM on your server
- Clone the repository:
git clone https://github.com/YourUsername/GhostSec.git
cd GhostSec
- Create and configure environment variables:
cp .env.example .env
Edit the .env
file with your settings:
- Generate a new Django secret key
- Set your domain name
- Configure database credentials
- Set up email settings
- Add your email for Let's Encrypt certificates
- Build and start the containers:
docker-compose up -d --build
- Create a superuser:
docker-compose exec web python manage.py createsuperuser
- Visit your domain (https://yourdomain.com) and log in!
- Point your domain to your server's IP address using an A record
- Make sure ports 80 and 443 are open on your server
- Update the DOMAIN and ACME_EMAIL variables in your .env file
The database will be automatically initialized when you first run the containers. Your data will persist in a Docker volume.
To backup your database:
docker-compose exec db pg_dump -U ghostsec ghostsec > backup.sql
To restore from backup:
docker-compose exec -T db psql -U ghostsec ghostsec < backup.sql
-
For Gmail:
- Enable 2-factor authentication
- Generate an App Password
- Use the App Password in your .env file
-
For other providers:
- Update EMAIL_HOST and EMAIL_PORT accordingly
- Use appropriate credentials
Traefik will automatically obtain and renew SSL certificates from Let's Encrypt.
- Change default passwords in .env file
- Keep your system and Docker up to date
- Regularly backup your data
- Monitor your logs for suspicious activity
- Pull the latest changes:
git pull origin main
- Rebuild and restart containers:
docker-compose down
docker-compose up -d --build
View logs:
# All services
docker-compose logs -f
# Specific service
docker-compose logs -f web
-
If the site is not accessible:
- Check if containers are running:
docker-compose ps
- Check logs:
docker-compose logs
- Verify domain DNS settings
- Check if containers are running:
-
If SSL certificates are not working:
- Verify your domain points to the server
- Check Traefik logs:
docker-compose logs traefik
-
Database connection issues:
- Verify database credentials in .env
- Check if database container is running
- Check database logs:
docker-compose logs db
To share your GhostSec instance with friends:
- Ensure your server has enough resources for multiple users
- Share your domain name with them
- Create accounts for them through the admin interface
- Consider setting up monitoring for resource usage
Minimum recommended specifications:
- 2 CPU cores
- 4GB RAM
- 20GB storage
- 10Mbps network connection
For issues and support:
- Check the logs using
docker-compose logs
- Review the troubleshooting section
- Create an issue on the GitHub repository
- Database:
# Backup
docker-compose exec db pg_dump -U ghostsec ghostsec > backup_$(date +%Y%m%d).sql
# Restore
docker-compose exec -T db psql -U ghostsec ghostsec < backup_20230101.sql
- Media files:
# Backup
docker cp $(docker-compose ps -q web):/app/media ./media_backup
# Restore
docker cp ./media_backup/. $(docker-compose ps -q web):/app/media/
- Automated backup script (create as backup.sh):
#!/bin/bash
BACKUP_DIR="/path/to/backups"
DATE=$(date +%Y%m%d)
# Backup database
docker-compose exec -T db pg_dump -U ghostsec ghostsec > $BACKUP_DIR/db_$DATE.sql
# Backup media files
docker cp $(docker-compose ps -q web):/app/media $BACKUP_DIR/media_$DATE
# Keep only last 7 days of backups
find $BACKUP_DIR -name "db_*" -mtime +7 -delete
find $BACKUP_DIR -name "media_*" -mtime +7 -delete
Make it executable:
chmod +x backup.sh
Add to crontab to run daily:
0 0 * * * /path/to/backup.sh