Deployment
This page walks you through moving your theme application to a server, step by step.
Quick example
Once the code is on the server, run these in the application folder:
composer install --no-dev --optimize-autoloader
cp .env.example .env # first time only; then edit .env
php artisan key:generate # first time only
npm ci && npm run build
php artisan migrate --force
php artisan storage:link # if you use file uploads, once
php artisan optimize
The web server's document root must be the public/ folder. On later deployments, skip the cp, key:generate and storage:link lines; if you run a queue worker, add php artisan queue:restart at the end.
Requirements
- PHP 8.3 or later and the extensions on the Dependencies page. The full version needs the
pdo_sqliteextension. - Composer 2.2 or later.
- Node.js 20.19 or 22.12 and later; only if you build on the server.
- MySQL, PostgreSQL or SQLite for the starter kit and your own project. The full version needs no database.
- Nginx or Apache.
Step by step
-
Move the code to the server. The
packages/acun-uifolder must go too; Composer and the build take the Acun UI packages from there. Don't move.env,vendor/,node_modules/, orpublic/hot.If you deploy with Git,
packages/acun-uimust be in the repository.public/buildis in.gitignore, so build it on the server. -
Install the PHP packages.
--no-devleaves out the test and development tools:composer install --no-dev --optimize-autoloader -
Edit the
.envfile for production:APP_ENV=production APP_DEBUG=false APP_URL=https://panel.example.com APP_LOCALE=trVariable Used for APP_ENV=productionRuns Laravel with production rules. APP_DEBUG=falseHides error details from visitors. APP_URLLinks and file URLs are built with this address. APP_LOCALEThe language of console and queue jobs; Acun UI picks the language of pages. Fill in the database, mail and session settings too. If
SESSION_DRIVER,CACHE_STOREorQUEUE_CONNECTIONisdatabase, the migrations create their tables. -
On the first deployment, generate the application key:
php artisan key:generateWarning
Don't generate the key again on later deployments. Sessions end and encrypted data can no longer be read.
-
Build the CSS and JavaScript:
npm ci npm run buildRun this step after
composer install; the build reads the PRO CSS and JavaScript fromvendor/acunsoft/. Don't usenpm ci --omit=dev, because Vite and Tailwind are development dependencies. The fonts are downloaded from Bunny Fonts during the build, so the server needs internet access.If the server has no Node.js, build on your own computer and upload the whole
public/buildfolder.manifest.jsonandfonts-manifest.jsonare in this folder too. Laravel finds the built files and the fonts through these two files. -
Create the database tables.
--forceruns without asking for confirmation in production:php artisan migrate --forceThe full version has no such step; its sample data is read from JSON files.
-
If uploaded files are saved to the
publicdisk, create thepublic/storagelink once:php artisan storage:linkPHP's
upload_max_filesizeandpost_max_sizemust be larger than the biggest file. -
Cache the configuration, routes and views:
php artisan optimizeRepeat it after every deployment and whenever
.envchanges. To clear the cache, runphp artisan optimize:clear. -
Point the web server's document root at the
public/folder. In Nginx:root /var/www/my-app/public; location / { try_files $uri $uri/ /index.php?$query_string; }In Apache,
public/.htaccessis ready;mod_rewritemust be on. Acun UI's theme script (/acun-ui/acun-ui-boot.js) is served through PHP, like Livewire's script. If you wrote a separate rule for.jsfiles, let these URLs reachindex.phptoo. -
Make the
storageandbootstrap/cachefolders writable by the web server's user. On Ubuntu this user is usuallywww-data:sudo chown -R www-data:www-data storage bootstrap/cache sudo chmod -R ug+rw storage bootstrap/cache
Queue and scheduler
You need this section only if you use the queue. The PRO DataTable builds exports of more than 5,000 rows in the queue (exports.queue_threshold). If QUEUE_CONNECTION isn't sync, run a queue worker:
php artisan queue:work
Keep the worker running with Supervisor or your platform's worker feature. After every deployment, run php artisan queue:restart so it picks up the new code. The web server and the worker must use the same cache (array won't work). On several servers, choose a shared disk for exports.disk, such as S3.
To delete expired export files, schedule the command in routes/console.php:
use Illuminate\Support\Facades\Schedule;
Schedule::command('acun-ui:prune-exports')->hourly();
For the scheduler, add a cron line that runs every minute on the server:
* * * * * cd /var/www/my-app && php artisan schedule:run >> /dev/null 2>&1
Hosting types
- Laravel Cloud: You connect the Git repository; the platform sets the document root. Put
composer install --no-dev --optimize-autoloaderandnpm ci && npm run buildin the build commands, andphp artisan migrate --forcein the deploy commands. The server's disk isn't permanent; use an S3-compatible storage disk for uploaded files and exports. - Forge or your own server: The Nginx site's root is
public/. If the deploy script has nonpm ci && npm run build, add it after thecomposer installline. Add the queue worker and the scheduler too. - Shared hosting: There's usually no Node.js; build on your own computer and upload the
public/buildfolder. The Acun UI packages are linked intovendor/acunsoft/with symbolic links, so runcomposer installon the server over SSH. If the control panel doesn't let you change the document root, put the application outsidepublic_htmland linkpublic_htmlto the application'spublic/folder.
Checklist
- PHP 8.3 or later and the required extensions are installed.
- The
packages/acun-uifolder is on the server. composer install --no-dev --optimize-autoloaderhas run..envhasAPP_ENV=production,APP_DEBUG=false, and the rightAPP_URL.APP_KEYwas generated once and never changes.public/buildis up to date, includingmanifest.jsonandfonts-manifest.json. There's nopublic/hotfile.php artisan migrate --forcehas run (not needed for the full version).- If files are uploaded to the
publicdisk,php artisan storage:linkhas run. php artisan optimizehas run.- The document root is the
public/folder. storageandbootstrap/cacheare writable.- If exports use the queue, the queue worker and the cron line are running.
- A panel page opens and the browser console shows no error starting with
[Acun UI].
Learn more
- Dependencies: PHP extensions and versions.
- Configuration: the
config/acun-ui.phpsettings, including DataTable exports. - CSS, JavaScript and build: building and fonts.
- DataTable: exports and the queue.
- Quick start: installing locally and updating.