Skip to content

Installing manually

Introduction

Light Store is built on top of the Laravel framework and provides a powerful interface for managing your store.

Therefore, deployment steps for Laravel apply. This guide outlines the steps to deploy Light Store on a fresh installation of a Ubuntu 24.04 full-root server.

Prerequisites

Before you begin, this guide will assume a fresh installation of a Ubuntu 24.04 full-root server.

System Preperation

Install Dependencies

Terminal window
apt -y install software-properties-common curl apt-transport-https ca-certificates gnupg
LC_ALL=C.UTF-8 add-apt-repository -y ppa:ondrej/php
# If you are on Ubuntu 22.04 and up, you can skip this step
curl -LsS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash
apt update
# Add universe repository if you are on Ubuntu 18.04
apt-add-repository universe
apt -y install php8.3 php8.3-{common,cli,gd,mysql,mbstring,bcmath,xml,fpm,curl,zip} mariadb-server nginx tar unzip git

Install Composer

Terminal window
curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer

Uploading the code

Upload the store files to your server. You can do it via FTP or SSH.

Terminal window
# Make a directory for the store files:
mkdir /var/www/lightstore
cd /var/www/lightstore
# Extract the files if uploaded as .tar.gz:
tar -xzvf lightstore.tar.gz
# ...or unzip the files if uploaded as .zip:
unzip lightstore.zip
# Make sure to adjust permissions:
chmod -R 755 storage/* bootstrap/cache/

Install & Setup Database

It is possible to use the panel with a local SQLite database. However, it is advised to use a MySQL database for production instead.

Terminal window
mysql -u root -p
# Change 'yourPassword' below to be a unique password
CREATE USER 'lightstore'@'127.0.0.1' IDENTIFIED BY 'yourPassword';
CREATE DATABASE lightstore;
GRANT ALL PRIVILEGES ON lightstore.* TO 'lightstore'@'127.0.0.1' WITH GRANT OPTION;
exit

Copy over the default environment settings file, install composer dependencies, and then generate a new application encryption key.

Terminal window
cp .env.example .env
composer install --no-dev --optimize-autoloader
# Only run the command below if you are installing this app for
# the first time and do not have any data in the database.
# This will override the existing APP_KEY in the .env file.
php artisan key:generate --force
# Link the storage:
php artisan storage:link

Environment Configuration

Copy over .env.example to .env and change the database connection information to match the credentials you created in the previous step.

Terminal window
DB_DATABASE=lightstore
DB_USERNAME=lightstore
DB_PASSWORD=yourPassword

Database Setup

Now we need to setup all of the base data for the Panel in the database you created earlier. The command below may take some time to run depending on your machine. Please DO NOT exit the process until it is completed! This command will setup the database tables that power lightstore.

Terminal window
php artisan migrate --force --seed

Webserver configuration

For nginx you can create a file in /etc/nginx/sites-available/ called lightstore.conf and add the following:

server {
listen 80;
listen [::]:80;
server_name yourdomain.com;
root /var/www/lightstore/public;
index index.php;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php8.3-fpm.sock;
}
}

Then run the following commands to enable the site and restart nginx:

Terminal window
sudo ln -s /etc/nginx/sites-available/lightstore.conf /etc/nginx/sites-enabled/
sudo systemctl restart nginx

Be sure to replace yourdomain.com with your domain name.

Fix the permmisions of lightstore with the following command:

Terminal window
chown -R www-data:www-data /var/www/lightstore/*

Cronjob

You’ll need to do is create a new cronjob that runs every minute to process specific Light Store tasks. Open crontab using sudo crontab -e and then paste the line below.

Terminal window
* * * * * php /var/www/lightstore/artisan schedule:run >> /dev/null 2>&1

Create Queue Worker

Create a new file in /etc/systemd/system/ called lightstore.service and add the following:

[Unit]
Description=Light Store Queue Worker
[Service]
User=www-data
Group=www-data
Restart=always
ExecStart=/usr/bin/php /var/www/lightstore/artisan queue:work
StartLimitInterval=180
StartLimitBurst=30
RestartSec=5s
[Install]
WantedBy=multi-user.target

Then run the following commands to enable the service and start it:

Terminal window
sudo systemctl enable --now lightstore.service

Rebuilding assets

In case of needing to rebuild assets, you can do so by using Node.js.

If you do not have Node.js installed, install it using either apt or nvm (node version manager, recommended):

Terminal window
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash

Restart your shell.

Then install the version 22 of Node.js:

Terminal window
nvm install 22

Once Node.js is installed, you can install the dependencies for the project:

Terminal window
cd /var/www/lightstore
npm install

Finally, you can build the assets:

Terminal window
npm run build