Contribute
3 minute read
Make sure you have completed the registry setup.
Brezel API
1. Clone the Brezel API
git clone git@gitlab.kiwis-and-brownies.de:kibro/brezel/api.git
2. Install or update the Brezel components
Go the directory you just cloned:
cd api
Install composer packages:
composer install
3. Create the Database
Create a new MySQL database called brezel_api
. This will be the meta database for one or more Brezel systems. In MySQL, execute the following command:
CREATE DATABASE brezel_api
4. Configure your Brezel environment
Copy the .env.example
file to .env
and edit the .env
file.
For a full list of settable environment variables, consult the environment variable reference . To get started, make sure to set the following variables:
General settings
APP_URL="http://api.test"
Database settings
TENANCY_HOST=127.0.0.1
TENANCY_PORT=3306
TENANCY_DATABASE="brezel_api"
TENANCY_USERNAME="<user>"
TENANCY_PASSWORD="<password>"
Brezel settings
BREZEL_EXPORT_URL="https://export.staging.cluster-sw.brezel.io"
5. Set up your web server
macOS, Linux
If you used valet in the webserver setup :
valet link
Now valet created the symbolic link api.test
to your Brezel instance. This is where the Brezel API is reachable from now on.
Windows
Go to the Brezel directory and run the following script on the Windows terminal:
bin\serve_on_windows.ps1
6. Initialize the API
Next, we have to initialize all components.
First, generate the APP_KEY
:
php artisan key:generate
Generate VAPID keys to enable Web Push notifications:
php artisan webpush:vapid
Migrate the databases:
php artisan migrate
php artisan tenancy:migrate
Create test systems that you can define in database/seeds
:
php artisan recreate:system --all
Seed the test systems:
php artisan bakery:apply
To just see what Brezel plans to change, do:
php artisan bakery:plan
SPA
1. Clone the frontend SPA
git clone git@gitlab.kiwis-and-brownies.de:kibro/brezel/spa.git
2. Install NPM packages
Go the directory you just cloned:
cd spa
Install npm packages:
npm install
3. Configure your Brezel SPA environment
Note
Only variables that are prefixed withVUE_
are baked into client JS scripts.Do not put sensitive values here.
VUE_APP_API_URL="http://brezel.test"
4. Run the SPA service
In the Brezel directory, start the SPA development server:
npm run serve
The service will listen on localhost:8080 or the nearest open port.
Linking API & SPA with a separate Brezel instance
Linking SPA
Note
This only works with SPA > 2.0.0.First, register your SPA repository with your local npm.
cd /path/to/spa
npm link
Then, in your Brezel instance, link the SPA package to your SPA repository:
cd /path/to/brezel
npm link @kibro/brezel-spa
Finally, in your Brezel instance, configure your imports to point to src
instead of dist
.
Go to src/main.js
and replace
import { Brezel } from '@kibro/brezel-spa'
with
import Brezel from '@kibro/brezel-spa/src/brezel.js'
Go to src/App.vue
and replace
import { App as BrezelApp } from '@kibro/brezel-spa'
with
import BrezelApp from '@kibro/brezel-spa/src/components/App.vue'
Then, start your dev server normally.
npm run dev
Linking API
There are two ways to link API. The easy way is using the composer package composer-link
and is described here.
- Install the package globally:
composer global require sandersander/composer-link
- Run this in the root folder of the brezel instance where you want to link your local api to:
composer link <path/to/your/local/api/repo>
Unlinking:
Just run composer unlink <path/to/your/local/api/repo>
in the same directory you ran link in before.