8000 GitHub - abdrrahmenz/freeakun Β· GitHub
[go: up one dir, main page]

Skip to content
abdrrahmenzPublic
forked from imnoob59/freeakun

About

No description, website, or topics provided.

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Β 
Β 

Latest commit

Β 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

FreeAkun.me - Modern Account Generator Platform

Platform modern untuk generate akun premium dengan sistem coin. Dapatkan akun Netflix, Spotify, Canva, Disney+, VPN dan Steam dengan mudah, cepat, dan terpercaya!

License Version Docker Python Flask PostgreSQL Last Commit Contributors Issues PRs Welcome


οΏ½ Table of Contents


πŸš€ Quick Start (Docker)

# 1. Clone repository
git clone https://github.com/imnoob59/freeakun.git
cd freeakun

# 2. Run installation script
chmod +x install.sh
sudo ./install.sh

# 3. Access app
http://localhost:5000

# Default Login:
Admin: admin / admin123
User: user1 / user123

⚠️ PENTING: Segera ganti password default setelah login!


🎯 Features

πŸ’Ž User Features

  • Multi Account Types: Netflix, Spotify, Canva, Disney+, VPN, Steam
  • Coin System: Pricing transparan dengan multiple packages
  • QRIS Payment: Dynamic QRIS dengan unique code auto-verification
  • Real-time Status: Auto-update payment status setiap 5 detik
  • Auto-expire: Transaksi otomatis expire dalam 5 menit
  • Generation History: Track semua akun yang pernah di-generate
  • Referral System: Dapatkan bonus coin dari referral
  • Daily Check-in: Bonus coin harian untuk user aktif
  • Profile Management: Update profile & verifikasi Telegram

⚑ Admin Features

  • Dashboard Analytics: Statistik user, revenue, dan transaksi
  • User Management: CRUD operations untuk semua user
  • Account Type Management: Kelola jenis akun dengan image upload
  • Coin Package Management: Atur paket coin dan pricing
  • Top-up Approval: Review & approve payment requests
  • System Settings: Feature toggles dan konfigurasi sistem
  • Telegram Notifications: Notifikasi real-time untuk topup requests
  • Clear History: Bulk delete generation logs

πŸ’³ Payment System

  • QRIS Dynamic: Menggunakan ISO/IEC 13239 CRC-16 checksum
  • Unique Code: 3-digit code unik untuk auto-verification
  • Countdown Timer: 5 menit dengan visual countdown
  • Auto-expire: Otomatis expire dan redirect ke dashboard
  • Real-time Polling: Check status setiap 5 detik
  • Payment Upload: Upload bukti pembayaran dengan preview

πŸ“± Modern UI/UX

  • Professional Design: TailwindCSS dengan gradient modern
  • Responsive: Mobile-first design untuk semua device
  • Smooth Animations: Transitions & micro-interactions
  • Modern Branding: Custom favicon & logo
  • WhatsApp Channel: Popup untuk channel official
  • Dark Mode Ready: Siap untuk dark mode implementation

πŸ” SEO Optimized

  • Meta Tags: Complete description, keywords, OG, Twitter cards
  • Structured Data: JSON-LD untuk rich snippets
  • Sitemap.xml: Auto-generated sitemap
  • Robots.txt: SEO-friendly crawling rules
  • PWA Ready: Manifest.json untuk progressive web app
  • Social Preview: Custom OG images untuk social media

πŸ€– Telegram Bot Integration

  • User Verification: Link Telegram account untuk notifikasi
  • Admin Notifications: Real-time alert saat ada topup request
  • Inline Approval: Approve/reject langsung dari Telegram
  • User Notifications: Auto-notify user saat topup approved/rejected
  • Bot Commands: /start, /verify, /help commands

πŸ“‹ Tech Stack

  • Backend: Flask 3.0, SQLAlchemy ORM, Flask-Login
  • Database: PostgreSQL 15
  • Frontend: TailwindCSS 3.0, Alpine.js, FontAwesome 6.4
  • Payment: QRIS Dynamic Generation (CRC-16)
  • Bot: python-telegram-bot 20.0
  • Deploy: Docker + Docker Compose
  • Server: Nginx (reverse proxy), Let's Encrypt (SSL)

πŸ“ Project Structure

