This is the web for komarch.sk. It is written in PHP and builds upon the Laravel framework. It uses MySQL as a database, TNTSearch for text search functionality, and Redis as transient storage for the job queue.
This readme assumes you will be using containerized services, but you can also run the application without Docker, for example using Herd—which may be the preferred option for local development. If using Docker, see docker-compose.yml
for the equivalent setup.
- PHP 8.2
- Composer 2
- Node 12 (higher versions don't work)
- Docker (optional, for containerized setup)
If using Herd, ensure the required PHP extensions are enabled and services like MySQL are available.
- Clone the repository.
- Create
.env
and.env.testing
files (as copies of.env.example
). - Configure environment variables
DB_PORT
,DB_DATABASE
,DB_USERNAME
,DB_PASSWORD
:- in
.env
, usemysql-development
fromdocker-compose.yml
if using Docker. - in
.env.testing
, usemysql-testing
fromdocker-compose.yml
if using Docker. - If not using Docker, set the database connection parameters based on your local setup.
- in
- Start your environment:
- With Docker: Run
docker-compose up
. - Without Docker (e.g., Herd): Ensure you have MySQL and Redis services running, and connect to your local environment.
- With Docker: Run
- Run
composer install
. - Run
npm install
. - Run
php artisan storage:link
. - Generate app keys:
- Run
php artisan key:generate
. - Run
php artisan key:generate --env=testing
.
- Run
- Run migrations:
php artisan migrate
. - Import search indexes:
php artisan komarch:search:import
. - Run
npm run dev
to build frontend assets.
The web app relies on Backpack Pro for its CMS functionality. Make sure to configure the auth.json
file with the necessary credentials to access Backpack Pro.
- Create an
auth.json
with credentials for thebackpack/pro
repository. Seeauth.json.example
for details.
- Start services:
docker-compose up
(if using Docker) or start MySQL manually (if using Herd or a local setup). - Build frontend assets:
npm run dev
. - Start PHP development server:
php artisan serve
(optional)
To run tests, use the following command:
php artisan test
Testing will use the environment configuration from your .env.testing file. Make sure to have a separate database for testing, as migrations will run before tests execute.
In order to connect to the 'urad' DB, you'll need to set up a ssh tunnel like this:
ssh -N -L 3336:localhost:3336 webumenia.sk
Now the database will be reachable at 127.0.0.1:3336
like so:
URAD_DATABASE_URL="mysql://user:password@127.0.0.1:3336/intranet_komarch"