Changing Domain

Let's supposed you started by installing NexoPOS locally using Laragon, but now you're planning to go live by installing that online. You're probably wondering, what do I need to do to move it to production. This guide will explain everything you need.

Preparing Files And Database

We'll now prepare your files and your database for the migration.

Preparing the database

Let's first talk about the database. You might probably want to upload your database as it is with the products you have created. If that's the case, you need to backup your database. If you're using Laragon, just open the database.

Then open the session and select your database where you've installed NexoPOS and make sure first to wipe the two following tables :

  • telescope_entries
  • telescope_entries_tags

Note that these table names are usually prefixed with your table prefix. By default, it's '_ns'.

These tables are just kept for debugging purposes your information isn't saved within.

You might easily perform this by using PhpMyAdmin instead of HeidiSQL. If by default heidiSQL is enabled, here is how you can install phpMyAdmin.

Alternatively, you can run a command on the CLI to clear those tables:

php artisan telescope:prune --hours=0

Now you can backup your entire database, by exporting that.

Preparing the files

Preparing the files implies downloading a saving all your files, but there is some folder that shouldn't be downloaded:

  • vendor
  • node_modules

You can also omit all folders starting with a dot, like ".vscode", ".git" if it's available on your setup.

The reason why we don't want to backup "node_modules" and "vendor" it's mainly because these are usually heavy folders (might weigh sometimes more than 500mo) and these can and should be installed using the CLI.

  • vendor: it's where php packages are installed, you can reinstall those by using the command "composer install"
  • node_modules: it's where node modules are installed, you can install that by using the command "npm install".

In case you have those folders on your system, make sure to skip them while creating a backup of your installation. To avoid downloading the cache as well, you can run the following command :

php artisan cache:clear
php artisan clear

Now upload your files and database to your remote installation.

Updating the .env File

Obviously, if you change your environment, all the information on the .env file won't be applicable. Let's break down the values that need to be updated:

  • APP_URL: your domain has probably changed, so update your domain here accordingly.
  • NS_SOCKET_DOMAIN: has also probably changed, an update is required here
  • SESSION_DOMAIN: should point to the exact domain name as defined on APP_URL.
  • SANCTUM_STATEFUL_DOMAINS: same value as session domain.

After you have updated your .env file, you might be facing a known issue CSRF mismatch (in case a configuration hasn't been made correctly).

Does this wasn't helpful for you? Let us know.