brezel/brezel

description

Installs: 42

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

Language:Dockerfile

Type:project

1.6.4 2023-06-26 08:39 UTC

README

This is the skeleton for a Brezel instance.

It represents the latest "recommended" setup for your Brezel Instance repo.

Note: This is for brezel/api 2.0 with brezel/spa 4.0 and up!

For the pre PHP 8 versions, please refer to the 1.x branch.

Usage

Install or update the Brezel components

Install composer packages:

composer update

Install NPM packages:

npm install

Create the Database

Create a new MySQL database called brezel_meta_<some-name>. This will be the meta database for one or more Brezel systems. In MySQL, execute the following command:

CREATE DATABASE brezel_meta_<some-name>

Configure your Brezel environment

Copy the .env.example file to .env and edit the .env file.

For a (mostly) complete list of settable environment variables, consult the environment variable reference. More details are in the .env.example file.

To get started, make sure to set the following variables:

General settings
APP_URL="http://mybrezel.test"
SPA settings

Note: variables that are prefixed with VITE_ are baked into client JS scripts.

Do not put sensitive values here.

APP_URL="http://mybrezel.test"
APP_SYSTEM=example
Database settings
TENANCY_HOST=127.0.0.1
TENANCY_PORT=3306
TENANCY_DATABASE="brezel_meta"
TENANCY_USERNAME="<user>"
TENANCY_PASSWORD="<password>"
Brezel settings
BREZEL_EXPORT_URL="https://export.staging.cluster-sw.brezel.io"

Setup your Brezel

Initialize the database:

php bakery init

Create one or more Brezel systems:

php bakery system create <system>

Run bin/u to apply the current system config.

The directory systems/example holds .bake-configuration files for a system called example. bin/u will sync these to the DB and build your system. If you did not change any workflows and only want to update .bake configurations like modules or entities, use the bakery planner:

php bakery apply

To just see what Brezel plans to change, do:

php bakery plan

To update workflows, run:

php bakery load

Set up your local Dev environment

macOS, Linux

You can use Laravel Valet to serve the API (or php brezel serve).

The SPA is served on port 8080 by the npm run serve command.

You will need to run the queues and websocket server in the background.

php bakery queue:work
php bakery queue:work --queue=brotcasts
php bakery brotcast:start

If you want to have local event/cron elements working, you will have to run php bakery schedule every 60 seconds.

Windows

You can use the same php bakery serve / npm run serve commands as on macOS and Linux, but that will be slow as your API will only be able to work on one request at a time.

A better and faster approach is to use nginx and the included script. For that, install nginx in your path and make sure that both gcm nginx and gcm php-cgi find the correct executables. Go to the Brezel directory and run the following script on the Windows terminal:

bin\serve_on_windows.ps1

If you just want the benefits of an all-in-one script, but don't want to use nginx, you can run it with./bin/serve_on_windows.ps1 $true to disable nginx.