freeakun/
β”œβ”€β”€ app/
β”‚   β”œβ”€β”€ admin/              # Admin routes & forms
β”‚   β”‚   β”œβ”€β”€ routes.py       # Admin CRUD operations
β”‚   β”‚   └── forms.py        # WTForms for admin
β”‚   β”œβ”€β”€ auth/               # Authentication
β”‚   β”‚   β”œβ”€β”€ routes.py       # Login/register/logout
β”‚   β”‚   └── forms.py        # Login & register forms
β”‚   β”œβ”€β”€ user/               # User dashboard
β”‚   β”‚   └── routes.py       # Generate, topup, profile
β”‚   β”œβ”€β”€ telegram_bot/       # Telegram integration
β”‚   β”‚   └── routes.py       # Bot commands & notifications
β”‚   β”œβ”€β”€ utils/              # Utilities
β”‚   β”‚   └── qris.py         # QRIS generator
β”‚   β”œβ”€β”€ static/             # Static assets
β”‚   β”‚   β”œβ”€β”€ css/
β”‚   β”‚   β”œβ”€β”€ images/
β”‚   β”‚   β”œβ”€β”€ sounds/         # Notification sounds
β”‚   β”‚   └── uploads/        # User uploads (QRIS, payments)
β”‚   β”œβ”€β”€ templates/          # Jinja2 templates
β”‚   β”‚   β”œβ”€β”€ admin/          # Admin templates
β”‚   β”‚   β”œβ”€β”€ auth/           # Login/register
β”‚   β”‚   └── user/           # User dashboard templates
β”‚   └── models.py           # SQLAlchemy models
β”œβ”€β”€ backups/                # Auto backups (gitignored)
β”œβ”€β”€ migrations/             # Database migrations
β”œβ”€β”€ docker-compose.yml      # Container orchestration
β”œβ”€β”€ Dockerfile              # Python app container
β”œβ”€β”€ requirements.txt        # Python dependencies
β”œβ”€β”€ config.py               # App configuration
β”œβ”€β”€ run.py                  # Application entry point
β”œβ”€β”€ seed.py                 # Database seeder
β”‚
β”œβ”€β”€ install.sh              # Auto installation script
β”œβ”€β”€ backup-database.sh      # Database backup
β”œβ”€β”€ export-users.sh         # Export users only
β”œβ”€β”€ import-users.sh         # Import users
β”œβ”€β”€ check-system.sh         # System check
β”œβ”€β”€ migrate-to-new-server.sh # Full migration
└── README.md               # This file

πŸ’» Installation

System Requirements

Minimum:

  • OS: Ubuntu 20.04+ / Debian 11+ / CentOS 8+
  • RAM: 2GB (4GB recommended)
  • Storage: 20GB minimum
  • CPU: 2 cores minimum
  • Ports: 5000, 80, 443 available

1. Automated Installation (Recommended)

Step 1: Prepare Server

# Update system
sudo apt update && sudo apt upgrade -y

# Create project directory
sudo mkdir -p /opt/freeakun
cd /opt/freeakun

Step 2: Clone or Upload Project

Option A - From Git:

git clone https://github.com/imnoob59/freeakun.git .

Option B - From ZIP:

# Upload via SCP
scp -r freeakun.zip user@server:/tmp/

# Extract on server
cd /opt/freeakun
unzip /tmp/freeakun.zip

Step 3: Run Installation

# Make scripts executable
chmod +x *.sh

# Check system requirements
./check-system.sh

# Run installation (10-15 minutes)
sudo ./install.sh

Installation script will:

  • βœ… Install Docker & Docker Compose
  • βœ… Setup environment variables
  • βœ… Build containers
  • βœ… Initialize database with seed data
  • βœ… Configure firewall (optional)
  • βœ… Display login credentials

Step 4: Verify Installation

# Run verification script
./verify-installation.sh

This will check:

  • βœ… Docker & Docker Compose installed
  • βœ… Containers running
  • βœ… Database ready
  • βœ… Web app responding
  • βœ… Admin user created
  • βœ… Required directories exist

Step 5: Access Application

URL: http://YOUR_SERVER_IP:5000

Admin Login:
- Username: admin
- Password: admin123

User Login:
- Username: user1
- Password: user123

2. Manual Installation

Prerequisites

# Install dependencies
sudo apt install -y python3.12 python3-pip python3-venv postgresql postgresql-contrib

