API Monorepo to Instance
2 minute read
This guide explains how to move a system that is defined in the brezel/api
repository under database/seeds/<system>
to a separate repository.
1. Set up a new Brezel instance
- Follow the Installation guide to install a new Brezel instance.
- Complete the Setup guide.
2. Copy system assets
- In the
systems
directory, delete theexamples
directory and copy thedatabase/seeds/<system>
directory to this location. - In the
brezel/spa
repository, copy the contents ofpublic/systems/<system>
to thepublic/assets
directory in your new instance.
Note
If you want your instance to support multiple systems, you need to adjust the system resolution logic in yoursrc/main.js
and switch out the logo in src/App.vue
depending on the current system accordingly.2. Deploy the Brezel instance
- Depending on the desired deployment target, follow the Deployment guide to deploy your Brezel instance on your server or cluster.
3. Copy the database
- Use
mysqldump
to export the existing system database on the brezel.io VM:
mysqldump -u api.brezel -p brezel_api_<system> > brezel_api_<system>.sql
- Upload the
brezel_api_<system>.sql
to your deployment target. - If the system database on your deployment target was already created in the deployment or setup step, and no relevant data is there, drop the system database. It is usually called
brezel_<system>
. - Create the database
brezel_<system>
again. - Import the database:
mysql -uroot -p brezel_<system> < brezel_api_<system>.sql
This might take a few minutes.
4. Delete the old system
- In the
brezel.io
VM, delete the system:
php artisan brezel:system delete <system>
- In the
brezel/api
repository, delete thedatabse/seeds/<system>
directory.