Skip to content

Installation

Raymonf edited this page May 2, 2021 · 3 revisions

Backend

This project uses Laravel 8, so you first should set up the dependencies (Composer and the PHP extensions required) for Laravel. The specific version of Laravel used is 8, and PHP 8.0 is the latest officially supported version as of writing.

  • Details can be found in Laravel's "Installation" page.
  • If you have Docker installed, you can use Laravel Sail for a nearly one-command setup (./vendor/bin/sail up).

After installing the dependencies, you should create an empty file called .env with the proper environment variables. An example .env file for Laravel Sail would be:

APP_NAME="TAP++"
APP_KEY=
APP_ENV=local
APP_DEBUG=true
APP_URL=http://localhost

FORWARD_DB_PORT=5433

DB_CONNECTION=pgsql
DB_HOST=pgsql
DB_PORT=5432
DB_USERNAME=postgres
DB_PASSWORD=postgres
DB_DATABASE=audiodb

Then, to generate a key for encryption, run php artisan key:generate.

Frontend

Prior to running the website, the frontend assets must be compiled. You can do this by installing node.js and running npm install in the repository root to install the JavaScript dependencies. Then, the following commands can be used:

  • npm run watch to compile the development assets when a file changes
  • npm run dev to compile the development assets once
  • npm run prod to compile the (minified) production assets once
  • npm run hot to watch, with (unreliable) asset hot reloading

npm run prod should be run when setting up the server and not developing.

Database

You can either run ./db/create.sh to create a Postgres database using the current shell user, or run php artisan migrate after setting up your .env file with the proper environment variables.

Running the Dev Server

The Laravel dev server can be run using php artisan serve. Once run, the process will spin up a slow, single-threaded development server for development, typically at http://localhost:8000.

A production server should be using something like NGINX with php-fpm or Laravel Octane with an NGINX reverse proxy, but that is outside the scope of this wiki page.

Clone this wiki locally