littleshop/DEPLOY.md
2025-11-20 16:22:54 +00:00

4.5 KiB

TeleShop & TeleBot Docker Deployment Guide

Prerequisites

  • Docker installed on your local machine or build server
  • Network access to the Docker registry at 10.8.0.1:5000
  • Git repository cloned locally

Quick Deployment

# Make script executable (if not already)
chmod +x deploy-to-registry.sh

# Run the deployment
./deploy-to-registry.sh

The script will:

  1. Test registry connectivity
  2. 📦 Build both TeleShop and TeleBot images
  3. 🏷️ Tag images with latest and clean-slate tags
  4. 🚀 Push all images to the registry

Option 2: Manual Steps

If you prefer to run commands manually:

# 1. Build TeleShop image
docker build -f Dockerfile -t teleshop:latest .

# 2. Build TeleBot image
docker build -f Dockerfile.telebot -t telebot:latest .

# 3. Tag images for registry
docker tag teleshop:latest 10.8.0.1:5000/teleshop:latest
docker tag teleshop:latest 10.8.0.1:5000/teleshop:clean-slate
docker tag telebot:latest 10.8.0.1:5000/telebot:latest
docker tag telebot:latest 10.8.0.1:5000/telebot:clean-slate

# 4. Push to registry
docker push 10.8.0.1:5000/teleshop:latest
docker push 10.8.0.1:5000/teleshop:clean-slate
docker push 10.8.0.1:5000/telebot:latest
docker push 10.8.0.1:5000/telebot:clean-slate

Registry Configuration

If Using HTTP (Insecure) Registry

The registry at 10.8.0.1:5000 is HTTP (not HTTPS). You need to configure Docker to allow insecure registries:

On Linux

Edit /etc/docker/daemon.json:

{
  "insecure-registries": ["10.8.0.1:5000"]
}

Restart Docker:

sudo systemctl restart docker

On Windows (Docker Desktop)

  1. Open Docker Desktop
  2. Go to Settings → Docker Engine
  3. Add to the JSON configuration:
{
  "insecure-registries": ["10.8.0.1:5000"]
}
  1. Click "Apply & Restart"

On macOS (Docker Desktop)

  1. Open Docker Desktop
  2. Go to Preferences → Docker Engine
  3. Add to the JSON configuration:
{
  "insecure-registries": ["10.8.0.1:5000"]
}
  1. Click "Apply & Restart"

Verify Deployment

After pushing, verify the images are in the registry:

# List all repositories
curl http://10.8.0.1:5000/v2/_catalog

# Expected output:
# {"repositories":["telebot","teleshop"]}

# List tags for TeleShop
curl http://10.8.0.1:5000/v2/teleshop/tags/list

# List tags for TeleBot
curl http://10.8.0.1:5000/v2/telebot/tags/list

Pulling Images

On your deployment server, pull the images:

# Pull TeleShop
docker pull 10.8.0.1:5000/teleshop:latest
# or specific version
docker pull 10.8.0.1:5000/teleshop:clean-slate

# Pull TeleBot
docker pull 10.8.0.1:5000/telebot:latest
# or specific version
docker pull 10.8.0.1:5000/telebot:clean-slate

Using with docker-compose

Update your docker-compose.yml to use the registry images:

services:
  littleshop:
    image: 10.8.0.1:5000/teleshop:latest
    # ... rest of configuration

  telebot:
    image: 10.8.0.1:5000/telebot:latest
    # ... rest of configuration

Troubleshooting

Cannot connect to registry

# Test connectivity
curl http://10.8.0.1:5000/v2/_catalog

# If this fails, check:
# - Network connectivity to 10.8.0.1
# - Registry service is running
# - Port 5000 is accessible (check firewall)

Permission denied when pushing

# Registry may require authentication. Contact your registry administrator.

HTTP request forbidden

# You need to configure the insecure registry setting (see above)

Image Details

TeleShop Image

  • Base Image: mcr.microsoft.com/dotnet/aspnet:9.0
  • Exposed Port: 8080
  • Database: SQLite at /app/data/teleshop-prod.db
  • Volumes:
    • /app/data - Database storage
    • /app/wwwroot/uploads - Product images
    • /app/logs - Application logs

TeleBot Image

  • Base Image: mcr.microsoft.com/dotnet/aspnet:9.0
  • Dependencies: Connects to TeleShop API
  • Volumes:
    • /app/logs - Application logs
    • /app/data - Bot data
    • /app/image_cache - Cached product images

Version Tags

  • latest - Always points to the most recent build
  • clean-slate - Baseline version with migrations, no sample data (current clean state)

CI/CD Integration

You can integrate this deployment script into your CI/CD pipeline:

# GitLab CI example
deploy:
  stage: deploy
  script:
    - ./deploy-to-registry.sh
  only:
    - main
    - tags
# GitHub Actions example
- name: Deploy to Registry
  run: ./deploy-to-registry.sh