# Create database
sudo -u postgres createdb freeakun_db
sudo -u postgres createuser freeakun_user -P

Setup Application

# Create virtual environment
python3 -m venv venv
source venv/bin/activate

# Install Python packages
pip install -r requirements.txt

# Configure environment
cp .env.example .env
nano .env  # Edit database credentials & secret key

# Generate SECRET_KEY (optional)
python -c "import secrets; print(secrets.token_hex(32))"

# Initialize database
python seed.py

# Run application
python run.py

Application will be available at http://localhost:5000


πŸ”„ User Migration

Migrasi user dari server lama ke server baru tanpa kehilangan data.

Scenario: Pindah ke Server Baru dengan User Existing

Step 1: Export dari Server Lama

# Di server lama
cd /opt/freeakun
./export-users.sh

# Output: backups/users_backup_TIMESTAMP.tar.gz

Script akan export:

  • User data (username, email, password hash, coin balance)
  • Generation logs
  • Top-up transactions
  • Referral data

Step 2: Transfer Backup

# Copy ke server baru
scp backups/users_backup_*.tar.gz user@new-server:/opt/freeakun/backups/

Step 3: Install di Server Baru

# Di server baru
cd /opt/freeakun
sudo ./install.sh

Step 4: Import User Data

# Extract backup
cd backups
tar -xzf users_backup_*.tar.gz

# Import users
cd ..
./import-users.sh backups/users_backup_simple_*.sql

βœ… Hasil: User lama bisa login dengan password mereka, coin balance tetap sama!


πŸ’Ύ Backup & Restore

Manual Backup

# Full database backup
./backup-database.sh

# Backup users only
./export-users.sh

Backup disimpan di folder backups/ dengan format:

  • full_backup_YYYYMMDD_HHMMSS.sql.gz
  • users_backup_YYYYMMDD_HHMMSS.tar.gz

Automated Backup (Cron)

# Edit crontab
crontab -e

# Add daily backup at 2 AM
0 2 * * * cd /opt/freeakun && ./backup-database.sh >> /var/log/freeakun-backup.log 2>&1

# Add weekly user export (Sundays at 3 AM)
0 3 * * 0 cd /opt/freeakun && ./export-users.sh >> /var/log/freeakun-export.log 2>&1

Restore Database

# Stop application
docker-compose down

# Restore from backup
docker-compose up -d db
docker-compose exec -T db psql -U freeakun_user -d freeakun_db < backups/full_backup_*.sql

# Start application
docker-compose up -d

πŸ”’ SSL Configuration

Setup SSL dengan Let's Encrypt

Step 1: Install Nginx & Certbot

sudo apt install -y nginx certbot python3-certbot-nginx

Step 2: Configure Domain

# Edit nginx config
sudo nano /etc/nginx/sites-available/freeakun.me
server {
    listen 80;
    server_name freeakun.me www.freeakun.me;
    
    location / {
        proxy_pass http://localhost:5000;
        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;
    }
    
    client_max_body_size 10M;
}
# Enable site
sudo ln -s /etc/nginx/sites-available/freeakun.me /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl reload nginx

Step 3: Obtain SSL Certificate

# Get certificate
sudo certbot --nginx -d freeakun.me -d www.freeakun.me

# Auto-renewal test
sudo certbot renew --dry-run

Certificate auto-renewal akan berjalan otomatis.

Nginx Commands

# Test configuration
sudo nginx -t

# Reload
sudo systemctl reload nginx

# Restart
sudo systemctl restart nginx

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

πŸ€– Telegram Bot Setup

Setup notifikasi Telegram untuk admin dan user.

Step 1: Buat Bot

  1. Buka @BotFather di Telegram
  2. Kirim /newbot
  3. Ikuti instruksi setup
  4. Copy Bot Token (format: 123456789:ABCdef...)
  5. Copy Bot Username (contoh: FreeAkunBot)

Step 2: Dapatkan Admin Telegram ID

  1. Buka @userinfobot di Telegram
  2. Kirim pesan apa saja
  3. Copy Telegram ID Anda (angka, contoh: 123456789)

Step 3: Configure di Admin Panel

  1. Login sebagai admin
  2. Buka Settings menu
  3. Scroll ke Telegram Bot Configuration
  4. Isi:
    • Bot Token: Token dari BotFather
    • Bot Username: Username bot (tanpa @)
    • Admin Telegram ID: ID Telegram admin
  5. Klik Save Settings

