3.7 KiB
3.7 KiB
Admin Panel Deployment Guide
🚀 Quick Start
1. Clone Repository
cd /opt
git clone https://gitea.argeict.net/argeict/admin-panel.git
cd admin-panel
2. Configure Environment
cp .env.example .env
nano .env
Update the following:
SECRET_KEY- Random secret keyJWT_SECRET_KEY- Random JWT secretCUSTOMER_API_URL- Customer platform API URLCUSTOMER_API_INTERNAL_KEY- Internal API keyCORS_ORIGINS- Allowed origins
3. Build and Run
docker-compose up -d --build
4. Initialize Database
docker exec -it admin-panel-backend python -c "
from app.main import app, db
from app.models import AdminUser
with app.app_context():
db.create_all()
# Create default admin
admin = AdminUser(
username='admin',
email='admin@argeict.net',
full_name='System Admin'
)
admin.set_password('admin123')
db.session.add(admin)
db.session.commit()
print('Database initialized!')
"
🌐 Nginx Configuration
Backend API (admin-api.argeict.net)
server {
listen 80;
server_name admin-api.argeict.net;
location / {
proxy_pass http://localhost:5001;
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;
}
}
Frontend (admin.argeict.net)
server {
listen 80;
server_name admin.argeict.net;
location / {
proxy_pass http://localhost:5173;
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;
}
}
Enable SSL with Certbot
certbot --nginx -d admin.argeict.net -d admin-api.argeict.net
📊 Default Credentials
Username: admin
Password: admin123
⚠️ IMPORTANT: Change the default password immediately after first login!
🔧 Maintenance
View Logs
docker-compose logs -f backend
docker-compose logs -f frontend
Restart Services
docker-compose restart
Update Application
git pull
docker-compose up -d --build
Backup Database
docker cp admin-panel-backend:/app/data/admin_panel.db ./backup-$(date +%Y%m%d).db
🔐 Security Checklist
- Change default admin password
- Update SECRET_KEY and JWT_SECRET_KEY
- Configure CORS_ORIGINS properly
- Enable SSL/HTTPS
- Set up firewall rules
- Regular database backups
- Monitor audit logs
📝 API Endpoints
Authentication
POST /api/auth/login- Admin loginGET /api/auth/me- Get current adminPOST /api/auth/logout- Logout
Plans
GET /api/plans- List all plansPOST /api/plans- Create planPUT /api/plans/:id- Update planDELETE /api/plans/:id- Delete plan
CF Accounts
GET /api/cf-accounts- List CF accountsPOST /api/cf-accounts- Create CF accountPUT /api/cf-accounts/:id- Update CF accountDELETE /api/cf-accounts/:id- Delete CF account
Customers
GET /api/customers- List customersGET /api/customers/:id- Get customer detailsPUT /api/customers/:id/plan- Update customer plan
🐛 Troubleshooting
Backend not starting
docker logs admin-panel-backend
Frontend not building
docker logs admin-panel-frontend
Database issues
docker exec -it admin-panel-backend python -c "
from app.main import app, db
with app.app_context():
db.create_all()
"
📞 Support
For issues, check the logs or contact the development team.