firevel/firevel

The Serverless Laravel Framework for Google App Engine + Firestore.

Installs: 317

Dependents: 0

Suggesters: 0

Security: 0

Stars: 294

Watchers: 11

Forks: 11

Open Issues: 0

Type:project

7.0.0 2020-10-08 13:59 UTC

This package is auto-updated.

Last update: 2021-09-28 01:02:49 UTC


README

68747470733a2f2f73746f726167652e676f6f676c65617069732e636f6d2f6669726576656c2d7075626c69632f696d616765732f6c6f676f2e706e67

About Firevel

Firevel is a modified, serverless version of Laravel 7 designed to work inside Google App Engine PHP 7.3 standard environment, together with Google Firestore as database and cache.

In addition to standard Laravel Framework benefits it offers:

  • Simple, serverless setup.
  • Downscaling to zero.
  • Micro-service friendly design.
  • Free tier eligibility.
  • Capacity to deal with high loads.

Requirements

Before you start

  • Make sure you gcloud is initialized using gcloud init command.
  • Make sure you created project at Google Cloud Platform Console and set it on your console using gcloud config set project PROJECT_ID.
  • Login to Google Console find Firesore section and make sure that your project is running on Native mode. If your project is already using Datastore mode you might need to create a new project.

Installation

  1. Create a project in the Google Cloud Platform Console.

  2. Install and initialize (gcloud init) gcloud command-line tool.

  3. Create firevel project with:

composer create-project firevel/firevel
  1. Deploy project with:
gcloud app deploy

Firevel does not require any credentials while running inside App Engine. If you like to run it locally you will also need to set GOOGLE_CLOUD_PROJECT and GOOGLE_APPLICATION_CREDENTIALS .env variables. If you prefer to use git clone https://github.com/firevel/firevel.git, you should also run php artisan firevel:generate:app to generate your app.yaml file. You might also need to enable App Engine Admin API.

Local development

To setup local environment you can use docker-compose.yml:

version: '3'

volumes:
  firestore-data:

services:
  firestore:
    image: pathmotion/firestore-emulator-docker
    volumes:
      - firestore-data:/opt/data
    environment:
      - FIRESTORE_PROJECT_ID=${DB_DATABASE}
  app:
    image: firevel/firevel:php73
    volumes:
      - ./:/var/www/app

Differences between Laravel and Firevel.

Firevel is a Laravel 7 after small updates and packages installation:

Usage

You can use Firevel in the same way you use Laravel. Be aware of Firebase limits and Google App Engine limits.

You should also replace Eloquent models with Firequent, by using use Firevel\Firequent\Model; instead of use Illuminate\Database\Eloquent\Model; inside a model class. Keep in mind that Firequent is in beta and support only basic queries.

File Storage

By default Firevel running inside App Engine is using Google Cloud Storage file system, and {GOOGLE_CLOUD_PROJECT}.appspot.com/services/{GAE_SERVICE}/storage/ path.

CI

You can run a simple CI process with gcloud builds submit --config cloudbuild.yaml --substitutions _APP_KEY= with your production API key at the end. You can also connect it with your existing repository but remember about setting _APP_KEY in substitution variables.

You also must grant App Engine access to the Cloud Build service account.

Workers

If you are going to use serverless workers, install https://github.com/firevel/cloud-tasks-queue-driver.

Roadmap

  • Laravel 8 base.
  • CI generator as separate package.
  • Improved MySQL handling (socket connections + passwordless authentication).
  • File cache.

More

Credits