Server GTM Hosting has moved to its own platform.

Visit TagLinc(opens in a new tab)
Applications

Migrate a Laravel App and Its MySQL Database to FlyNode

Deploy an existing Laravel project from Git with MySQL and Redis created beside it, import your data, and set the variables Laravel needs behind FlyNode's proxy.

7 min readUpdated Nov 2, 2026FlyNode docs
Browse documentation

Need a hand?

Can't find your answer? Our team replies fast.

Contact support

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 install and 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.3 line in composer.json. When your public GitHub repository asks for Laravel 13 or newer, FlyNode builds it on a PHP 8.4 image instead and sets APP_KEY, APP_URL, ASSET_URL and 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 .env file.
  • You know your app key (php artisan key:generate --show prints one) and every other setting your .env holds, 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 under vendor. For a Laravel 13 project, deploy the 12.x branch of the starter, or put a Dockerfile that 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:

  1. Push your project to GitHub.
  2. Tell Claude: Deploy this Laravel app to FlyNode with MySQL and run the migrations.
  3. Claude gives you a private link. Open it and paste your secrets there. They never go through the chat.
  4. 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 to bootstrap/app.php:
    ->withMiddleware(function (Middleware $middleware) {
        $middleware->trustProxies(at: '*');
    })
    If you cannot change the code yet, set APP_URL and ASSET_URL to your https:// address (step 3).
  • Keep files out of the container. A deploy builds a new container, so files written to storage at 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/predis and REDIS_CLIENT=predis is the simplest.

Step 2: Deploy the app with its database

  1. Go to Deploy and choose Custom app.
  2. Enter an app name, choose Public repository or Private repository, paste the repository address and check the branch.
  3. 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.
  4. Press Continue, keep the generated domain, press Continue again and then Deploy App.
The Custom app form with the Database section: presets for common stacks and a checkbox for each database

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.

The Add a database card on the Database tab, with MySQL and Redis already added

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 shows nginx: [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 add NIXPACKS_START_CMD with 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=false
  • APP_URL and ASSET_URL, both set to your https:// address
  • SESSION_DRIVER and CACHE_STORE (for example file, database once the tables exist, or redis)
The Variables list of a Laravel app with its settings and the Save and redeploy button

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 Terminal tab: cd /app, then php artisan --version prints the Laravel version

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

  1. Settings, then Deploys shows the build as Succeeded. If it failed, press View log.
  2. Open the app's address. A fresh Laravel project shows its welcome page.
The Laravel welcome page running on a FlyNode address

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_KEY is missing, or the database is unreachable. Open the Logs tab, and set APP_DEBUG=true for 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 set ASSET_URL to your https:// address.
  • The address shows "no available server". The web server did not start. Read the Logs tab. If you see duplicate location "/", add the NIXPACKS_START_CMD variable 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_USERNAME and DB_PASSWORD in 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 .sql or .sql.gz file made by mysqldump. 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.json has a build script that works on your own computer.

Next steps

Still stuck?

Open a support ticket from your dashboard and include the container name.

Contact support