Step 4: Start Bot

# Restart application untuk apply config
docker-compose restart web

Features

Admin Notifications:

  • Real-time alert saat ada topup request
  • Inline buttons untuk approve/reject
  • Detail transaksi lengkap

User Notifications:

  • Notifikasi saat topup approved
  • Notifikasi saat topup rejected
  • Info saldo coin terbaru

Bot Commands:

  • /start - Mulai bot
  • /verify - Verifikasi akun Telegram
  • /help - Bantuan

πŸ”§ Configuration

Environment Variables

File .env (auto-generated oleh install.sh):

# Flask
SECRET_KEY=your-random-secret-key
FLASK_ENV=production

# Database
DATABASE_URL=postgresql://freeakun_user:password@db:5432/freeakun_db

# Upload
MAX_CONTENT_LENGTH=10485760  # 10MB

# Session
SESSION_COOKIE_SECURE=True
SESSION_COOKIE_HTTPONLY=True
SESSION_COOKIE_SAMESITE=Lax

System Settings (Admin Panel)

Akses: Admin Dashboard β†’ Settings

General Settings:

  • Site Name: FreeAkun.me
  • Free Coins for New User: 100 coins (default)
  • Enable Top-Up: ON/OFF toggle
  • Minimum Top-Up: Rp 10,000

Payment Settings:

  • Merchant Name: Nama merchant untuk QRIS
  • Merchant City: Kota merchant
  • Merchant ID: ID merchant dari payment gateway
  • QRIS Static: Base QRIS code (optional)

Telegram Bot:

  • Bot Token: Token dari @BotFather
  • Bot Username: Username bot
  • Admin Telegram ID: ID Telegram admin

Coin Packages

Default packages (dapat diubah di admin panel):

Package Coins Price Bonus
Hemat 100 Rp 10,000 -
Populer 250 Rp 25,000 10%
Value 500 Rp 45,000 12%
Super 1,000 Rp 85,000 15%

Account Types Pricing

Default pricing (per generate):

Type Coin Cost
Netflix 50 coins
Spotify 30 coins
Canva Pro 40 coins
Disney+ 45 coins
VPN Premium 25 coins
Steam 60 coins

🎨 Database Schema

Core Models

User

  • id, username, email, password_hash
  • coin_balance (integer, default: 100)
  • role (admin/user)
  • is_active (boolean)
  • telegram_user_id, telegram_verified
  • referral_code, referred_by_id
  • daily_checkin_streak, last_checkin_date

AccountType

  • id, name, coin_price
  • image_filename
  • is_active

Account

  • id, account_type_id
  • username, password
  • is_used, used_by_user_id, used_at

CoinPackage

  • id, name, coin_amount, price
  • bonus_percentage
  • is_active

TopUpTransaction

  • id, user_id, coin_package_id
  • total_price, unique_code
  • qris_data, payment_proof
  • status (pending/approved/rejected/expired)
  • expired_at, approved_at, approved_by_id

GenerationLog

  • id, user_id, account_id
  • coin_cost, generated_at

SystemSetting

  • id, key, value
  • Feature toggles dan konfigurasi

PaymentSetting

  • id, merchant_name, merchant_city
  • merchant_id, static_qris

πŸ’» Docker Commands

Basic Operations

# Start all containers
docker-compose up -d

# Stop all containers
docker-compose down

# Restart containers
docker-compose restart

# View status
docker-compose ps

# View logs (real-time)
docker-compose logs -f

# View specific service logs
docker-compose logs -f web
docker-compose logs -f db

Database Operations

# Access database shell
docker-compose exec db psql -U freeakun_user -d freeakun_db

# Backup database
docker-compose exec db pg_dump -U freeakun_user freeakun_db > backup.sql

# Restore database
docker-compose exec -T db psql -U freeakun_user -d freeakun_db < backup.sql

# Reset database
docker-compose down -v
docker-compose up -d
docker-compose exec web python seed.py

Application Operations

# Access web container shell
docker-compose exec web bash

# Run Python commands
docker-compose exec web python seed.py
docker-compose exec web python -c "from app import db; print(db)"

# Rebuild containers
docker-compose build --no-cache
docker-compose up -d

