untitled-pit-group / foxhound

PIFS standard backend
BSD Zero Clause License
0 stars 0 forks source link

foxhound

Primary PIFS backend.

Setup

Install PHP 8.1, PostgreSQL 14, and Redis 6.2; have the last two running. Have Composer handy. Within PHP, a nice-to-have performance optimization is to have the non-standard php-ds module installed, however it's not a requirement.

Clone this repo. Run composer install.

Copy .env.example to .env. Change the DB_* variables as appropriate. (You should probably create a separate user and database for Foxhound. The user might not have a password by default; Postgres tends to just trust all local users.)

Run php artisan migrate to set up the database schema.

To run the server, from the project's directory, launch php -S 127.0.0.1:8080 -t public public/index.php (substitute the IP address, port, and directory of public to taste.)

Google Cloud Setup

Apart from the above, the instance needs to be linked to a Google Cloud Platform service account.

In the GCP console, [create a service account][gcloud-service] with a permissions role of Storage Object Creator or higher.

Generate new keys for the account. Download the JSON file containing the keys. Put it under storage/var or somewhere else (the former is recommended because it's checked into .gitignore.)

In .env, set GOOGLE_APPLICATION_CREDENTIALS to the absolute disk path of where the JSON key file is stored. Set FOXHOUND_GCS_PREFIX to an URL of form gs://{BUCKET-NAME}/{OPTIONAL-PATH-PREFIX}.

Conventions

In general, use EditorConfig for formatting, and follow PSR-1 and PSR-12 for coding. In general, braces for classes/functions should be on next line, and braces for if/switch/etc blocks should be on the same line. Other than that, use your best judgement :)

License

Insofar possible under the purview of authors' copyright and not contrary to other restrictions, the code in this repository is made available under the 0-clause BSD license.