Prerequisites Required: Docker experience and familiarity with domains and web hosting is highly recommended. Proceed only if you understand containerization concepts.
Prerequisites
Before starting, ensure you have:- Docker and Docker Compose installed on your system
- Basic knowledge of Docker containers and networking
- Completed the MongoDB setup and webhook creation
- Ubuntu/Debian
- CentOS/RHEL
- macOS
- Windows
Quick Start Deployment
1
Clone the Repository
First, clone the Spoo.me repository to your local machine:
This downloads the complete Spoo.me source code and Docker configuration files.
2
Prepare Environment Configuration
Copy the example environment file and configure it:Fill in your environment variables:
Never commit your
.env
file to version control. It contains sensitive credentials.3
Build and Start Containers
Use Docker Compose to build and start all services:This command will:
- Build the Spoo.me application container
- Pull necessary base images
- Start all services defined in
docker-compose.yml
- Show logs from all containers
The first build may take 5-10 minutes depending on your internet connection and system performance.
4
Access Your Deployment
Once the containers are running, access your Spoo.me instance:
- Local access: http://localhost:8000
- Network access: http://your-server-ip:8000
Test URL shortening functionality to verify the deployment is working correctly.
Advanced Configuration
Using Internal MongoDB
For complete containerization, you can use MongoDB as a Docker container:1
Enable MongoDB Container
Edit your
docker-compose.yml
to include a MongoDB service:2
Update Environment Variables
In your
.env
file, update the MongoDB URI:3
Deploy with Internal MongoDB
Internal MongoDB is perfect for development but consider using MongoDB Atlas for production deployments.
Production Configuration
For production deployments, consider these additional configurations:1
Configure Reverse Proxy
Set up Nginx as a reverse proxy for better performance and SSL:Create
nginx.conf
:2
Add SSL Certificates
For HTTPS support, add SSL certificates:Update
nginx.conf
for HTTPS:3
Configure Persistent Storage
Ensure data persistence with proper volume configuration:Create the directories:
Management Commands
Container Management
- Start/Stop Services
- Logs and Monitoring
- Updates and Maintenance
Database Management
MongoDB Backup
MongoDB Backup
Database Access
Database Access
Scaling and Performance
Horizontal Scaling
For high-traffic deployments, scale your application:Load Balancing Configuration
Createnginx-lb.conf
for load balancing:
Security Considerations
Follow these security best practices for production deployments:
- Environment Variables: Use Docker secrets for sensitive data in production
- Network Security: Configure proper firewall rules and network isolation
- Regular Updates: Keep Docker images and base systems updated
- Access Control: Limit container privileges and use non-root users
- SSL/TLS: Always use HTTPS in production environments
- Monitoring: Set up logging and monitoring for security events
Troubleshooting
Container Build Failures
Container Build Failures
Common Issues:
- Missing environment variables
- Network connectivity problems
- Insufficient disk space
- Docker daemon not running
Database Connection Issues
Database Connection Issues
Symptoms: Application starts but can’t connect to MongoDBSolutions:
- Verify MongoDB container is running:
docker-compose ps
- Check network connectivity:
docker-compose exec app ping mongo
- Validate connection string in
.env
file - Review MongoDB container logs:
docker-compose logs mongo
Port Conflicts
Port Conflicts
Symptoms: Cannot bind to port 8000 or other configured portsSolutions:
Performance Issues
Performance Issues
Symptoms: Slow response times or high resource usageSolutions:
- Monitor resource usage:
docker stats
- Increase container resources in
docker-compose.yml
- Optimize MongoDB queries and indexes
- Implement caching with Redis
- Scale horizontally with multiple app containers