Previous version was misleading about e2e tests: - Said "read e2e files" but didn't explain how to RUN them - Didn't mention that e2e tests DO run in Docker (Dockerfile line 55) - Didn't show how to run e2e tests locally - Didn't clarify that e2e tests show failures in CI even if non-blocking Now provides 3 clear options: Option A (preferred): Run full Docker build - Runs both unit and e2e tests - Matches CI environment exactly Option B: Local testing with e2e - Shows how to start the app (npm run dev) - Shows how to run e2e tests in separate terminal - Requires Playwright browser installation Option C: Minimum verification (fallback) - Run unit tests (required) - Run build (required) - Manually verify changes match e2e expectations - Lists specific things to check (button text, labels, etc.) This makes it clear that you cannot just "read" e2e files and call it done. You must either RUN the e2e tests or very carefully manually verify. https://claude.ai/code/session_01T57NPQfoRb2fS7ihdWkTxq
Docker Swarm Container Terminal WebUI
A modern, secure web interface for managing Docker containers with interactive terminal access.
Features
- 🔐 Secure Authentication - Username/password authentication to protect container access
- 📦 Container Management - View all active containers with real-time status updates
- 💻 Interactive Terminal - Execute commands directly in running containers
- 🎨 Modern UI - Built with Material UI and Next.js for a polished experience
- 🐳 Docker Native - Direct integration with Docker API
- 📱 Responsive Design - Works seamlessly on desktop and mobile devices
Tech Stack
Frontend
- Next.js 14+ - React framework with App Router
- Material UI (MUI) - Modern component library
- TypeScript - Type-safe development
- Tailwind CSS - Utility-first styling
Backend
- Flask - Python web framework
- Docker SDK - Python Docker integration
- Flask-CORS - Cross-origin resource sharing
Deployment
- Docker - Containerized deployment
- Docker Compose - Multi-container orchestration
- CapRover - Docker Swarm deployment platform
- GHCR - GitHub Container Registry for images
Quick Start
Using CapRover (Recommended for Production)
Pre-built deployment packages are available in Releases:
-
Download the latest release packages:
backend-caprover-{version}.tar(uncompressed - required by CapRover)frontend-caprover-{version}.tar(uncompressed - required by CapRover)
-
Deploy to CapRover:
- Upload backend
.tarfile to your CapRover backend app - Upload frontend
.tarfile to your CapRover frontend app
- Upload backend
For detailed instructions, see:
- QUICKSTART.md - Fast deployment guide
- CAPROVER_DEPLOYMENT.md - Complete CapRover setup guide
Using Docker Compose (Local Development)
- Clone the repository:
git clone https://github.com/johndoe6345789/docker-swarm-termina.git
cd docker-swarm-termina
- Start the application:
docker-compose up -d
- Access the application:
- Frontend: http://localhost:3000
- Backend API: http://localhost:5000
- Login with default credentials:
- Username:
admin - Password:
admin123
Manual Setup
Backend Setup
- Navigate to the backend directory:
cd backend
- Install Python dependencies:
pip install -r requirements.txt
- Create
.envfile (optional):
cp .env.example .env
# Edit .env to set custom credentials
- Run the Flask application:
python app.py
The backend will be available at http://localhost:5000
Frontend Setup
- Navigate to the frontend directory:
cd frontend
- Install Node.js dependencies:
npm install
- Create
.env.localfile:
cp .env.local.example .env.local
# Edit if backend is running on a different URL
- Run the development server:
npm run dev
The frontend will be available at http://localhost:3000
Configuration
Backend Environment Variables
ADMIN_USERNAME- Admin username (default:admin)ADMIN_PASSWORD- Admin password (default:admin123)FLASK_ENV- Flask environment (default:development)
Frontend Environment Variables
NEXT_PUBLIC_API_URL- Backend API URL (default:http://localhost:5000)
API Endpoints
Authentication
POST /api/auth/login- Authenticate userPOST /api/auth/logout- Logout user
Containers
GET /api/containers- List all containersPOST /api/containers/<id>/exec- Execute command in container
Health
GET /api/health- Health check endpoint
Deployment Options
CapRover (Docker Swarm)
Production-ready deployment packages are automatically built and published to GitHub Releases.
- Quick Deploy: Upload pre-built tar files to CapRover
- Documentation: See CAPROVER_DEPLOYMENT.md
- Includes: Enhanced Docker socket debugging and diagnostics
Docker Images (GHCR)
Images are automatically built and pushed to GitHub Container Registry:
- Backend:
ghcr.io/johndoe6345789/docker-swarm-termina-backend - Frontend:
ghcr.io/johndoe6345789/docker-swarm-termina-frontend
Security Considerations
⚠️ Important Security Notes:
- Change Default Credentials - Always change the default admin credentials in production
- Docker Socket Access - The backend requires access to Docker socket (
/var/run/docker.sock) - Network Security - Use proper firewall rules and network isolation
- HTTPS - Use HTTPS in production (reverse proxy recommended)
- Session Management - Current implementation uses simple token-based auth; consider implementing JWT or OAuth for production
Development
Project Structure
.
├── backend/ # Flask backend
│ ├── app.py # Main Flask application
│ ├── requirements.txt # Python dependencies
│ └── Dockerfile # Backend Docker image
├── frontend/ # Next.js frontend
│ ├── app/ # Next.js app directory
│ ├── components/ # React components
│ ├── lib/ # Utility functions and API client
│ └── Dockerfile # Frontend Docker image
├── docker-compose.yml # Docker Compose configuration
└── .github/
└── workflows/
└── docker-publish.yml # GHCR publishing workflow
Building for Production
Build Docker Images
docker-compose build
Push to GHCR
Images are automatically pushed when code is merged to main. To manually push:
docker tag docker-swarm-termina-backend ghcr.io/johndoe6345789/docker-swarm-termina-backend:latest
docker tag docker-swarm-termina-frontend ghcr.io/johndoe6345789/docker-swarm-termina-frontend:latest
docker push ghcr.io/johndoe6345789/docker-swarm-termina-backend:latest
docker push ghcr.io/johndoe6345789/docker-swarm-termina-frontend:latest
License
MIT License - see LICENSE file for details
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Support
For issues, questions, or contributions, please open an issue on GitHub.