Complete installation instructions for AutoClean in various environments.
- System Requirements
- Local Development Setup
- Production Installation
- Database Setup
- Initial Configuration
- Verification
- Troubleshooting
- PHP: 8.2 or higher
- Database: MySQL 5.7+ or MariaDB 10.3+
- Node.js: 18.x or higher
- Composer: 2.x
- Memory: 512MB RAM
- Disk Space: 500MB
- PHP: 8.3
- Database: MySQL 8.0+ or MariaDB 10.6+
- Node.js: 20.x LTS
- Memory: 1GB RAM
- Disk Space: 2GB
- Cache: Redis (optional but recommended)
php -m | grep -E 'pdo|mysql|mbstring|xml|bcmath|curl|gd|zip|intl'Required extensions:
- PDO
- pdo_mysql
- mbstring
- xml
- bcmath
- curl
- gd
- zip
- intl
- fileinfo
- tokenizer
- json
git clone https://github.com/yourusername/autoclean.git
cd autocleancomposer installThis will install all Laravel and PHP packages defined in composer.json.
npm installThis installs Vite, Tailwind CSS, and other frontend dependencies.
# Copy the example environment file
cp .env.example .env
# Generate application key
php artisan key:generateEdit .env file and set your database credentials:
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=autoclean
DB_USERNAME=your_username
DB_PASSWORD=your_password# Connect to MySQL
mysql -u root -p
# Create database
CREATE DATABASE autoclean CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
EXIT;# Run all migrations
php artisan migrate
# Seed the database with sample data (optional but recommended for development)
php artisan db:seedThe seeder creates:
- Default admin user (admin@example.com / password)
- Sample stations
- Sample tasks and schedules
- Sample inventory items
- Sample time logs
# Development build with hot reload
npm run dev
# Or for a one-time build
npm run buildYou have two options:
Option A: Full Development Stack (Recommended)
composer devThis starts:
- Laravel development server (http://localhost:8000)
- Vite dev server with hot reload
- Queue worker
- Log viewer (Pail)
Option B: Individual Services
# Terminal 1: Laravel server
php artisan serve
# Terminal 2: Vite dev server
npm run dev
# Terminal 3: Queue worker (if using queues)
php artisan queue:listen
# Terminal 4: Log viewer (optional)
php artisan pailOpen your browser and navigate to:
http://localhost:8000
Default Login Credentials (from seeders):
- Email: admin@example.com
- Password: password
-
Server Requirements:
- Ubuntu 22.04 LTS or similar
- Root or sudo access
- Domain name (optional but recommended)
-
Install Required Software:
# Update system
sudo apt update && sudo apt upgrade -y
# Install PHP 8.3 and extensions
sudo apt install -y php8.3 php8.3-cli php8.3-fpm php8.3-mysql \
php8.3-mbstring php8.3-xml php8.3-bcmath php8.3-curl \
php8.3-gd php8.3-zip php8.3-intl php8.3-redis
# Install MySQL
sudo apt install -y mysql-server
# Install Node.js 20
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt install -y nodejs
# Install Composer
curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer
# Install Nginx
sudo apt install -y nginx
# Install Redis (optional)
sudo apt install -y redis-server- Clone and Configure:
cd /var/www
sudo git clone https://github.com/yourusername/autoclean.git
cd autoclean
# Set ownership
sudo chown -R www-data:www-data /var/www/autoclean
sudo chmod -R 755 /var/www/autoclean
sudo chmod -R 775 storage bootstrap/cache- Install Dependencies:
# Install PHP dependencies (no dev packages)
composer install --optimize-autoloader --no-dev
# Install and build JavaScript assets
npm install
npm run build- Configure Environment:
cp .env.example .env
php artisan key:generate
# Edit .env for production
nano .envProduction .env example:
APP_NAME=AutoClean
APP_ENV=production
APP_KEY=base64:generated_key_here
APP_DEBUG=false
APP_URL=https://yourdomain.com
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=autoclean_production
DB_USERNAME=autoclean_user
DB_PASSWORD=secure_password_here
CACHE_DRIVER=redis
QUEUE_CONNECTION=database
SESSION_DRIVER=redis
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_MAILER=smtp
MAIL_HOST=mailhog
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS="noreply@yourdomain.com"
MAIL_FROM_NAME="${APP_NAME}"- Database Setup:
# Create production database
mysql -u root -p
CREATE DATABASE autoclean_production CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'autoclean_user'@'localhost' IDENTIFIED BY 'secure_password_here';
GRANT ALL PRIVILEGES ON autoclean_production.* TO 'autoclean_user'@'localhost';
FLUSH PRIVILEGES;
EXIT;
# Run migrations
php artisan migrate --force
# WARNING: Do NOT run seeders in production!
# Seeders contain test users with weak passwords
# See "Create Admin User" section below instead- Configure Nginx:
# /etc/nginx/sites-available/autoclean
server {
listen 80;
server_name yourdomain.com;
root /var/www/autoclean/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 $realpath_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.(?!well-known).* {
deny all;
}
}Enable site:
sudo ln -s /etc/nginx/sites-available/autoclean /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl reload nginx- Setup Task Scheduler (cron):
# Edit crontab for www-data user
sudo crontab -e -u www-data
# Add this line:
* * * * * cd /var/www/autoclean && php artisan schedule:run >> /dev/null 2>&1- Setup Queue Worker (systemd):
Create /etc/systemd/system/autoclean-queue.service:
[Unit]
Description=AutoClean Queue Worker
After=network.target
[Service]
User=www-data
Group=www-data
Restart=always
ExecStart=/usr/bin/php /var/www/autoclean/artisan queue:work --sleep=3 --tries=3 --max-time=3600
[Install]
WantedBy=multi-user.targetEnable and start:
sudo systemctl daemon-reload
sudo systemctl enable autoclean-queue
sudo systemctl start autoclean-queue- Optimize Application:
php artisan config:cache
php artisan route:cache
php artisan view:cacheRecommended MySQL configuration for production (/etc/mysql/mysql.conf.d/mysqld.cnf):
[mysqld]
character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci
max_connections = 150
innodb_buffer_pool_size = 256MAutoClean uses Laravel migrations for database schema management.
# Check migration status
php artisan migrate:status
# Run pending migrations
php artisan migrate
# Rollback last migration
php artisan migrate:rollback
# Reset database (WARNING: destroys all data)
php artisan migrate:fresh
# Reset and seed
php artisan migrate:fresh --seedIMPORTANT: Never use seeders in production as they contain test users with weak passwords (password).
Method 1: Using Tinker (Recommended for First Admin)
php artisan tinker$user = new App\Models\User();
$user->name = 'Your Name';
$user->email = 'your@email.com';
$user->password = bcrypt('your_strong_password_here');
$user->is_admin = true;
$user->email_verified_at = now();
$user->save();Press Ctrl+D to exit Tinker.
Method 2: One-liner
php artisan tinker --execute="App\Models\User::create(['name' => 'Your Name', 'email' => 'your@email.com', 'password' => bcrypt('your_password'), 'is_admin' => true, 'email_verified_at' => now()]);"Security Best Practices:
- ✅ Use a strong, unique password (16+ characters)
- ✅ Use your real email address
- ✅ Never commit passwords to version control
- ✅ Change password immediately after first login
⚠️ Delete or disable test users created by seeders:# Check for test users php artisan tinker --execute="App\Models\User::whereIn('email', ['admin@autoclean.se', 'employee@autoclean.se'])->get();" # Delete test users (if they exist) php artisan tinker --execute="App\Models\User::whereIn('email', ['admin@autoclean.se', 'employee@autoclean.se'])->delete();"
After logging in as admin:
- Navigate to Settings
- Configure:
- System name
- Clock-in requirements
- Task rollover settings
- Email notifications
# Run tests
php artisan test
# Check application status
php artisan about
# Verify queue is working
php artisan queue:monitor
# Check scheduled tasks
php artisan schedule:list- Login: Verify you can log in with admin credentials
- Create Station: Test creating a new station
- Create Task: Test task creation with recurrence
- Clock In: Test time tracking functionality
- View Reports: Generate and export a time report
# Fix storage and cache permissions
sudo chown -R www-data:www-data storage bootstrap/cache
sudo chmod -R 775 storage bootstrap/cache# Test database connection
php artisan db:show
# Clear config cache
php artisan config:clear# Clear node modules and reinstall
rm -rf node_modules package-lock.json
npm install
npm run build# Check queue status
php artisan queue:monitor
# Restart queue worker
sudo systemctl restart autoclean-queue
# Or manually
php artisan queue:restart
php artisan queue:work# Clear all caches
php artisan cache:clear
php artisan config:clear
php artisan route:clear
php artisan view:clear
# Rebuild caches
php artisan config:cache
php artisan route:cache
php artisan view:cache# Clear Livewire cache
php artisan livewire:clear
# Republish Livewire assets
php artisan livewire:publish --assetsError: "No application encryption key has been specified"
php artisan key:generateError: "SQLSTATE[HY000] [1045] Access denied"
- Check database credentials in
.env - Verify database user has correct permissions
Error: "Class 'PDO' not found"
sudo apt install php8.3-mysql
sudo systemctl restart php8.3-fpmError: "npm ERR! code ELIFECYCLE"
rm -rf node_modules package-lock.json
npm cache clean --force
npm installAfter successful installation:
- Review Configuration Guide
- Read User Guide to understand features
- Check Development Guide if contributing
- Review Deployment Guide for production best practices
Navigation: ← Back to Documentation | Configuration →