Skip to content

Commit

Permalink
Merge branch 'release/2.2.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
daveroverts committed Nov 7, 2021
2 parents 555630e + 9f905f6 commit 263d808
Show file tree
Hide file tree
Showing 24 changed files with 1,387 additions and 101 deletions.
6 changes: 6 additions & 0 deletions .markdownlint.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"default": true,
"MD024": {
"siblings_only": true
}
}
17 changes: 10 additions & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [v2.2.4](https://github.com/daveroverts/bmac/compare/v2.2.3...v2.2.4) - 2021-11-07

### Added

- Added [laravel-mix-purgecss](https://github.com/spatie/laravel-mix-purgecss) to minify css.
- Added [Laravel Horizon](https://laravel.com/docs/master/horizon).

## [v2.2.3](https://github.com/daveroverts/bmac/compare/v2.2.2b...v2.2.3) - 2021-11-06

### Added
Expand All @@ -16,24 +23,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [v2.2.2b](https://github.com/daveroverts/bmac/compare/v2.2.2a...v2.2.2b) - 2021-10-24

### Added

- Added [Laravel Sail](https://laravel.com/docs/master/sail) with `.devcontainer`

### Changed

- Fix for send test email not working (again)

## [v2.2.2a](https://github.com/daveroverts/bmac/compare/v2.2.2...v2.2.2a) - 2021-10-24

### Changed

- README.md rewritten
- Fix for send test email not working

### Changed

- Deployment package changed from ``lorisleiva/laravel-deployer`` to ``deployphp/deployer``
- This is temporary for PHP 8 support, I'll move the deployment script somewhere else later on.
- PHP 8 support
- `import_template.xlsx` now uses correct header values.

## [v2.2.2](https://github.com/daveroverts/bmac/compare/v2.2.1...v2.2.2) - 2021-10-09

### Changed
Expand Down
123 changes: 64 additions & 59 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,81 +41,86 @@ Before you begin, make sure you have a server with PHP (at least 7.3, 8 recommen

1. Clone the project

```bash
git clone https://github.com/daveroverts/bmac.git
```
```bash
git clone https://github.com/daveroverts/bmac.git
```

2. Go to the project directory

```bash
cd bmac
```
```bash
cd bmac
```

3. Copy `.env.example` to `.env`

```bash
cp .env.example .env
```

Open `.env`. The following must be changed:

- `APP_ENV`
- Set this to `production` when running this in a production environment.
- Set this to `local` when running this project locally to test things out.
- `APP_URL`
- Be sure to set this to the URL the project will be running. For example: ``APP_URL=https://example.org``
- If you forget, you will have issues with Vatsim Connect (or any OAuth 2 provider)
- `BUGSNAG_API_KEY`:
- BMAC uses Bugsnag by default for error monitoring.
- If you have a key, you can put this here. There won't be problems if you leave it empty.
- `DB_*`
- As required
- If you need to share a database with some other application, you can add in a prefix by setting `DB_TABLE_PREFIX=bmac_`
- If your database does not support long indexes, set `DB_LOWER_STRING_LENGTH=true`
- `QUEUE_DRIVER`
- For local, you can use `sync` with no issues
- In a production environment, I recommend you use something else, like `database` or `redis`. More info can be found [here](https://laravel.com/docs/master/queues)
- When you use `database`, the `jobs` table is already migrated, no need to do that again.
- When you use `redis`, `predis` is already in the `composer.json` file, no need to require it again.
- `MAIL_*`
- As required
- `MAIL_MAILER`: For testing, you can use something like [Mailtrap](https://mailtrap.io/) (online) or [Mailhog](https://github.com/mailhog/MailHog) (local, included with [Laravel Homestead](https://laravel.com/docs/master/homestead))
- `MAIL_FROM_ADDRESS`: This will be used as the `From` email. Don't forget to set this.
- `MAIL_FROM_NAME`: This will be used as the `From` name
- `OAUTH_*`
- See [Vatsim Connect](#vatsim-connect) if you're not sure what to do at this point.
- `SITE_*`
- Feel free to edit these. They are used all over the place.
- `BOOTSTRAP_COLOR`:
- By default, BMAC uses [Bootswatch Flatly](https://bootswatch.com/flatly/). If you wish to edit some colors, you can do so here.
```bash
cp .env.example .env
```

Open `.env`. The following must be changed:

- `APP_ENV`
- Set this to `production` when running this in a production environment.
- Set this to `local` when running this project locally to test things out.
- `APP_URL`
- Be sure to set this to the URL the project will be running. For example: ``APP_URL=https://example.org``
- If you forget, you will have issues with Vatsim Connect (or any OAuth 2 provider)
- `BUGSNAG_API_KEY`:
- BMAC uses Bugsnag by default for error monitoring.
- If you have a key, you can put this here. There won't be problems if you leave it empty.
- `DB_*`
- As required
- If you need to share a database with some other application, you can add in a prefix by setting `DB_TABLE_PREFIX=bmac_`
- If your database does not support long indexes, set `DB_LOWER_STRING_LENGTH=true`
- `QUEUE_DRIVER`
- For local, you can use `sync` with no issues
- In a production environment, I recommend you use something else, like `database` or `redis`. More info can be found [here](https://laravel.com/docs/master/queues)
- When you use `database`, the `jobs` table is already migrated, no need to do that again.
- When you use `redis`, `predis` is already in the `composer.json` file, no need to require it again.
- `MAIL_*`
- As required
- `MAIL_MAILER`: For testing, you can use something like [Mailtrap](https://mailtrap.io/) (online) or [Mailhog](https://github.com/mailhog/MailHog) (local, included with [Laravel Homestead](https://laravel.com/docs/master/homestead))
- `MAIL_FROM_ADDRESS`: This will be used as the `From` email. Don't forget to set this.
- `MAIL_FROM_NAME`: This will be used as the `From` name
- `OAUTH_*`
- See [Vatsim Connect](#vatsim-connect) if you're not sure what to do at this point.
- `SITE_*`
- Feel free to edit these. They are used all over the place.
- `BOOTSTRAP_COLOR`:
- By default, BMAC uses [Bootswatch Flatly](https://bootswatch.com/flatly/). If you wish to edit some colors, you can do so here.

4. Install dependencies

Production:
Production:

```bash
composer install --optimize-autoloader --no-dev
php artisan key:generate # Only needed for first deployment
php artisan migrate
php artisan storage:link # Only needed for first deployment
npm ci
npm run prod
```
```bash
composer install --optimize-autoloader --no-dev
php artisan key:generate # Only needed for first deployment
php artisan migrate
php artisan storage:link # Only needed for first deployment
npm ci
npm run prod
```

Development:
Development:

```bash
composer install
php artisan key:generate # Only needed for first deployment
php artisan migrate
php artisan storage:link # Only needed for first deployment
npm ci
npm run dev
```
```bash
composer install
php artisan key:generate # Only needed for first deployment
php artisan migrate
php artisan storage:link # Only needed for first deployment
npm ci
npm run dev
```

5. Open the website, and login.

6. Open the database, and make yourself admin by setting `isAdmin` to `1`.

7. If you want to include all airports to the database, navigate to `admin/airports/import` (be sure you're logged in as admin). Depending on your setup, this might take a little while, and you won't get a confirmation that import has been done.
The script uses [this](https://github.com/jpatokal/openflights/blob/master/data/airports.dat) file as source. Note that at the time of writing, the file was last edited 13 May 2019.

## Queue worker / Laravel Horizon
If you're not using `sync` as `QUEUE_DRIVER`, you need to run a queue worker, or else things like emails aren't being sent. Check Laravel documentation on how to set one up using Supervisor <https://laravel.com/docs/master/queues#supervisor-configuration>

When you're using `redis` as `QUEUE_DRIVER`, [Laravel Horizon](https://laravel.com/docs/master/horizon) is already installed and can be used to start a queue worker.
40 changes: 40 additions & 0 deletions app/Providers/HorizonServiceProvider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?php

namespace App\Providers;

use Illuminate\Support\Facades\Gate;
use Laravel\Horizon\Horizon;
use Laravel\Horizon\HorizonApplicationServiceProvider;

class HorizonServiceProvider extends HorizonApplicationServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
parent::boot();

// Horizon::routeSmsNotificationsTo('15556667777');
// Horizon::routeMailNotificationsTo('[email protected]');
// Horizon::routeSlackNotificationsTo('slack-webhook-url', '#channel');

// Horizon::night();
}

/**
* Register the Horizon gate.
*
* This gate determines who can access Horizon in non-local environments.
*
* @return void
*/
protected function gate()
{
Gate::define('viewHorizon', function ($user) {
return $user->isAdmin;
});
}
}
7 changes: 4 additions & 3 deletions app/Providers/TelescopeServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

namespace App\Providers;

use Laravel\Telescope\Telescope;
use Illuminate\Support\Facades\Gate;
use Laravel\Telescope\IncomingEntry;
use Laravel\Telescope\Telescope;
use Laravel\Telescope\TelescopeApplicationServiceProvider;

class TelescopeServiceProvider extends TelescopeApplicationServiceProvider
Expand All @@ -21,11 +21,12 @@ public function register()
$this->hideSensitiveRequestDetails();

Telescope::filter(function (IncomingEntry $entry) {
if ($this->app->isLocal()) {
if ($this->app->environment('local')) {
return true;
}

return $entry->isReportableException() ||
$entry->isFailedRequest() ||
$entry->isFailedJob() ||
$entry->isScheduledTask() ||
$entry->hasMonitoredTag();
Expand All @@ -39,7 +40,7 @@ public function register()
*/
protected function hideSensitiveRequestDetails()
{
if ($this->app->isLocal()) {
if ($this->app->environment('local')) {
return;
}

Expand Down
19 changes: 13 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"keywords": [
"framework",
"laravel"
],
"license": "MIT",
"type": "project",
"require": {
Expand All @@ -16,7 +19,8 @@
"fideloper/proxy": "^4.0",
"fruitcake/laravel-cors": "^2.0",
"laravel/framework": "^8.0",
"laravel/telescope": "^4.0",
"laravel/horizon": "^5.7",
"laravel/telescope": "^4.6",
"laravel/tinker": "^2.0",
"league/oauth2-client": "^2.4",
"livewire/livewire": "^2.3",
Expand All @@ -43,7 +47,9 @@
"Database\\Factories\\": "database/factories/",
"Database\\Seeders\\": "database/seeders/"
},
"files": ["app/Helper.php"]
"files": [
"app/Helper.php"
]
},
"autoload-dev": {
"psr-4": {
Expand All @@ -52,8 +58,7 @@
},
"extra": {
"laravel": {
"dont-discover": [
]
"dont-discover": []
}
},
"scripts": {
Expand All @@ -70,7 +75,9 @@
"post-update-cmd": [
"Illuminate\\Foundation\\ComposerScripts::postUpdate",
"php artisan ide-helper:generate",
"php artisan ide-helper:meta"
"php artisan ide-helper:meta",
"@php artisan telescope:publish --ansi",
"@php artisan horizon:publish --ansi"
]
},
"config": {
Expand Down
Loading

0 comments on commit 263d808

Please sign in to comment.