Used as Collector target to back up a non-Laravel project using the Laravel Protector package.
This system uses an internal database for Laravel migrations. The database which is to be backed up is referred to as external.
The database connections can be changed by the following .env
keys:
EXTERNAL_DATABASE_CONNECTION=mysql
INTERNAL_DATABASE_CONNECTION=sqlite
SQLite is used as internal database by default and stored in database/sqlite/connector.sqlite
.
The external database is configured through the following .env
keys:
DB_HOST=external
DB_PORT=3306
DB_DATABASE=external
DB_USERNAME=external
DB_PASSWORD=password
See the Docker Hub repository for images.
To not accidentally upgrade to a new major version, attach the major version you want to use to the image name:
cybexwebdev/connector:0
Here is an example docker-compose.yml
:
version: 'x'
services:
connector:
container_name: connector
image: cybexwebdev/connector:0
volumes:
- connector-sqlite:${SQLITE_DATABASE_FOLDER_PATH:-/var/www/html/database/sqlite}
- ./.env:/var/www/html/.env:ro
volumes:
connector-sqlite:
driver: local
To clone the repository use:
git clone --branch release/v0 --single-branch https://github.com/cybex-gmbh/connector.git
cp .env.example .env
- Migrate the internal database
Caution
If using the Docker image, the initial php artisan migrate
command has to be run as the application
user, else the SQLite file would be created as root
, which leads to
permission issues.
For this, connect with docker compose exec -u application app bash
php artisan migrate
- Create a user
Note
The client which is trying to retrieve a database dump needs to provide their Protector Public Key.
php artisan create:user <publicKey>
Store the returned information in your client's .env
.
For more information take a look at the PullPreview section of the github-workflow repository.
App specific GitHub Secrets:
- PULLPREVIEW_CONNECTOR_USER_PUBLICKEY
- PULLPREVIEW_CONNECTOR_PROTECTOR_AUTH_TOKEN_HASH
The database is seeded with a user with a Protector public key and a Sanctum personal access token by using the GitHub secrets.
Note
You will need any existing setup with Laravel Protector for this.
It is advised to save the created secrets securely in a separate location, as GitHub secrets cannot be viewed after saving.
- Create a Sodium keypair:
php artisan protector:keys
Save the provided public key in the PULLPREVIEW_CONNECTOR_USER_PUBLICKEY
secret.
- Create a Sanctum token
Note
You will need an existing user for this, as a user id has to be provided.
php artisan protector:token <userId>
Take the hash of the token from the personal_access_tokens
table and save it in the PULLPREVIEW_CONNECTOR_PROTECTOR_AUTH_TOKEN_HASH
secret.
The MIT License (MIT). Please see License File for more information.