Installation


Install dependencies

  1. Install Composer 2.2
    https://getcomposer.org/download/

  2. Install PHP 8.2
    https://www.php.net/downloads.php

  3. Install Laravel 10
    https://laravel.com/docs/10.x/installation


Set up the project

  1. Clone the repository

    git clone git@github.com:eduayme/RescueApp.git
  2. Create a new .env file inside the project folder with the same contents as .env.example

    cp .env.example .env
  3. Install project dependencies

    composer install
  4. Generate the application key

    php artisan key:generate

Set up the database

Option 1) MySQL

  1. Install MySQL 8.0
    https://dev.mysql.com/doc/mysql-installation-excerpt/8.0/en/

  2. Create the database aplicatiu_bombers in MySQL

    CREATE DATABASE aplicatiu_bombers;
  3. Update MySQL credentials in .env

    DB_CONNECTION=mysql
    DB_HOST=127.0.0.1
    DB_PORT=3306
    DB_DATABASE=aplicatiu_bombers
    DB_USERNAME=mysql_username
    DB_PASSWORD=mysql_password

Option 2) PostgreSQL

  1. Install PostgreSQL 15
    https://www.postgresql.org/download/

  2. Create the database aplicatiu_bombers in PostgreSQL

    CREATE DATABASE aplicatiu_bombers;
  3. Update PostgreSQL credentials in .env

    DB_CONNECTION=pgsql
    DB_HOST=127.0.0.1
    DB_PORT=5432
    DB_DATABASE=aplicatiu_bombers
    DB_USERNAME=postgresql_username
    DB_PASSWORD=postgresql_password

Email configuration

Option 1) Gmail via SMTP

  1. Create a Gmail account

  2. Go to your account security settings
    https://myaccount.google.com/security?pli=1#connectedapps

  3. Configure an app password (recommended) or equivalent SMTP method, and update credentials in .env

    MAIL_MAILER=smtp
    MAIL_HOST=smtp.gmail.com
    MAIL_PORT=587
    MAIL_USERNAME=gmail_username
    MAIL_PASSWORD=gmail_app_password
    MAIL_ENCRYPTION=tls
    MAIL_FROM_ADDRESS="noreply@example.com"
    MAIL_FROM_NAME="RescueApp"

Run the application

  1. Run database migrations

    php artisan migrate
  2. (Optional) Run seeders if the project has them

    php artisan db:seed
  3. Start the application

    php artisan serve
  4. Open a browser and go to http://127.0.0.1:8000 or http://localhost:8000

  5. RescueApp is running!


Server configuration

Example installation on the subdomain RescueApp.mysite.com

Option 1) Apache2

  1. Install Apache2
    https://help.ubuntu.com/lts/serverguide/httpd.html#Installation

  2. Configure DNS "A" records for your subdomain as required by your provider

  3. Configure /etc/apache2/sites-enabled/RescueApp.conf adapting the code to your needs: ServerName, DocumentRoot, SSL parameters, etc. Example:

    <VirtualHost *:80>
    ServerName RescueApp.mysite.com
    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/html/Rescue-app/public
    
    <Directory /var/www/html/Rescue-app>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>
    
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
    
    RewriteEngine on
    RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
    </VirtualHost>
<IfModule mod_ssl.c>
<VirtualHost *:443>
    ServerName RescueApp.mysite.com
    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/html/Rescue-app/public

    <Directory /var/www/html/Rescue-app>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

    Include /etc/letsencrypt/options-ssl-apache.conf
    SSLCertificateFile /etc/letsencrypt/live/mysite.com/fullchain.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/mysite.com/privkey.pem
</VirtualHost>
</IfModule>