# View application files
docker-compose exec web ls -la /app

Troubleshooting

# Check container health
docker-compose ps

# View full logs
docker-compose logs --tail=100

# Restart specific service
docker-compose restart web

# Remove and recreate
docker-compose down
docker-compose up -d --force-recreate

πŸ› οΈ API Endpoints

Public Routes

Method Endpoint Description
GET / Landing page
POST /auth/login User login
POST /auth/register User registration
GET /auth/verify-telegram Telegram verification

User Routes (Auth Required)

Method Endpoint Description
GET /dashboard/ User dashboard
POST /dashboard/generate/<id> Generate account
GET /dashboard/topup Top-up page
POST /dashboard/topup Create topup transaction
GET /dashboard/topup/payment/<id> Payment page
GET /dashboard/topup/check-status/<id> Check payment status (AJAX)
POST /dashboard/topup/upload/<id> Upload payment proof
GET /dashboard/profile User profile
POST /dashboard/profile Update profile
GET /dashboard/referral Referral info

Admin Routes (Admin Only)

Method Endpoint Description
GET /admin/ Admin dashboard
GET /admin/users User management
POST /admin/user/add Add new user
POST /admin/user/edit/<id> Edit user
POST /admin/user/delete/<id> Delete user
GET /admin/account-types Account type management
POST /admin/account-type/add Add account type
GET /admin/accounts Account management
GET /admin/coin-packages Coin package management
GET /admin/topup-requests Payment approval
POST /admin/topup/approve/<id> Approve topup
POST /admin/topup/reject/<id> Reject topup
GET /admin/settings System settings
POST /admin/settings Update settings
POST /admin/clear-history Clear generation logs

API Endpoints (AJAX)

Method Endpoint Description
GET /admin/api/check-pending-topups Check pending topups (Admin)
POST /telegram/webhook Telegram webhook

πŸš€ Deployment

Production Checklist

Security

  • Change SECRET_KEY in .env
  • Update default admin password
  • Update default user passwords
  • Enable HTTPS/SSL
  • Configure firewall (UFW)
  • Set FLASK_ENV=production
  • Enable SESSION_COOKIE_SECURE=True
  • Review file upload permissions

Configuration

  • Update QRIS payment settings
  • Configure Telegram bot
  • Set correct merchant info
  • Update domain in sitemap.xml
  • Update social media links
  • Configure backup cron jobs

SEO & Analytics

  • Submit sitemap to Google Search Console
  • Add Google Analytics
  • Verify Facebook domain
  • Setup Twitter cards
  • Test OG images

Testing

  • Test user registration
  • Test account generation
  • Test topup flow (QRIS)
  • Test payment approval
  • Test Telegram notifications
  • Test mobile responsiveness

Monitoring

  • Setup backup automation
  • Configure error logging
  • Setup uptime monitoring
  • Database performance monitoring
  • Disk space alerts

Performance Optimization

Nginx Configuration

server {
    listen 443 ssl http2;
    server_name freeakun.me;
    
    # SSL
    ssl_certificate /etc/letsencrypt/live/freeakun.me/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/freeakun.me/privkey.pem;
    
    # Security headers
    add_header X-Frame-Options "SAMEORIGIN" always;
    add_header X-Content-Type-Options "nosniff" always;
    add_header X-XSS-Protection "1; mode=block" always;
    add_header Referrer-Policy "no-referrer-when-downgrade" always;
    
    # Gzip compression
    gzip on;
    gzip_vary on;
    gzip_proxied any;
    gzip_comp_level 6;
    gzip_types text/plain text/css text/xml text/javascript 
               application/json application/javascript application/xml+rss;
    
    # Rate limiting
    limit_req_zone $binary_remote_addr zone=one:10m rate=10r/s;
    limit_req zone=one burst=20 nodelay;
    
    # Proxy settings
    location / {
        proxy_pass http://localhost:5000;
        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;
        
        # Timeouts
        proxy_connect_timeout 60s;
        proxy_send_timeout 60s;
        proxy_read_timeout 60s;
    }
    
    # Static files caching
    location /static/ {
        proxy_pass http://localhost:5000/static/;
        expires 1y;
        add_header Cache-Control "public, immutable";
    }
    
    client_max_body_size 10M;
}

