The back-end for www.shredindex.com
To be added...
A set of Docker platform is included for running the project.
- Install Docker https://docs.docker.com/get-docker/
- If not installed with Docker Desktop, Docker Compose install https://docs.docker.com/compose/install/
- Copy
.infrastructre/docker-compose.yml.distto.infrastructre/docker-compose.yml - Copy
.infrastructre/.env.distto.infrastructre/.env - Copy
.infrastructre/etc/nginx/conf.d/default.conf.distto.infrastructre/etc/nginx/conf.d/default.conf - Copy
.env.distto.env
Optionally, you can make any changes to the resulting .env docker-compose.yml and default.conf to suit your needs.
From .infrastructure/ use
docker-compose up -d
When all docker containers are running, use
docker exec shredindex-backend-php php artisan october:up
Copy the Admin password generated by php artisan october:up, supplied during the terminal output. E.g:
...
- The following password has been automatically generated for the "admin" account: sVHffUkY7BR5F5AngwDCV1
(Note: A new password is generated every time)
If you are using the default preparation: Visit http://localhost:8080/backend
Visit http://localhost:8080/backend/cms/themes and click "Activate" below the "Underflip" theme.
Activating the theme ensures all pages and menus are made available to the front-end (this also impacts front-end routes).
You can query the GraphQL server at /graphql e.g http://localhost:8080/graphql
An easy way to query the GraphQL server is to use the Chrome GraphiQL extension
The frontend relies on page-data from the CMS for its routes and views. For this purpose, we use an overly-opinionated combination of October CMS's CMS Page and Rainlab's Static Menu.
Note: We do not use Rainlab's Static Pages.
To add a new page, you can create a CMS page (be sure to make one with no content). Simply follow the out-of-the-box Pages documentation.
Note: Our frontend does not use any page-content from the CMS.
Test Data can be seeded with the resorts:seed_test_data artisan command.
The resorts:seed_test_data has the --fresh option to tear down seeded data before re-seeding (e.g php artisan resorts:seed_test_data --fresh)
There's also a handy composer script to run this from your host machine (uses the --fresh option):
composer seed-test-data
Our Seeders are in plugins/underflip/resorts/database/seeders. Add another Seeder to seed new fixtures for test data. Use the existing Seeders as an example.
To engage a Seeder, add it to the Underflip\Resorts\Console\SeedTestData::$seeders e.g
plugins/underflip/resorts/console/SeedTestData.php:
protected $seeders = [
...,
YourSeeder::class,
];
NOTE: Seeders must be in topological order with dependencies first, so that Seed records exist for subsequent Seeders that depend on them
When you want to tear down seeded fixtures with the --fresh option seeds a fresh set of fixtures, make sure that your Seeder implements Downable.
e.g
class MySeeder extents Seeder implements DownableEach Downable Seeder uses a public function down() method to control the tear down behaviour when the resorts:seed_test_data command's --fresh option is used.
When you make any changes to our Resort plugin's migrations or seeders, you can refresh the plugin to re-run the current version using the plugin:refresh Underflip.Resorts artisan command.
There's also a handy composer script to run this from your host machine:
composer plugin-refresh
Total scores are whenever a Resort's rating is created, saved or deleted.
Manually refresh Resort total scores with the resorts:refresh_total_score artisan command.
There's also a handy composer script to run this from your host machine:
composer resorts-refresh-total-shred-score