Sign inSign up

imvickykumar999/24x7streamshop

By imvickykumar999

•Updated about 1 month ago

https://github.com/imvickykumar999/Ecommerce-Django-Website

Image
0

152

imvickykumar999/24x7streamshop repository overview

⁠24x7 Stream Shop - VPS Docker Deployment Guide

Complete step-by-step guide to deploying https://24x7stream.shop/⁠ on a brand-new VPS (Ubuntu / Debian) using the pre-built Docker image from Docker Hub.


ā šŸ“‹ Prerequisites

  • A VPS running Ubuntu 22.04 / 24.04 or Debian 12
  • Domain DNS A-Records pointing to your VPS Public IP:
    • 24x7stream.shop → <YOUR_VPS_IP>
    • www.24x7stream.shop → <YOUR_VPS_IP>

ā šŸš€ Quick Deployment (5 Steps)

⁠Step 1: Install Docker & Nginx on VPS

SSH into your new VPS as root (or ubuntu with sudo) and run:

# Update package lists
sudo apt update && sudo apt upgrade -y

# Install Docker
curl -fsSL https://get.docker.com | sh
sudo systemctl enable --now docker
sudo usermod -aG docker $USER

# Install Nginx & Certbot for SSL
sudo apt install -y nginx certbot python3-certbot-nginx
sudo systemctl enable --now nginx

⁠Step 2: Create Data Directories for Persistence

Create directories to persist the SQLite database and uploaded media files across container updates:

sudo mkdir -p /opt/24x7streamshop/media
sudo mkdir -p /opt/24x7streamshop/data
sudo chmod -R 777 /opt/24x7streamshop

⁠Step 3: Pull & Run the Docker Container

Pull the pre-built image from Docker Hub and start the container:

# Pull the latest image
docker pull imvickykumar999/24x7streamshop:24x7StreamShop

# Run container with auto-restart on port 8000
docker run -d \
  --name 24x7streamshop \
  --restart unless-stopped \
  -p 127.0.0.1:8000:8000 \
  -v /opt/24x7streamshop/media:/app/media \
  imvickykumar999/24x7streamshop:24x7StreamShop

Verify that the container is running and healthy:

docker ps
curl -I http://127.0.0.1:8000/

⁠Step 4: Configure Nginx Reverse Proxy

Create an Nginx server configuration for 24x7stream.shop:

sudo nano /etc/nginx/sites-available/24x7stream.shop

Paste the following configuration:

server {
    server_name 24x7stream.shop www.24x7stream.shop;

    client_max_body_size 100M;

    location / {
        proxy_pass http://127.0.0.1:8000;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_read_timeout 120s;
        proxy_connect_timeout 120s;
    }
}

Enable the configuration and reload Nginx:

sudo ln -sf /etc/nginx/sites-available/24x7stream.shop /etc/nginx/sites-enabled/
sudo rm -f /etc/nginx/sites-enabled/default
sudo nginx -t && sudo systemctl reload nginx

⁠Step 5: Secure with Free SSL (Let's Encrypt)

Obtain and configure SSL certificates automatically with Certbot:

sudo certbot --nginx -d 24x7stream.shop -d www.24x7stream.shop --non-interactive --agree-tos -m [email protected] --redirect

Certbot will automatically renew your certificates. Test renewal with:

sudo certbot renew --dry-run

šŸŽ‰ Your website is now live with HTTPS at https://24x7stream.shop/⁠!


⁠🐳 Alternative: Deploy with Docker Compose

If you prefer using docker-compose, create a docker-compose.yml file:

version: '3.8'

services:
  web:
    image: imvickykumar999/24x7streamshop:24x7StreamShop
    container_name: 24x7streamshop
    restart: unless-stopped
    ports:
      - "127.0.0.1:8000:8000"
    volumes:
      - /opt/24x7streamshop/media:/app/media
    environment:
      - PYTHONUNBUFFERED=1

Start the application:

docker compose up -d

ā šŸ› ļø Maintenance & Useful Commands

⁠1. Update Container to Newest Image
docker pull imvickykumar999/24x7streamshop:24x7StreamShop
docker stop 24x7streamshop
docker rm 24x7streamshop
docker run -d \
  --name 24x7streamshop \
  --restart unless-stopped \
  -p 127.0.0.1:8000:8000 \
  -v /opt/24x7streamshop/media:/app/media \
  imvickykumar999/24x7streamshop:24x7StreamShop
⁠2. View Live Logs
docker logs -f 24x7streamshop
⁠3. Run Django Management Commands Inside Container
# Create a superuser
docker exec -it 24x7streamshop python manage.py createsuperuser

# Run database migrations
docker exec -it 24x7streamshop python manage.py migrate

# Access Django interactive shell
docker exec -it 24x7streamshop python manage.py shell
⁠4. Restart or Stop Container
# Restart
docker restart 24x7streamshop

# Stop
docker stop 24x7streamshop

ā šŸ“¦ Docker Image Details

Tag summary

Content type

Image

Digest

sha256:bb3ec6b1a…

Size

106 MB

Last updated

about 1 month ago

docker pull imvickykumar999/24x7streamshop