# HTTP to HTTPS redirect
server {
    listen 80;
    server_name freeakun.me www.freeakun.me;
    return 301 https://freeakun.me$request_uri;
}

Database Optimization

# PostgreSQL tuning (edit postgresql.conf)
shared_buffers = 256MB
effective_cache_size = 1GB
maintenance_work_mem = 64MB
checkpoint_completion_target = 0.9
wal_buffers = 16MB
default_statistics_target = 100
random_page_cost = 1.1
effective_io_concurrency = 200
work_mem = 4MB
min_wal_size = 1GB
max_wal_size = 4GB

πŸ”’ Security

Built-in Security Features

  • Password Hashing: Werkzeug PBKDF2-SHA256
  • CSRF Protection: Flask-WTF tokens
  • SQL Injection: SQLAlchemy ORM parameterized queries
  • XSS Protection: Jinja2 auto-escaping
  • Role-Based Access: Admin/User separation
  • Session Security: HTTPOnly, Secure, SameSite cookies
  • File Upload Validation: Type & size checking
  • Rate Limiting: Can be added via Flask-Limiter

Security Best Practices

1. Change Default Credentials

# Login sebagai admin β†’ Settings β†’ Users
# Update admin password
# Delete atau disable default users

2. Environment Variables

# Generate strong SECRET_KEY
python -c "import secrets; print(secrets.token_hex(32))"

# Update .env
SECRET_KEY=your-new-super-secret-key-here

3. Firewall Configuration

# Install UFW
sudo apt install ufw

# Default policies
sudo ufw default deny incoming
sudo ufw default allow outgoing

# Allow SSH, HTTP, HTTPS
sudo ufw allow 22/tcp
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp

# Enable firewall
sudo ufw enable

4. Database Security

# Change database password
docker-compose exec db psql -U postgres
ALTER USER freeakun_user WITH PASSWORD 'new-strong-password';

# Update .env
DATABASE_URL=postgresql://freeakun_user:new-strong-password@db:5432/freeakun_db

# Restart
docker-compose restart

5. Regular Updates

# Update system
sudo apt update && sudo apt upgrade -y

# Update Docker images
docker-compose pull
docker-compose up -d --force-recreate

# Update Python packages
pip install --upgrade -r requirements.txt

πŸ› Troubleshooting

Common Issues

Port Already in Use

Problem: Port 5000 already occupied

Solution:

# Check what's using port 5000
sudo lsof -i :5000

# Kill process
sudo kill -9 <PID>

# Or change port in docker-compose.yml
ports:
  - "5001:5000"

Database Connection Error

Problem: Can't connect to PostgreSQL

Solution:

# Check database container
docker-compose ps

# Restart database
docker-compose restart db

# View database logs
docker-compose logs db

# Verify connection
docker-compose exec db psql -U freeakun_user -d freeakun_db

Permission Denied

Problem: Can't write to uploads folder

Solution:

# Fix permissions
sudo chown -R $USER:$USER /opt/freeakun
chmod -R 755 /opt/freeakun/app/static/uploads

Telegram Bot Not Working

Problem: Bot doesn't respond

Solution:

# Check bot token
docker-compose logs web | grep -i telegram

# Verify webhook
curl -X POST https://api.telegram.org/bot<YOUR_BOT_TOKEN>/getWebhookInfo

# Restart application
docker-compose restart web

QRIS Not Generating

Problem: QRIS code empty or error

Solution:

# Check payment settings
# Login β†’ Admin β†’ Settings β†’ Payment Settings
# Ensure merchant info is filled correctly

# Check logs
docker-compose logs web | grep -i qris

# Test QRIS generator
docker-compose exec web python
>>> from app.utils.qris import generate_dynamic_qris
>>> generate_dynamic_qris(10000, 123)

Images Not Uploading

Problem: Upload fails

Solution:

# Check upload directory
ls -la /opt/freeakun/app/static/uploads/

# Create missing directories
mkdir -p app/static/uploads/account_types
mkdir -p app/static/uploads/payments
mkdir -p app/static/uploads/qris

