CVTas Admin Guide

Quick reference for administrators managing the CVTas system.

Creating User Accounts

Via SSH

SSH into the production server:

ssh -i ~/.ssh/cvtas-deploy.pem ubuntu@208.113.128.121

Create a New User

cd ~/CVTas
source venv/bin/activate
export DJANGO_SETTINGS_MODULE=backend.settings_production

# Interactive creation (prompts for username, email, password)
python manage.py createsuperuser

# Or for a regular user (non-admin)
python manage.py shell

Then in the Python shell:

from django.contrib.auth.models import User

# Create regular user
user = User.objects.create_user(
    username='username',
    email='user@example.com',
    password='temporary_password'
)

# Or create admin user
admin_user = User.objects.create_superuser(
    username='admin_username',
    email='admin@example.com',
    password='secure_password'
)

print(f"Created user: {user.username}")
exit()

User Credentials Best Practices

  1. Initial Password: Use a temporary password and instruct user to change it
  2. Password Requirements: Django enforces strong password validation
  3. Communication: Send credentials via secure channel (not email)
  4. Documentation: Log user creation in your admin records

Managing Users

List All Users

python manage.py shell
from django.contrib.auth.models import User
for user in User.objects.all():
    print(f"{user.username} - {'Admin' if user.is_superuser else 'User'} - {user.email}")

Deactivate a User

from django.contrib.auth.models import User
user = User.objects.get(username='username')
user.is_active = False
user.save()

Reset Password

python manage.py changepassword username

System Maintenance

Restarting Services

# Restart Gunicorn (Django application server)
sudo systemctl restart gunicorn

# Restart Nginx (web server)
sudo systemctl restart nginx

# Check status
sudo systemctl status gunicorn
sudo systemctl status nginx

Viewing Logs

# Gunicorn logs
sudo journalctl -u gunicorn.service -n 100 --no-pager

# Nginx access logs
sudo tail -f /var/log/nginx/access.log

# Nginx error logs
sudo tail -f /var/log/nginx/error.log

Database Backup

# Backup SQLite database
cd ~/CVTas
cp db.sqlite3 "backups/db.sqlite3.$(date +%Y%m%d_%H%M%S)"

Updating Code

cd ~/CVTas
git pull origin master

# Install new dependencies (if any)
source venv/bin/activate
pip install -r requirements.txt

# Run migrations
export DJANGO_SETTINGS_MODULE=backend.settings_production
python manage.py migrate

# Collect static files
python manage.py collectstatic --no-input

# Restart services
sudo systemctl restart gunicorn

SSL Certificate Renewal

Let's Encrypt certificates auto-renew via systemd timer. To check:

# Check renewal status
sudo certbot renew --dry-run

# View renewal timer
sudo systemctl status certbot.timer

# Manual renewal (if needed)
sudo certbot renew

Monitoring

Disk Space

df -h

Alert: The VPS has only 3GB total. Monitor usage regularly.

Memory Usage

free -h

Running Processes

# Check Gunicorn workers
ps aux | grep gunicorn

# Check system load
top

Security

Firewall Rules

# View security groups in DreamCompute dashboard
# Or check current iptables rules
sudo iptables -L

Update System

sudo apt update && sudo apt upgrade -y

Note: Kernel updates require reboot. Schedule during maintenance windows.

Quick Reference

Server IP: 208.113.128.121 Domain: https://app.cvtas.pipfoweraker.com SSH Key: cvtas-deploy.pem Django Settings: backend.settings_production Database: ~/CVTas/db.sqlite3 Static Files: ~/CVTas/staticfiles/ Media Files: ~/CVTas/media/

Services: - Gunicorn: sudo systemctl {start|stop|restart|status} gunicorn - Nginx: sudo systemctl {start|stop|restart|status} nginx

File Locations: - Gunicorn config: /etc/systemd/system/gunicorn.service - Nginx config: /etc/nginx/sites-available/cvtas - SSL certs: /etc/letsencrypt/live/app.cvtas.pipfoweraker.com/


Last Updated: 2025-10-19