This guide moves an existing Laravel app that uses MySQL to a FlyNode Cloud Workspace. The app runs as a Custom app built from your Git repository, and FlyNode creates the MySQL (and Redis, if you want it) next to it with the usual DB_* variables already set.
How the pieces fit
- Laravel app: one Custom app. FlyNode builds your repository with Nixpacks, which recognises a Laravel project, runs
composer installand your front-end build, and serves the app with nginx and PHP-FPM on a generated address with automatic SSL. - Laravel 13: it needs PHP 8.4, and Nixpacks only builds PHP 8.3 from the usual
^8.3line incomposer.json. When your public GitHub repository asks for Laravel 13 or newer, FlyNode builds it on a PHP 8.4 image instead and setsAPP_KEY,APP_URL,ASSET_URLand file-based sessions and cache so the first page loads. Change any of them under Variables. A private repository is still built with Nixpacks, which cannot build Laravel 13 yet. - MySQL and Redis: databases FlyNode creates with your app. Only your own apps on FlyNode can reach them, and they do not count toward your workspace's app limit.
- Not included: queue workers and the scheduler are separate processes. This app serves web requests only, so use a queue driver and scheduler that do not need a long-running process on this container (or run them elsewhere).
Before you start
- Your code is in a repository on GitHub, GitLab or Bitbucket, and it does not contain your real
.envfile. - You know your app key (
php artisan key:generate --showprints one) and every other setting your.envholds, except the database login, which FlyNode creates. - For a private repository, read Deploy a Private Repository first, and see the note in step 2.
- Laravel 12 or older. FlyNode builds PHP projects with PHP 8.3, which runs Laravel 12 and older. Laravel 13 needs PHP 8.4, so its build stops while installing packages with
syntax error, unexpected token "{"in a file undervendor. For a Laravel 13 project, deploy the12.xbranch of the starter, or put aDockerfilethat starts from a PHP 8.4 image in the repository and choose Use my Dockerfile in the advanced build options.
The fast way: let Claude do it
If you use Claude, it can do the deploy for you. Connect it once with Deploy and Migrate with Claude or the CLI, then:
- Push your project to GitHub.
- Tell Claude: Deploy this Laravel app to FlyNode with MySQL and run the migrations.
- Claude gives you a private link. Open it and paste your secrets there. They never go through the chat.
- Open the live address Claude gives you.
Prefer the terminal? In your project folder run:
flynode deploy --db mysql --post-deploy "php artisan migrate --force"
Laravel needs an APP_KEY. If you have none, run php artisan key:generate --show to print one, and send it on the private link. Send the rest of your .env with flynode env push.
Step 1: Get the code ready
- Trust the proxy. FlyNode serves your app over HTTPS in front of the container. Without trusting the proxy, Laravel builds
http://links for your CSS and JavaScript and the browser blocks them, so the page loads with no styling. In Laravel 11 and 12, add this tobootstrap/app.php:
If you cannot change the code yet, set->withMiddleware(function (Middleware $middleware) { $middleware->trustProxies(at: '*'); })APP_URLandASSET_URLto yourhttps://address (step 3). - Keep files out of the container. A deploy builds a new container, so files written to
storageat run time are not kept. Use S3 or another object store for uploads. - Redis. To use Redis for cache, sessions or queues, Laravel needs a client:
composer require predis/predisandREDIS_CLIENT=predisis the simplest.
Step 2: Deploy the app with its database
- Go to Deploy and choose Custom app.
- Enter an app name, choose Public repository or Private repository, paste the repository address and check the branch.
- In the Database section press Laravel. It ticks MySQL and Redis; untick Redis if you do not use it. Leave Advanced build options alone, because FlyNode detects Laravel on its own.
- Press Continue, keep the generated domain, press Continue again and then Deploy App.
The databases are created first and their variables are set before the app starts: DB_CONNECTION, DB_HOST, DB_PORT, DB_DATABASE, DB_USERNAME, DB_PASSWORD and DATABASE_URL for MySQL, and REDIS_HOST, REDIS_PORT, REDIS_PASSWORD and REDIS_URL for Redis. Laravel gives real environment variables priority over .env, so you do not need to edit any file. You can see them, and the database logins, on the app's Database tab, and you can add a database to a running app there too.
Laravel on a private repository. For a public GitHub repository FlyNode sets one extra variable for you,
NIXPACKS_START_CMD, which you will see in the Variables list. It works around a known problem where the web server never starts for Laravel projects (the log showsnginx: [emerg] duplicate location "/"). FlyNode cannot look inside a private repository to see that it is Laravel, so for a private one add the variable yourself: in Settings, Variables addNIXPACKS_START_CMDwith this value, then press Save and redeploy:env -u NIXPACKS_PHP_FALLBACK_PATH node /assets/scripts/prestart.mjs /assets/nginx.template.conf /nginx.conf && (php-fpm -y /assets/php-fpm.conf & nginx -c /nginx.conf)
Step 3: Add your other variables
Open the app, go to Settings and then Variables. Use Paste a .env to add the rest at once (leave out the DB_* lines, which FlyNode already set), then press Save and redeploy. These are the ones most Laravel apps need:
APP_KEY,APP_ENV=production,APP_DEBUG=falseAPP_URLandASSET_URL, both set to yourhttps://addressSESSION_DRIVERandCACHE_STORE(for examplefile,databaseonce the tables exist, orredis)
Values stay hidden until you press the eye icon. A variable is read when the app starts, so nothing takes effect until the app is deployed again. See Build Logs, Environment Variables and Rollback.
Step 4: Move your data or run your migrations
To bring your existing data: on your own computer run mysqldump --single-transaction --routines --triggers -u USER -p OLD_DB | gzip > dump.sql.gz. Open the app, go to Database, find the MySQL card and press Choose a file under Import a dump. Pick the file (up to 500 MB) and tick Replace everything in the database first to make the new database match the dump. FlyNode loads it in the background and shows the result under the button.
To create the tables instead: open the Terminal tab. It opens in the root folder, and your project is in /app, so run cd /app first and then php artisan migrate --force. A command is stopped after 15 seconds, so this is meant for small jobs.
The database card also has Download, and FlyNode backs the database up every night with the app. If your data is bigger than 500 MB, or you want to keep a managed MySQL service, pick No database in step 2 and set the DB_* variables yourself.
Step 5: Check that it works
- Settings, then Deploys shows the build as Succeeded. If it failed, press View log.
- Open the app's address. A fresh Laravel project shows its welcome page.
Then sign in and open a page that reads from MySQL. Add your own domain from the Custom Domain tab (see Custom Domains for Your Apps) and update APP_URL and ASSET_URL to it.
If something goes wrong
- The page shows a plain 500 error. Most often the
APP_KEYis missing, or the database is unreachable. Open the Logs tab, and setAPP_DEBUG=truefor a moment (then redeploy) if you need the full message. Turn it off again afterwards. - The page loads with no styling. Your CSS and JavaScript are requested over
http://. Trust the proxy (step 1) or setASSET_URLto yourhttps://address. - The address shows "no available server". The web server did not start. Read the Logs tab. If you see
duplicate location "/", add theNIXPACKS_START_CMDvariable from the note in step 2. - The app cannot reach the database. Open the Database tab and check it is running, and that
DB_HOST,DB_PORT,DB_USERNAMEandDB_PASSWORDin Variables still match it. If you chose No database and use your own, check its address, SSL and which addresses it allows. - The import says the database refused the file. Use a
.sqlor.sql.gzfile made bymysqldump. If it clashes with tables that already exist, import again with Replace everything ticked. - Front-end build errors. Open Deploys and press View log. Make sure
package.jsonhas abuildscript that works on your own computer.
Next steps
- Deploy a Private Repository and redeploy on every push.
- Migrate a Next.js App and Its Postgres Database to FlyNode.
Still stuck?
Open a support ticket from your dashboard and include the container name.