https://github.com/imvickykumar999/Ecommerce-Django-Website
152
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.
24x7stream.shop ā <YOUR_VPS_IP>www.24x7stream.shop ā <YOUR_VPS_IP>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
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
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/
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
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/ā !
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
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
docker logs -f 24x7streamshop
# 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
# Restart
docker restart 24x7streamshop
# Stop
docker stop 24x7streamshop
imvickykumar999/24x7streamshop24x7StreamShop, latestContent type
Image
Digest
sha256:bb3ec6b1aā¦
Size
106 MB
Last updated
about 1 month ago
docker pull imvickykumar999/24x7streamshop