Skip to content

Overview

WARNING

Installing this app manually may prove cumbersome as there are many steps to be done. We've simplified the process into a Docker setup which you can follow in the Docker installation. Using Docker for installation is the recommended way of installing the store.

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.

Dependencies Installation

bash
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

# Add PostgreSQL repository
sh -c 'echo "deb https://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -

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,pgsql,mbstring,bcmath,xml,fpm,curl,zip} postgresql postgresql-contrib nginx tar unzip git

Composer Installation

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

Code Upload

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

bash
# 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/

Database Setup

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

bash
# Switch to postgres user to create the database
sudo -u postgres psql

# Create a new user and database
CREATE USER lightstore WITH PASSWORD 'yourPassword';
CREATE DATABASE lightstore;
GRANT ALL PRIVILEGES ON DATABASE lightstore TO lightstore;
\q

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

bash
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

WARNING

Back up your encryption key (APP_KEY in the .env file). It is used as an encryption key for all data that needs to be stored securely (e.g. user passwords). Store it somewhere safe - not just on your server. If you lose it all encrypted data is irrecoverable -- even if you have database backups.

Environment Setup

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

bash
DB_CONNECTION=pgsql
DB_HOST=127.0.0.1
DB_PORT=5432
DB_DATABASE=lightstore
DB_USERNAME=lightstore
DB_PASSWORD=yourPassword

Web Server Configuration

Nginx without SSL

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

nginx
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:

bash
sudo ln -s /etc/nginx/sites-available/lightstore.conf /etc/nginx/sites-enabled/
sudo systemctl restart nginx
Nginx with SSL

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

nginx
server {
    listen 80;
    listen [::]:80;
    server_name yourdomain.com;
    return 301 https://$host$request_uri;
}

server {
    listen 443 ssl http2;
    listen [::]:443 ssl http2;
    server_name yourdomain.com;
    root /var/www/lightstore/public;

    index index.php;

    ssl_certificate /etc/letsencrypt/live/yourdomain.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/yourdomain.com/privkey.pem;

    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:

bash
sudo ln -s /etc/nginx/sites-available/lightstore.conf /etc/nginx/sites-enabled/
sudo systemctl restart nginx
Apache without SSL

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

apache
<VirtualHost *:80>
    ServerName yourdomain.com
    ServerAlias www.yourdomain.com
    DocumentRoot /var/www/lightstore/public
    <Directory /var/www/lightstore/public>
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>

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

bash
sudo ln -s /etc/apache2/sites-available/lightstore.conf /etc/apache2/sites-enabled/lightstore.conf
sudo a2enmod rewrite
sudo systemctl restart apache2
Apache with SSL

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

apache
<VirtualHost *:80>
    ServerName yourdomain.com
    ServerAlias www.yourdomain.com
    Redirect permanent / https://yourdomain.com/
</VirtualHost>

<VirtualHost *:443>
    ServerName yourdomain.com
    ServerAlias www.yourdomain.com
    DocumentRoot /var/www/lightstore/public
    <Directory /var/www/lightstore/public>
        AllowOverride All
        Require all granted
    </Directory>
    SSLEngine on
    SSLCertificateFile /etc/letsencrypt/live/yourdomain.com/fullchain.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/yourdomain.com/privkey.pem
</VirtualHost>

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

bash
sudo ln -s /etc/apache2/sites-available/lightstore.conf /etc/apache2/sites-enabled/lightstore.conf
sudo a2enmod rewrite
sudo systemctl restart apache2

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

Permissions Setup

Fix the permissions of lightstore with the following command:

bash
chown -R www-data:www-data /var/www/lightstore/*

Scheduled Tasks

You'll need to 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.

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

Queue Worker Setup

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

conf
[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:

bash
sudo systemctl enable --now lightstore.service

Asset Building

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

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

bash
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:

bash
nvm install 22

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

bash
cd /var/www/lightstore
npm install

Finally, you can build the assets:

bash
npm run build