# Fix permissions
chmod 755 app/static/uploads/*

Reset Everything

Warning: This will delete ALL data!

# Stop containers
docker-compose down -v

# Remove volumes
docker volume prune -f

# Restart fresh
docker-compose up -d

# Re-seed database
docker-compose exec web python seed.py

View Logs

# All logs
docker-compose logs -f

# Last 100 lines
docker-compose logs --tail=100

# Web application only
docker-compose logs -f web

# Database only
docker-compose logs -f db

# Save logs to file
docker-compose logs > logs.txt

Check System Resources

# Disk space
df -h

# Memory usage
free -h

# Docker disk usage
docker system df

# Container resources
docker stats

🎨 Customization

Branding

Update Site Metadata

Edit app/templates/base.html:

<!-- Update meta tags -->
<title>Your Site Name</title>
<meta name="description" content="Your description">
<meta property="og:title" content="Your Site Name">
<meta property="og:description" content="Your description">

Update Logo & Favicon

# Replace favicon
cp your-logo.svg app/static/favicon.svg

# Replace logo in landing page
# Edit app/templates/landing.html

Update Colors (TailwindCSS)

Colors are using Tailwind's default palette. To customize:

<!-- Primary color (indigo) -->
<div class="bg-indigo-600">  <!-- Change to: bg-blue-600 -->

<!-- Gradient backgrounds -->
<div class="bg-gradient-to-br from-indigo-600 to-purple-600">

Common Tailwind colors:

  • blue, green, red, purple, pink, yellow, orange

Update Content

Edit app/templates/landing.html:

<!-- Hero section -->
<h1>Your Custom Headline</h1>
<p>Your custom description</p>

<!-- Features section -->
<!-- Update feature cards -->

<!-- Footer -->
<!-- Update footer content -->

Add New Account Type

  1. Admin Panel: Login β†’ Account Types β†’ Add New
  2. Fill form:
    • Name: "Your Account Type"
    • Coin Price: 50
    • Upload Image
    • Status: Active
  3. Add Accounts: Accounts β†’ Bulk Import
    • Upload CSV with username,password

Modify Coin Packages

  1. Admin Panel: Login β†’ Coin Packages
  2. Edit existing or Add new:
    • Name
    • Coin Amount
    • Price (IDR)
    • Bonus Percentage
  3. Save

Custom Email Templates

Currently using Flask-Mail (can be integrated).

Example integration:

# In requirements.txt
Flask-Mail==0.9.1

# In config.py
MAIL_SERVER = 'smtp.gmail.com'
MAIL_PORT = 587
MAIL_USE_TLS = True
MAIL_USERNAME = os.environ.get('MAIL_USERNAME')
MAIL_PASSWORD = os.environ.get('MAIL_PASSWORD')

Add Analytics

Google Analytics

Edit app/templates/base.html:

<!-- Before </head> -->
<!-- Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXXXXXX"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());
  gtag('config', 'G-XXXXXXXXXX');
</script>

Facebook Pixel

<!-- Facebook Pixel Code -->
<script>
!function(f,b,e,v,n,t,s)
{if(f.fbq)return;n=f.fbq=function(){n.callMethod?
n.callMethod.apply(n,arguments):n.queue.push(arguments)};
if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';
n.queue=[];t=b.createElement(e);t.async=!0;
t.src=v;s=b.getElementsByTagName(e)[0];
s.parentNode.insertBefore(t,s)}(window, 
F030
document,'script',
'https://connect.facebook.net/en_US/fbevents.js');
fbq('init', 'YOUR_PIXEL_ID');
fbq('track', 'PageView');
</script>

πŸ“ˆ Monitoring & Maintenance

Health Checks

# Application status
curl http://localhost:5000

# Database status
docker-compose exec db pg_isready

# Check disk space
df -h

# Check memory
free -h

Log Management

# Rotate logs (create logrotate config)
sudo nano /etc/logrotate.d/freeakun
/opt/freeakun/logs/*.log {
    daily
    rotate 14
    compress
    delaycompress
    notifempty
    create 0640 www-data www-data
    sharedscripts
    postrotate
        docker-compose restart web > /dev/null
    endscript
}

Performance Monitoring

Install monitoring tools

# htop for system monitoring
sudo apt install htop

# ctop for container monitoring
sudo wget https://github.com/bcicen/ctop/releases/download/v0.7.7/ctop-0.7.7-linux-amd64 -O /usr/local/bin/ctop
sudo chmod +x /usr/local/bin/ctop

Monitor containers

# Real-time container stats
docker stats

# Using ctop (better UI)
ctop

Database Maintenance

# Vacuum database (cleanup)
docker-compose exec db psql -U freeakun_user -d freeakun_db -c "VACUUM ANALYZE;"

# Check database size
docker-compose exec db psql -U freeakun_user -d freeakun_db -c "SELECT pg_size_pretty(pg_database_size('freeakun_db'));"

# Check table sizes
docker-compose exec db psql -U freeakun_user -d freeakun_db -c "SELECT relname, pg_size_pretty(pg_total_relation_size(relid)) FROM pg_catalog.pg_statio_user_tables ORDER BY pg_total_relation_size(relid) DESC;"

Update Application

# Backup first!
./backup-database.sh

# Pull latest changes
git pull origin main

# Rebuild containers
docker-compose build --no-cache
docker-compose up -d

# Check logs
docker-compose logs -f

πŸ“š Useful Scripts

All scripts are located in the root directory:

verify-installation.sh

Verify that installation completed successfully.

./verify-installation.sh

Checks:

  • Docker & Docker Compose installation
  • Container status (web & database)
  • Database connection
  • Web app responsiveness
  • Database tables & admin user
  • Directory permissions
  • Port availability

Exit codes:

  • 0 = All checks passed
  • >0 = Number of failed checks

install.sh

Full automated installation for new server.

sudo ./install.sh

What it does:

  • Install Docker & Docker Compose
  • Setup environment variables
  • Build and start containers
  • Initialize database
  • Configure firewall (optional)

check-system.sh

Pre-installation system check.

./check-system.sh

Checks:

  • OS compatibility
  • Required ports availability
  • Disk space & RAM
  • Docker installation
  • File integrity

backup-database.sh

Full database backup with compression.

./backup-database.sh

Output: backups/full_backup_YYYYMMDD_HHMMSS.sql.gz

Features:

  • Full schema + data backup
  • Gzip compression
  • Auto cleanup (keeps last 7 backups)
  • Timestamped filenames

export-users.sh

Export user data only for migration.

./export-users.sh

Output: backups/users_backup_YYYYMMDD_HHMMSS.tar.gz

Exports:

  • User accounts
  • Coin balances
  • Generation logs
  • Topup transactions
  • Referral data

import-users.sh

Import users to new server.

./import-users.sh backups/users_backup_simple_*.sql

Features:

  • Safety backup before import
  • User data import
  • Sequence updates
  • Import verification

migrate-to-new-server.sh

Complete migration automation.

./migrate-to-new-server.sh

Process:

  • Check prerequisites
  • Export from old server
  • Transfer files
  • Install on new server
  • Import user data
  • Verification

check-telegram-logs.sh

Debug Telegram bot issues.

./check-telegram-logs.sh

Shows:

  • Bot configuration
  • Recent Telegram-related logs
  • Webhook status

🀝 Contributing

Contributions are welcome! Here's how:

  1. Fork the repository
  2. Create feature branch: git checkout -b feature/AmazingFeature
  3. Commit changes: git commit -m 'Add AmazingFeature'
  4. Push to branch: git push origin feature/AmazingFeature
  5. Open Pull Request

Development Setup

# Clone repository
git clone https://github.com/imnoob59/freeakun.git
cd freeakun

# Create virtual environment
python -m venv venv
source venv/bin/activate

# Install dependencies
pip install -r requirements.txt

# Setup pre-commit hooks (optional)
pip install pre-commit
pre-commit install

πŸ“„ License

All rights reserved Β© 2025 Masanto ID

This software is proprietary and confidential. Unauthorized copying, distribution, or modification is strictly prohibited.


🀝 Contributing

We welcome contributions! Please see our Contributing Guide for details.

Quick contribution steps:

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

See CONTRIBUTING.md for detailed guidelines.


πŸ”’ Security

Security is a top priority. If you discover a security vulnerability, please follow our Security Policy.

Quick security checklist:

  • βœ… Change default admin password
  • βœ… Use strong SECRET_KEY
  • βœ… Enable HTTPS in production
  • βœ… Secure your .env file
  • βœ… Regular backups

See SECURITY.md for full security guidelines.


πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

MIT License - Copyright (c) 2025 Masanto ID

πŸ“ž Support & Contact

Created by Masanto ID


πŸ™ Credits

Built with:


⭐ If you find this project useful, please give it a star on GitHub!

Happy Coding! πŸš€

About

No description, website, or topics provided.

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

0