docs: rewrite README in English with Linux/Windows setup guides and add auto-install scripts

This commit is contained in:
root
2026-05-25 15:25:46 +02:00
parent 943d5bfc38
commit 4aa574e75e
3 changed files with 1009 additions and 169 deletions
+308 -153
View File
@@ -1,4 +1,4 @@
# AtomCMS Remco Epicnabbo Edition # AtomCMS Remco Epicnabbo Edition
<div align="center"> <div align="center">
<img src="https://i.imgur.com/9ePNdJ4.png" alt="Atom CMS" width="200"/> <img src="https://i.imgur.com/9ePNdJ4.png" alt="Atom CMS" width="200"/>
@@ -16,43 +16,25 @@
--- ---
## ⚡ Quick Start ## Features
```bash
# Interactive mode (asks for confirmation before each step)
php artisan atom:check --fix
# Auto mode (fixes everything automatically without asking)
php artisan atom:check --auto
# Fix gamedata symlinks for optimal client performance
php artisan atom:fix-gamedata-symlinks
```
---
## 🎯 Features
### 📻 Radio Station
### Radio Station
- DJ applications & rank system - DJ applications & rank system
- Live DJ sessions with schedule/rooster - Live DJ sessions with schedule
- Song requests & voting - Song requests & voting
- Shoutbox - Shoutbox
- Listener points & leaderboard - Listener points & leaderboard
- Contests & giveaways - Contests & giveaways
- Radio banners & history - Radio banners & history
### 🛒 Shop ### Shop
- Product catalog with categories - Product catalog with categories
- Virtual currency purchases - Virtual currency purchases
- Voucher/promo codes - Voucher/promo codes
- PayPal integration - PayPal integration
- Order history - Order history
### 👥 Community ### Community
- Articles with comments, reactions & tags - Articles with comments, reactions & tags
- Photo gallery - Photo gallery
- Leaderboard - Leaderboard
@@ -61,34 +43,29 @@ php artisan atom:fix-gamedata-symlinks
- Rare values tracker - Rare values tracker
- Badge draw/lottery system - Badge draw/lottery system
### 🎮 Hotel Client ### Hotel Client
- Nitro (HTML5) client support - Nitro (HTML5) client support
- Flash client support - Flash client support
- FindRetros integration - FindRetros integration
- VPN/proxy checker - VPN/proxy checker
### 👤 User System ### User System
- Public profiles with guestbook - Public profiles with guestbook
- Two-Factor Authentication (2FA) - Two-Factor Authentication (2FA)
- Referral system with rewards - Referral system with rewards
- Account & password settings - Account & password settings
- Session logs - Session logs
### 🎫 Help Center ### Help Center
- Support ticket system with replies & status management - Support ticket system with replies & status management
- Website rules - Website rules
- FAQ with categories - FAQ with categories
### 🎨 Themes ### Themes
- **Atom** — Default light theme
- **Atom** — Default theme
- **Dusk** — Dark theme - **Dusk** — Dark theme
### 🔧 Filament Admin Panel ### Filament Admin Panel
- User & ban management - User & ban management
- Radio management (applications, schedules, ranks, shouts, history, banners) - Radio management (applications, schedules, ranks, shouts, history, banners)
- Shop & order management with charts - Shop & order management with charts
@@ -100,8 +77,7 @@ php artisan atom:fix-gamedata-symlinks
- Website navigation & settings - Website navigation & settings
- Camera/photo management - Camera/photo management
### 🌐 API Endpoints ### API Endpoints
- `GET /api/user/{username}` — Fetch user data - `GET /api/user/{username}` — Fetch user data
- `GET /api/online-users` — Online users list - `GET /api/online-users` — Online users list
- `GET /api/online-count` — Online user count - `GET /api/online-count` — Online user count
@@ -114,64 +90,236 @@ php artisan atom:fix-gamedata-symlinks
--- ---
## 🚀 Master Repair Tool ## Requirements
The `atom:check` command performs over **100 deep system checks** and offers to fix them automatically. | Component | Requirement |
| ------------- | ------------------------------- |
### Diagnostic Checks | **PHP** | 8.1 or higher |
| **Database** | MariaDB 10.6+ or MySQL 8.0+ |
| Section | What it Checks | | **Web Server**| Apache (mod_rewrite) or Nginx |
| --------------- | ------------------------------------------------------------ | | **Node.js** | 20 or higher |
| **Environment** | .env, APP_KEY, Debug mode, Composer security | | **Yarn** | 1.22+ or 4.x (Berry) |
| **Database** | Tables, columns, migrations, seeders, settings, radio, admin | | **Composer** | 2.x |
| **PHP Stack** | Extensions, PHP.ini, config cache, session |
| **Web Server** | Apache/Nginx/IIS config, SSL |
| **System** | Permissions, firewall ports |
| **Assets** | Frontend, Redis, Cron, Queue, Supervisor, Vite |
| **HTTP Errors** | 400, 401, 403, 404, 419, 429, 500, 502, 503, 504 |
### Auto-Fix Steps
| Step | Action |
| ---- | ----------------------------------- |
| 1 | Environment (.env, APP_KEY) |
| 2 | Clear all caches |
| 3 | Fix permissions |
| 4 | Run migrations |
| 5 | Run seeders |
| 6 | Fix storage (symlink, directories) |
| 6b | Fix Radio tables |
| 7 | Fix Gamedata symlinks |
| 8 | Create admin user |
| 9 | Web server config (.htaccess, etc.) |
| 10 | PHP config & extensions |
| 11 | Build assets (npm) |
| 12 | Fix HTTP errors |
### Platform Support
Auto-detects: **Linux, Windows IIS, XAMPP, WAMP, Apache, Nginx**
--- ---
## 📥 Installation ## Installation
### Linux (Ubuntu / Debian)
```bash ```bash
# 1. Clone # 1. System dependencies
git clone https://github.com/your-repo/atomcms.git sudo apt update
cd atomcms sudo apt install -y git curl wget unzip nginx mariadb-server \
php8.3 php8.3-cli php8.3-fpm php8.3-mysql php8.3-xml \
php8.3-mbstring php8.3-curl php8.3-zip php8.3-bcmath \
php8.3-gd php8.3-sockets php8.3-intl
# 2. Install dependencies # 2. Install Composer
composer install curl -sS https://getcomposer.org/installer | php
npm install sudo mv composer.phar /usr/local/bin/composer
# 3. Run the repair tool # 3. Install Node.js & Yarn
php artisan atom:check --fix curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash -
sudo apt install -y nodejs
sudo corepack enable
corepack install -g yarn@latest
# 4. Clone the project
git clone https://gitlab.epicnabbo.nl/RemcoEpic/atomcms-edit.git /var/www/atomcms
cd /var/www/atomcms
# 5. Configure environment
cp .env.example .env
php artisan key:generate
# Edit .env with your database credentials:
# DB_DATABASE=habbo
# DB_USERNAME=root
# DB_PASSWORD=yourpassword
# 6. Install PHP dependencies
composer install --no-dev --optimize-autoloader
# 7. Install frontend dependencies
yarn install
# 8. Create database
mysql -u root -p -e "CREATE DATABASE IF NOT EXISTS habbo CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;"
# 9. Run migrations & seeders (or use the auto-repair tool)
php artisan migrate --seed
# Or use the interactive repair tool:
# php artisan atom:check --fix
# 10. Build frontend assets
yarn build:all
# 11. Set permissions
sudo chown -R www-data:www-data storage bootstrap/cache public/build
sudo chmod -R 775 storage bootstrap/cache
# 12. Configure web server
# --- Nginx ---
sudo nano /etc/nginx/sites-available/atomcms
```
server {
listen 80;
server_name your-domain.com;
root /var/www/atomcms/public;
add_header X-Frame-Options "SAMEORIGIN";
add_header X-Content-Type-Options "nosniff";
index index.php;
charset utf-8;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
error_page 404 /index.php;
location ~ \.php$ {
fastcgi_pass unix:/var/run/php/php8.3-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.(?!well-known).* {
deny all;
}
}
```
```bash
sudo ln -sf /etc/nginx/sites-available/atomcms /etc/nginx/sites-enabled/
sudo nginx -t && sudo systemctl reload nginx
# --- Apache ---
sudo a2enmod rewrite
sudo nano /etc/apache2/sites-available/atomcms.conf
```
<VirtualHost *:80>
ServerName your-domain.com
DocumentRoot /var/www/atomcms/public
<Directory /var/www/atomcms/public>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/atomcms-error.log
CustomLog ${APACHE_LOG_DIR}/atomcms-access.log combined
</VirtualHost>
```
```bash
sudo a2ensite atomcms
sudo systemctl reload apache2
```
# 13. Restart PHP-FPM to clear opcache
sudo systemctl restart php8.3-fpm
# 14. Visit http://your-domain.com in your browser
``` ```
--- ---
## 🛠️ Usage ### Windows (XAMPP / WampServer)
#### Prerequisites
- [XAMPP](https://www.apachefriends.org/) (PHP 8.1+, Apache, MariaDB) or [WampServer](https://www.wampserver.com/)
- [Node.js](https://nodejs.org/) (20 LTS or higher)
- [Yarn](https://yarnpkg.com/getting-started/install) (`npm install -g yarn` after Node.js)
- [Composer](https://getcomposer.org/download/) (Windows installer)
- [Git for Windows](https://git-scm.com/download/win)
#### Steps
```powershell
# 1. Open PowerShell or CMD as Administrator
# 2. Clone the project
git clone https://gitlab.epicnabbo.nl/RemcoEpic/atomcms-edit.git C:\xampp\htdocs\atomcms
cd C:\xampp\htdocs\atomcms
# 3. Configure environment
copy .env.example .env
php artisan key:generate
# Edit .env with your XAMPP database credentials:
# DB_CONNECTION=mariadb
# DB_HOST=localhost
# DB_PORT=3306
# DB_DATABASE=habbo
# DB_USERNAME=root
# DB_PASSWORD=
# 4. Start XAMPP services
# Open XAMPP Control Panel → Start Apache & MySQL
# 5. Create database
# Open phpMyAdmin (http://localhost/phpmyadmin)
# → New → Database name: habbo → Charset: utf8mb4_unicode_ci → Create
# 6. Install PHP dependencies
composer install --no-dev --optimize-autoloader
# 7. Install frontend dependencies
yarn install
# 8. Run migrations & seeders
php artisan migrate --seed
# Or use the interactive repair tool:
# php artisan atom:check --fix
# 9. Build frontend assets
yarn build:all
# 10. Set permissions (required for storage & cache)
# Right-click storage\ and bootstrap\cache\ folders
# → Properties → Security → Edit → Add "Everyone" → Full Control
# Or run in PowerShell as Admin:
icacls storage /grant Everyone:F /T
icacls bootstrap/cache /grant Everyone:F /T
icacls public/build /grant Everyone:F /T
# 11. Enable Apache mod_rewrite
# Open XAMPP Control Panel → Apache → Config → httpd.conf
# Uncomment: LoadModule rewrite_module modules/mod_rewrite.so
# 12. Visit http://localhost/atomcms/public in your browser
```
> **Note:** If you use IIS on Windows, the repair tool supports auto-detection:
> `php artisan atom:check --fix`
---
## Quick Start (Repair Tool)
```bash
# Interactive mode (asks for confirmation before each step)
php artisan atom:check --fix
# Auto mode (fixes everything automatically without asking)
php artisan atom:check --auto
# Force platform detection
php artisan atom:check --platform=nginx
# Dutch language output
php artisan atom:check --fix --lang=nl
```
---
## Commands
```bash ```bash
# Check only (no changes) # Check only (no changes)
@@ -183,80 +331,43 @@ php artisan atom:check --fix
# Automatic fix (no questions) # Automatic fix (no questions)
php artisan atom:check --auto php artisan atom:check --auto
# Force platform detection
php artisan atom:check --platform=nginx
# Dutch language
php artisan atom:check --fix --lang=nl
# Fix gamedata symlinks for bundled assets # Fix gamedata symlinks for bundled assets
php artisan atom:fix-gamedata-symlinks php artisan atom:fix-gamedata-symlinks
# Preview what symlinks would be created (dry-run) # Preview symlinks (dry-run)
php artisan atom:fix-gamedata-symlinks --dry-run php artisan atom:fix-gamedata-symlinks --dry-run
``` ```
---
## ⚡ Performance Optimization
### Gamedata Symlinks
The `atom:fix-gamedata-symlinks` command creates symlinks in the Gamedata directory to point to optimized bundled assets. This significantly improves load times for the game client.
| Symlink | Target | Purpose |
| ---------------- | ------------------- | --------------------- |
| `effect` | `bundled/effect` | Avatar effects |
| `furniture` | `bundled/furniture` | Furniture assets |
| `generic` | `bundled/generic` | Generic assets |
| `pet` | `bundled/pet` | Pet assets |
| `figure` | `bundled/figure` | Avatar figures |
| `generic_custom` | `bundled/generic` | Custom generic assets |
### Recommended Nginx Optimizations
The following optimizations are already configured:
- `sendfile on` - Kernel-level file serving
- `open_file_cache` - File descriptor caching
- `gzip` - Automatic compression for JSON/JS/CSS
---
## 🧑‍💻 Developer Tools
### Yarn Scripts ### Yarn Scripts
```bash ```bash
# Build # Build all themes
yarn build # Build all themes yarn build:all
yarn build:atom # Build atom theme only
yarn build:dusk # Build dusk theme only # Build single theme
yarn build:all # Build both themes yarn build:atom # Atom theme
yarn build:dusk # Dusk theme
# Development # Development
yarn dev # Start dev server yarn dev # Start Vite dev server
yarn dev:atom # Dev server atom theme yarn dev:atom # Dev server for Atom theme
# Code Quality # Linting & Formatting
yarn lint # Check JS/Vue yarn lint # Check JS/Vue
yarn lint:fix # Fix JS/Vue yarn lint:fix # Fix JS/Vue
yarn lint:css # Check CSS yarn lint:css # Check CSS
yarn lint:css:fix # Fix CSS yarn lint:css:fix # Fix CSS
yarn lint:all # Check everything
yarn lint:fix:all # Fix everything
yarn format # Format everything yarn format # Format everything
yarn format:check # Check formatting yarn format:check # Check formatting
# Check # Full check
yarn check # Full check yarn check # Lint + format check
yarn check:php # Check PHP syntax yarn check:php # PHP syntax check
yarn check:security # Check security yarn check:security # Composer & npm audit
yarn check:deps # Check outdated packages yarn check:deps # Check outdated packages
# Cache # Cache
yarn clean # Clear cache yarn clean # Clear Vite cache
yarn rebuild # Clean + install + build yarn rebuild # Clean + install + build
``` ```
@@ -266,9 +377,6 @@ yarn rebuild # Clean + install + build
# Auto-fix code style # Auto-fix code style
php artisan atom:fix-code php artisan atom:fix-code
# Fix gamedata symlinks (run after installing client assets)
php artisan atom:fix-gamedata-symlinks
# Static analysis (PHPStan Level 3) # Static analysis (PHPStan Level 3)
./vendor/bin/phpstan analyse ./vendor/bin/phpstan analyse
@@ -278,48 +386,95 @@ yarn build:dusk
# Development mode # Development mode
yarn dev:atom yarn dev:atom
yarn dev:dusk
# Format code
yarn format
``` ```
--- ---
## ⚡ Performance Optimizations ## Repair Tool Details
This CMS is fully optimized: The `atom:check` command performs over **100 deep system checks** and offers to fix them automatically.
### Diagnostic Checks
| Section | What it Checks |
| ------------- | ------------------------------------------------------------- |
| **Environment** | .env, APP_KEY, Debug mode, Composer security |
| **Database** | Tables, columns, migrations, seeders, settings, radio, admin |
| **PHP Stack** | Extensions, php.ini, config cache, session |
| **Web Server**| Apache/Nginx/IIS config, SSL |
| **System** | Permissions, firewall ports |
| **Assets** | Frontend, Redis, Cron, Queue, Supervisor, Vite |
| **HTTP Errors** | 400, 401, 403, 404, 419, 429, 500, 502, 503, 504 |
### Auto-Fix Steps
| Step | Action |
| ---- | ---------------------------------- |
| 1 | Environment (.env, APP_KEY) |
| 2 | Clear all caches |
| 3 | Fix permissions |
| 4 | Run migrations |
| 5 | Run seeders |
| 6 | Fix storage (symlink, directories) |
| 6b | Fix Radio tables |
| 7 | Fix Gamedata symlinks |
| 8 | Create admin user |
| 9 | Web server config (.htaccess) |
| 10 | PHP config & extensions |
| 11 | Build assets (npm) |
| 12 | Fix HTTP errors |
Auto-detects: **Linux, Windows IIS, XAMPP, WAMP, Apache, Nginx**
---
## Performance Optimizations
| Optimization | Description | | Optimization | Description |
| ---------------------- | --------------------------------- | | ------------------- | -------------------------------- |
| **Vite 8** | Fastest build tool | | **Vite 8** | Fastest build tool |
| **esbuild** | Faster minification | | **esbuild** | Faster minification |
| **Better chunking** | Optimal code splitting | | **Better chunking** | Optimal code splitting |
| **Gzip + Brotli** | Compression (~70% smaller) | | **Gzip + Brotli** | Compression (~70% smaller) |
| **Resource hints** | DNS prefetch, preconnect, preload | | **Resource hints** | DNS prefetch, preconnect, preload|
| **HTTP/2** | Faster network requests | | **HTTP/2** | Faster network requests |
| **Console removed** | Smaller JS bundles | | **Console removed** | Smaller JS bundles |
| **Caching** | Vite cache + optimizedeps | | **Caching** | Vite cache + optimizedeps |
### Gamedata Symlinks
The `atom:fix-gamedata-symlinks` command creates symlinks in the Gamedata directory to point to optimized bundled assets, significantly improving game client load times.
| Symlink | Target | Purpose |
| ---------------- | ------------------- | ---------------- |
| `effect` | `bundled/effect` | Avatar effects |
| `furniture` | `bundled/furniture` | Furniture assets |
| `generic` | `bundled/generic` | Generic assets |
| `pet` | `bundled/pet` | Pet assets |
| `figure` | `bundled/figure` | Avatar figures |
| `generic_custom` | `bundled/generic` | Custom generic |
--- ---
## 📦 Tech Stack ## Tech Stack
- **Backend:** Laravel 13 - **Backend:** Laravel 13
- **Frontend:** React 19 + Alpine.js - **Frontend:** React 19 + Alpine.js
- **Build:** Vite 8 - **Build:** Vite 8
- **CSS:** TailwindCSS 4 - **CSS:** TailwindCSS 4
- **Admin Panel:** Filament 5
- **Database:** MariaDB / MySQL
- **Linting:** ESLint + Stylelint + Prettier - **Linting:** ESLint + Stylelint + Prettier
--- ---
## 🤝 Credits ## Credits
- **Remco (Epicnabbo)** - Core Maintainer, System Architecture - **Remco (Epicnabbo)** Core Maintainer, System Architecture
- **Kasja** - Design & Themes - **Kasja** Design & Themes
- **Kani** - RCON & API - **Kani** RCON & API
- **Atom Community** - Testing & Feedback - **Atom Community** Testing & Feedback
<div align="center"> <div align="center">
<i>Made with ❤️ for the Retro Community</i> <i>Made with love for the Retro Community</i>
</div> </div>
+288
View File
@@ -0,0 +1,288 @@
#!/usr/bin/env bash
set -euo pipefail
REPO_URL="https://gitlab.epicnabbo.nl/RemcoEpic/atomcms-edit.git"
INSTALL_DIR="/var/www/atomcms"
DB_NAME="habbo"
DB_USER="root"
DB_PASS=""
MAGENTA='\033[0;35m'
CYAN='\033[0;36m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
RED='\033[0;31m'
NC='\033[0m'
log() { echo -e "${MAGENTA}[AtomCMS]${NC} $1"; }
ok() { echo -e "${GREEN}[ OK ]${NC} $1"; }
info() { echo -e "${CYAN}[ INFO ]${NC} $1"; }
warn() { echo -e "${YELLOW}[ WARN ]${NC} $1"; }
err() { echo -e "${RED}[FAILED]${NC} $1"; exit 1; }
if [[ $EUID -eq 0 ]]; then
SUDO=""
else
SUDO="sudo"
warn "Not running as root. I'll use sudo where needed."
fi
detect_distro() {
if [ -f /etc/os-release ]; then
. /etc/os-release
OS=$ID
OS_VER=$VERSION_ID
else
err "Cannot detect OS. Only Ubuntu/Debian are supported."
fi
}
install_deps_debian() {
log "Installing system dependencies..."
$SUDO apt update
$SUDO apt install -y curl wget git unzip nginx mariadb-server \
php8.3 php8.3-cli php8.3-fpm php8.3-mysql php8.3-xml \
php8.3-mbstring php8.3-curl php8.3-zip php8.3-bcmath \
php8.3-gd php8.3-sockets php8.3-intl
ok "System dependencies installed"
}
install_deps_ubuntu() {
install_deps_debian
}
install_composer() {
if command -v composer &>/dev/null; then
ok "Composer already installed"
return
fi
log "Installing Composer..."
EXPECTED_CHECKSUM="$(php -r 'copy("https://composer.github.io/installer.sig", "php://stdout");')"
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
ACTUAL_CHECKSUM="$(php -r "echo hash_file('sha384', 'composer-setup.php');")"
if [ "$EXPECTED_CHECKSUM" != "$ACTUAL_CHECKSUM" ]; then
rm composer-setup.php
err "Composer installer checksum mismatch"
fi
php composer-setup.php --quiet
rm composer-setup.php
$SUDO mv composer.phar /usr/local/bin/composer
ok "Composer installed"
}
install_node_yarn() {
if command -v node &>/dev/null && command -v yarn &>/dev/null; then
ok "Node.js and Yarn already installed"
return
fi
log "Installing Node.js and Yarn..."
curl -fsSL https://deb.nodesource.com/setup_22.x | $SUDO bash -
$SUDO apt install -y nodejs
$SUDO corepack enable
$SUDO corepack install -g yarn@latest
ok "Node.js $(node -v) and Yarn $(yarn -v) installed"
}
setup_database() {
log "Setting up MariaDB/MySQL..."
$SUDO systemctl enable --now mariadb 2>/dev/null || true
$SUDO mysql -u root -e "CREATE DATABASE IF NOT EXISTS \`$DB_NAME\` CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;" 2>/dev/null || true
ok "Database '$DB_NAME' ready"
}
clone_project() {
if [ -d "$INSTALL_DIR" ] && [ -f "$INSTALL_DIR/artisan" ]; then
ok "Project already cloned at $INSTALL_DIR"
return
fi
log "Cloning project..."
$SUDO mkdir -p "$(dirname "$INSTALL_DIR")"
git clone "$REPO_URL" "$INSTALL_DIR"
ok "Project cloned to $INSTALL_DIR"
}
configure_env() {
log "Configuring environment..."
cd "$INSTALL_DIR"
if [ ! -f .env ]; then
cp .env.example .env
read -rp "Database password (leave empty for root without password): " DB_PASS
sed -i "s/DB_DATABASE=.*/DB_DATABASE=$DB_NAME/" .env
sed -i "s/DB_USERNAME=.*/DB_USERNAME=$DB_USER/" .env
sed -i "s/DB_PASSWORD=.*/DB_PASSWORD=$DB_PASS/" .env
php artisan key:generate --quiet
ok ".env configured and APP_KEY generated"
else
info ".env already exists, skipping"
fi
}
install_php_deps() {
log "Installing PHP dependencies..."
cd "$INSTALL_DIR"
composer install --no-interaction --optimize-autoloader --no-dev
ok "PHP dependencies installed"
}
install_node_deps() {
log "Installing Node dependencies..."
cd "$INSTALL_DIR"
yarn install --frozen-lockfile
ok "Node dependencies installed"
}
run_migrations() {
log "Running migrations and seeders..."
cd "$INSTALL_DIR"
php artisan migrate --seed --force || true
ok "Migrations and seeders complete"
}
build_assets() {
log "Building frontend assets..."
cd "$INSTALL_DIR"
yarn build:all
ok "Frontend assets built"
}
set_permissions() {
log "Setting filesystem permissions..."
cd "$INSTALL_DIR"
$SUDO chown -R www-data:www-data storage bootstrap/cache public/build 2>/dev/null || true
$SUDO chmod -R 775 storage bootstrap/cache
ok "Permissions set"
}
configure_nginx() {
log "Configuring Nginx..."
read -rp "Enter your domain name (e.g. example.com or localhost): " DOMAIN
$SUDO tee /etc/nginx/sites-available/atomcms > /dev/null <<EOF
server {
listen 80;
server_name $DOMAIN;
root $INSTALL_DIR/public;
add_header X-Frame-Options "SAMEORIGIN";
add_header X-Content-Type-Options "nosniff";
index index.php;
charset utf-8;
location / {
try_files \$uri \$uri/ /index.php?\$query_string;
}
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
error_page 404 /index.php;
location ~ \.php\$ {
fastcgi_pass unix:/var/run/php/php8.3-fpm.sock;
fastcgi_param SCRIPT_FILENAME \$document_root\$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.(?!well-known).* {
deny all;
}
}
EOF
if [ -f /etc/nginx/sites-enabled/default ]; then
$SUDO rm /etc/nginx/sites-enabled/default
fi
$SUDO ln -sf /etc/nginx/sites-available/atomcms /etc/nginx/sites-enabled/
$SUDO nginx -t || err "Nginx config test failed"
$SUDO systemctl reload nginx
ok "Nginx configured for $DOMAIN"
}
configure_apache() {
log "Configuring Apache..."
read -rp "Enter your domain name (e.g. example.com or localhost): " DOMAIN
$SUDO a2enmod rewrite
$SUDO tee /etc/apache2/sites-available/atomcms.conf > /dev/null <<EOF
<VirtualHost *:80>
ServerName $DOMAIN
DocumentRoot $INSTALL_DIR/public
<Directory $INSTALL_DIR/public>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog \${APACHE_LOG_DIR}/atomcms-error.log
CustomLog \${APACHE_LOG_DIR}/atomcms-access.log combined
</VirtualHost>
EOF
$SUDO a2ensite atomcms.conf || true
$SUDO a2dissite 000-default.conf || true
$SUDO systemctl reload apache2
ok "Apache configured for $DOMAIN"
}
setup_finalize() {
log "Finalizing installation..."
cd "$INSTALL_DIR"
php artisan storage:link --force 2>/dev/null || true
php artisan optimize:clear 2>/dev/null || true
$SUDO systemctl restart php8.3-fpm 2>/dev/null || true
ok "Installation complete!"
}
main() {
echo ""
echo -e "${MAGENTA}╔══════════════════════════════════════╗${NC}"
echo -e "${MAGENTA}║ AtomCMS Auto Installer (Linux) ║${NC}"
echo -e "${MAGENTA}╚══════════════════════════════════════╝${NC}"
echo ""
detect_distro
echo -e "Detected: ${CYAN}$OS $OS_VER${NC}"
echo ""
case "$OS" in
ubuntu) install_deps_ubuntu ;;
debian) install_deps_debian ;;
*) err "Unsupported distro: $OS. Only Ubuntu/Debian are supported." ;;
esac
install_composer
install_node_yarn
clone_project
configure_env
install_php_deps
install_node_deps
setup_database
run_migrations
build_assets
set_permissions
echo ""
info "Select web server:"
echo "1) Nginx (recommended)"
echo "2) Apache"
read -rp "Choice [1]: " WS_CHOICE
case "${WS_CHOICE:-1}" in
2) configure_apache ;;
*) configure_nginx ;;
esac
setup_finalize
echo ""
echo -e "${GREEN}╔══════════════════════════════════════════════════════════════╗${NC}"
echo -e "${GREEN}║ AtomCMS is ready! ║${NC}"
echo -e "${GREEN}║ ║${NC}"
echo -e "${GREEN}║ Visit: http://$DOMAIN${NC}"
echo -e "${GREEN}║ Admin: http://$DOMAIN/admin ║${NC}"
echo -e "${GREEN}║ ║${NC}"
echo -e "${GREEN}║ Run the repair tool for extra checks: ║${NC}"
echo -e "${GREEN}║ php artisan atom:check --fix ║${NC}"
echo -e "${GREEN}╚══════════════════════════════════════════════════════════════╝${NC}"
echo ""
}
main
+397
View File
@@ -0,0 +1,397 @@
<#
.SYNOPSIS
AtomCMS Auto Installer for Windows (XAMPP / WampServer)
.DESCRIPTION
Automates the full installation of AtomCMS on Windows.
Supports XAMPP and WampServer environments.
#>
$ErrorActionPreference = "Stop"
$Host.UI.RawUI.WindowTitle = "AtomCMS Installer"
$REPO_URL = "https://gitlab.epicnabbo.nl/RemcoEpic/atomcms-edit.git"
$DB_NAME = "habbo"
$DB_USER = "root"
$DB_PASS = ""
function Write-Logo {
Write-Host "╔══════════════════════════════════════════╗" -ForegroundColor Magenta
Write-Host "║ AtomCMS Auto Installer (Windows) ║" -ForegroundColor Magenta
Write-Host "╚══════════════════════════════════════════╝" -ForegroundColor Magenta
Write-Host ""
}
function Write-Step {
param([string]$Message)
Write-Host "[AtomCMS] $Message" -ForegroundColor Magenta
}
function Write-OK {
param([string]$Message)
Write-Host "[ OK ] $Message" -ForegroundColor Green
}
function Write-Info {
param([string]$Message)
Write-Host "[ INFO ] $Message" -ForegroundColor Cyan
}
function Write-Warn {
param([string]$Message)
Write-Host "[ WARN ] $Message" -ForegroundColor Yellow
}
function Write-Error {
param([string]$Message)
Write-Host "[FAILED] $Message" -ForegroundColor Red
exit 1
}
function Test-Admin {
$identity = [Security.Principal.WindowsIdentity]::GetCurrent()
$principal = New-Object Security.Principal.WindowsPrincipal($identity)
if (-not $principal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
Write-Warn "Not running as Administrator. Some operations may fail."
$continue = Read-Host "Continue anyway? (y/N)"
if ($continue -ne "y") { exit 1 }
}
}
function Find-Xampp {
$paths = @(
"C:\xampp",
"D:\xampp",
"E:\xampp",
"${env:ProgramFiles}\XAMPP",
"${env:ProgramFiles(x86)}\XAMPP"
)
foreach ($p in $paths) {
if (Test-Path "$p\php\php.exe") { return $p }
}
return $null
}
function Find-Wamp {
$paths = @(
"C:\wamp64",
"C:\wamp",
"D:\wamp64",
"D:\wamp"
)
foreach ($p in $paths) {
if (Test-Path "$p\bin\php\php8.?.?\php.exe") { return $p }
if (Test-Path "$p\bin\php\php8.??\php.exe") { return $p }
}
return $null
}
function Find-PHP {
$php = Get-Command "php.exe" -ErrorAction SilentlyContinue
if ($php) { return Split-Path $php.Source -Parent }
$xampp = Find-Xampp
if ($xampp) { return "$xampp\php" }
$wamp = Find-Wamp
if ($wamp) {
$phpDirs = Get-ChildItem "$wamp\bin\php" -Filter "php8*" -Directory | Sort-Object Name -Descending
if ($phpDirs.Count -gt 0) { return $phpDirs[0].FullName }
}
return $null
}
function Find-MySQL {
$mysql = Get-Command "mysql.exe" -ErrorAction SilentlyContinue
if ($mysql) { return Split-Path $mysql.Source -Parent }
$xampp = Find-Xampp
if ($xampp -and (Test-Path "$xampp\mysql\bin\mysql.exe")) { return "$xampp\mysql\bin" }
$wamp = Find-Wamp
if ($wamp -and (Test-Path "$wamp\bin\mariadb\*\bin\mysql.exe")) {
$dirs = Get-ChildItem "$wamp\bin\mariadb" -Directory | Sort-Object Name -Descending
if ($dirs.Count -gt 0) { return "$($dirs[0].FullName)\bin" }
}
return $null
}
function Find-Apache {
$xampp = Find-Xampp
if ($xampp -and (Test-Path "$xampp\apache\bin\httpd.exe")) { return "$xampp\apache" }
$wamp = Find-Wamp
if ($wamp -and (Test-Path "$wamp\bin\apache\*\bin\httpd.exe")) {
$dirs = Get-ChildItem "$wamp\bin\apache" -Directory | Sort-Object Name -Descending
if ($dirs.Count -gt 0) { return $dirs[0].FullName }
}
return $null
}
function Ensure-Tool {
param([string]$Name, [string]$CheckCommand, [string]$Url, [string]$InstallHint)
$found = Get-Command $CheckCommand -ErrorAction SilentlyContinue
if ($found) {
Write-OK "$Name is installed"
return $true
}
Write-Warn "$Name is not found."
if ($Url) {
Write-Info "Download from: $Url"
}
if ($InstallHint) {
Write-Info "$InstallHint"
}
return $false
}
function Install-Composer {
if (Get-Command "composer" -ErrorAction SilentlyContinue) {
Write-OK "Composer already installed"
return
}
Write-Step "Installing Composer..."
$installer = "$env:TEMP\composer-setup.php"
Invoke-WebRequest -Uri "https://getcomposer.org/installer" -OutFile $installer
php $installer --quiet --install-dir="$env:USERPROFILE\bin"
php -r "unlink('$installer');"
$env:Path += ";$env:USERPROFILE\bin"
[Environment]::SetEnvironmentVariable("Path", [Environment]::GetEnvironmentVariable("Path", "User") + ";$env:USERPROFILE\bin", "User")
Write-OK "Composer installed. You may need to restart your terminal."
}
function Clone-Project {
param([string]$TargetDir)
if (Test-Path "$TargetDir\artisan") {
Write-OK "Project already cloned at $TargetDir"
return $TargetDir
}
if (-not (Get-Command "git" -ErrorAction SilentlyContinue)) {
Write-Error "Git is not installed. Install Git for Windows: https://git-scm.com/download/win"
}
Write-Step "Cloning project..."
git clone $REPO_URL $TargetDir
Write-OK "Project cloned to $TargetDir"
return $TargetDir
}
function Configure-Env {
param([string]$ProjectDir)
Write-Step "Configuring environment..."
$envFile = "$ProjectDir\.env"
if (Test-Path $envFile) {
Write-Info ".env already exists, skipping"
return
}
Copy-Item "$ProjectDir\.env.example" $envFile
$dbPass = Read-Host "Database password (leave empty for root without password)"
(Get-Content $envFile) -replace 'DB_DATABASE=.*', "DB_DATABASE=$DB_NAME" | Set-Content $envFile
(Get-Content $envFile) -replace 'DB_USERNAME=.*', "DB_USERNAME=$DB_USER" | Set-Content $envFile
(Get-Content $envFile) -replace 'DB_PASSWORD=.*', "DB_PASSWORD=$dbPass" | Set-Content $envFile
Push-Location $ProjectDir
php artisan key:generate --quiet
Pop-Location
Write-OK ".env configured and APP_KEY generated"
}
function Create-Database {
param([string]$MySQLDir)
Write-Step "Creating database '$DB_NAME'..."
$mysqlExe = if ($MySQLDir) { "$MySQLDir\mysql.exe" } else { "mysql.exe" }
if ($DB_PASS) {
& $mysqlExe -u $DB_USER -p$DB_PASS -e "CREATE DATABASE IF NOT EXISTS `$DB_NAME` CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;" 2>$null
} else {
& $mysqlExe -u $DB_USER -e "CREATE DATABASE IF NOT EXISTS `$DB_NAME` CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;" 2>$null
}
if ($LASTEXITCODE -eq 0) {
Write-OK "Database '$DB_NAME' ready"
} else {
Write-Warn "Could not create database automatically."
Write-Info "Open phpMyAdmin (http://localhost/phpmyadmin) and create a database named '$DB_NAME' with charset utf8mb4_unicode_ci."
Read-Host "Press Enter after creating the database"
}
}
function Run-Migrations {
param([string]$ProjectDir)
Write-Step "Running migrations and seeders..."
Push-Location $ProjectDir
php artisan migrate --seed --force
Pop-Location
Write-OK "Migrations and seeders complete"
}
function Build-Assets {
param([string]$ProjectDir)
Write-Step "Building frontend assets..."
Push-Location $ProjectDir
yarn build:all
Pop-Location
Write-OK "Frontend assets built"
}
function Set-Permissions {
param([string]$ProjectDir)
Write-Step "Setting permissions..."
$folders = @("$ProjectDir\storage", "$ProjectDir\bootstrap\cache")
foreach ($folder in $folders) {
if (Test-Path $folder) {
try {
icacls $folder /grant "Everyone:F" /T /Q 2>$null
} catch {
Write-Warn "Could not set permissions on $folder. You may need to do this manually."
}
}
}
Write-OK "Permissions set"
}
function Configure-Apache {
param([string]$ApacheDir, [string]$ProjectDir)
Write-Step "Configuring Apache virtual host..."
$domain = Read-Host "Enter your domain name (e.g. localhost)"
$publicDir = "$ProjectDir\public".Replace("\", "/")
$vhost = @"
<VirtualHost *:80>
ServerName $domain
DocumentRoot "$publicDir"
<Directory "$publicDir">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog logs/atomcms-error.log
CustomLog logs/atomcms-access.log combined
</VirtualHost>
"@
if ($ApacheDir) {
$confFile = "$ApacheDir\conf\extra\httpd-vhosts.conf"
Add-Content -Path $confFile -Value "`n$vhost" -ErrorAction SilentlyContinue
Write-OK "Virtual host added to $confFile"
Write-Info "Make sure these lines are uncommented in httpd.conf:"
Write-Info " Include conf/extra/httpd-vhosts.conf"
Write-Info " LoadModule rewrite_module modules/mod_rewrite.so"
} else {
Write-Warn "Apache directory not found. Add this virtual host manually:"
Write-Host $vhost -ForegroundColor Gray
}
}
function Show-Summary {
param([string]$Domain)
Write-Host ""
Write-Host "╔══════════════════════════════════════════════════════════════╗" -ForegroundColor Green
Write-Host "║ AtomCMS is ready! ║" -ForegroundColor Green
Write-Host "║ ║" -ForegroundColor Green
Write-Host "║ Visit: http://$Domain" -ForegroundColor Green
Write-Host "║ Admin: http://$Domain/admin ║" -ForegroundColor Green
Write-Host "║ ║" -ForegroundColor Green
Write-Host "║ Run the repair tool for extra checks: ║" -ForegroundColor Green
Write-Host "║ php artisan atom:check --fix ║" -ForegroundColor Green
Write-Host "╚══════════════════════════════════════════════════════════════╝" -ForegroundColor Green
Write-Host ""
}
function Main {
Write-Logo
Test-Admin
# Check environment
$phpDir = Find-PHP
$mysqlDir = Find-MySQL
$apacheDir = Find-Apache
if (-not $phpDir) {
Write-Error "PHP not found. Install XAMPP (https://www.apachefriends.org/) or WampServer first."
}
# Add PHP and MySQL to PATH for this session
if ($phpDir) { $env:Path = "$phpDir;$env:Path" }
if ($mysqlDir) { $env:Path = "$mysqlDir;$env:Path" }
Write-OK "PHP found: $((Get-Command php).Source)"
if ($mysqlDir) { Write-OK "MySQL found: $mysqlDir" }
if ($apacheDir) { Write-OK "Apache found: $apacheDir" }
# Ensure required tools
Ensure-Tool -Name "Node.js" -CheckCommand "node" -Url "https://nodejs.org/" -InstallHint "Install Node.js LTS"
$hasYarn = Ensure-Tool -Name "Yarn" -CheckCommand "yarn" -Url "https://yarnpkg.com/getting-started/install" -InstallHint "Run: npm install -g yarn"
Ensure-Tool -Name "Git" -CheckCommand "git" -Url "https://git-scm.com/download/win" -InstallHint "Install Git for Windows"
if (-not $hasYarn) {
Write-Step "Installing Yarn via npm..."
npm install -g yarn
Write-OK "Yarn installed"
}
Install-Composer
# Where to install?
$defaultDir = if (Find-Xampp) { "$(Find-Xampp)\htdocs\atomcms" } else { "$env:USERPROFILE\atomcms" }
$projectDir = Read-Host "Installation directory [$defaultDir]"
if (-not $projectDir) { $projectDir = $defaultDir }
Clone-Project -TargetDir $projectDir
Configure-Env -ProjectDir $projectDir
# Install PHP deps
Write-Step "Installing PHP dependencies..."
Push-Location $projectDir
composer install --no-interaction --optimize-autoloader --no-dev
Pop-Location
Write-OK "PHP dependencies installed"
# Install Node deps
Write-Step "Installing Node dependencies..."
Push-Location $projectDir
yarn install --frozen-lockfile
Pop-Location
Write-OK "Node dependencies installed"
Create-Database -MySQLDir $mysqlDir
Run-Migrations -ProjectDir $projectDir
Build-Assets -ProjectDir $projectDir
Set-Permissions -ProjectDir $projectDir
$configureWeb = Read-Host "Configure Apache virtual host? (y/N)"
if ($configureWeb -eq "y") {
Configure-Apache -ApacheDir $apacheDir -ProjectDir $projectDir
}
# Finalize
Write-Step "Finalizing..."
Push-Location $projectDir
php artisan storage:link --force 2>$null
php artisan optimize:clear 2>$null
Pop-Location
$domain = Read-Host "Enter your domain/path to access the site (e.g. localhost/atomcms/public or your-domain.com)"
Show-Summary -Domain $domain
}
Main