addiesaas / forge
AddieSaaS Forge CLI
Requires
- php: 7.*|8.*
- ext-json: *
- psr/log: ^1.0@dev
- sudiptochoudhury/php-cli: 1.*
Requires (Dev)
None
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
AddieSaaS CLI tool to create new AddieSaaS Application as automatically as possible.
The tool does the following:
- Creates the core application - using
git clonefollowed bycomposer install. - Registers external composer repositories (optional).
- Adds containers to the application using
composer require. - Creates and populates
.envfile. - Runs these commands
php artisan key:generatephp artisan config:cachephp artisan route:cachephp artisan migratephp artisan passport:installphp artisan storage:linkphp artisan db:seednpm install && npm run prod
- Resets
composer.jsonandcomposer.lockwith git (unlessno-composer-resetis set).
The Laravel version is defined by the application-core branch/tag that is installed.
Prerequisites
- PHP 8.4 (application-core requires 8.2+)
- MySQL 8, with an empty database created beforehand. The tool does not create the database.
- Composer 2, with Composer's global
vendor/binfolder inPATH - Node 22
- git with SSH access to the Bitbucket repositories
mvandrmshell commands. On Windows use WSL.
USAGE:
addiesaas-forge <OPTIONS> <COMMAND> ...
COMMANDS:
This tool accepts a command as first parameter as outlined below:
create
Create addiesaas.json for new application
install
Install application
STEPS
1. Create
- Open a blank directory.
Run this command.
addiesaas-forge create- A new file named
addiesaas.jsonwill be created. Edit this file in a text editor.- Add/Update/Delete containers (will be discussed later)
- Change options (will be discussed later)
Run this command
addiesaas-forge install
addiesaas.json
A freshly created addiesaas.json using create command looks like this.
{
"team": "addiesaas",
"vcs": "git@bitbucket.org",
"_app": {
"repo": "git@bitbucket.org:addiesaas/application-core.git",
"branch": "master",
"tag": ""
},
"app": "git@bitbucket.org:addiesaas/application-core.git",
"_repositories": {
"name": "url",
"name2": {
"type": "vcs",
"url": "url"
}
},
"repositories": {
},
"containers": {
"container-admin-backpack": "dev-master",
"container-main": "dev-master",
"container-common-containers": "dev-master",
"container-dev-swagger-ui": "dev-master",
"container-pay-biller": "dev-master",
"container-pay-biller-authorizenet": "dev-master",
"container-shop-products": "dev-master",
"container-shop-orders": "dev-master",
"container-builders-embeddedforms": "dev-master",
"container-builders-grapesjs": "dev-master",
"container-builders-surveryjs": "dev-master",
"container-marketing-coupons": "dev-master",
"container-marketing-gift-cards": "dev-master",
"container-marketing-promotion": "dev-master",
"container-marketing-segments": "dev-master",
"container-social-channel": "dev-master"
},
"options": {
"no-pre-install": false,
"keygen": true,
"passport": true,
"config-cache": true,
"route-cache": true,
"storage-link": true,
"migrate": true,
"seed": true,
"npm": true,
"env-create": true,
"env": {
"LOG_CHANNEL": "stack",
"DB_CONNECTION": "mysql",
"DB_HOST": "localhost",
"DB_PORT": 3306,
"DB_DATABASE": "rocketeffect",
"DB_USERNAME": "root",
"DB_PASSWORD": "root",
"MAIL_ENABLED": "false",
"MAIL_DRIVER": "log",
"APP_NAME": "Rocket Effect",
"APP_SHORT_NAME": "RE",
"APP_NAME_SUBTITLE": "Rocket Effect Admin",
"APP_URL": "http://rocketeffect.local",
"MAIL_FROM_ADDRESS": "test@test.test",
"MAIL_FROM_NAME": "Rocket Effect",
"MAIL_TO_SUPPORT_ADDRESS": "test@test.com",
"MAIL_TO_SUPPORT_NAME": "Rocket Effect Support"
}
}
}
Properties of addiesaas.json
All properties prefixed with
_are examples.
team
Team can be any name. You can keep it as it is.
vcs (deprecated)
Main source of the repositories. You can also keep it as it is.
This property is deprecated.
app
The core application repository - git@bitbucket.org:addiesaas/application-core.git
The value can be:
- A string which is the URL of the core application repository. By default, the
masterbranch of the repository will be checked out. - An object with the following properties
repo: The URL of the core application repository, e.g.,"git@bitbucket.org:addiesaas/application-core.git"branch: Name of the branch e.g.,"develop"tag: Name of a tag/version e.g., "v1.5.1"
tagcurrently does not work: the tag checkout runs outside the cloned repository, so thebranchis installed. Usebranchinstead.
The Laravel version is defined by the installed application-core branch/tag.
repositories (optional)
Registers composer packages from external sources.
The value is an object (key-value pairs) where:
- the
key(property name) is a unique name of the package. - The
value(value for each property) can be:- a string representing the URL of the package, usually a git repository URL.
- OR, an object with two properties:
type: Usually the value will be"vcs".url: The URL of the package, usually a git repository URL.
When the
valueis a string, thetypeis assumed asvcs.
Example:
"repositories": {
"modified-ffmpeg": "https://github.com/modifier/laravel-ffmpeg-php72",
"another-example": {
"type": "vcs",
"url": "https://github.com/auther/package"
}
},
containers
Adds addiesaas container to the application.
The value is an object (key-value pairs) where:
the
keyrepresents the name of the container. e.g., "container-shop-products"
Container name have a specific format.- It always starts with
"container-", - followed by section name, e.g.,
"shop"and then a-(dash) followed by the name of the container, e.g.,
"products"Exception: The name
"container-main"does not have a section name.
- It always starts with
the value represents the version/tag e.g.,
"dev-master""dev-develop""1.2.1"
The minimal set of containers is container-main, container-admin-backpack and container-common-containers.
options
Additional options that control the installation of the application.
An option missing from
addiesaas.jsoncounts asfalse. The file generated bycreatesets the options to the values shown below as "stub".
no-pre-install (stub: false)
If set to true, it asks the Tool not to install the core application.
The Tool will assume that the core application is already installed.
The name sounds weird and confusing. We may change it later.
no-composer-reset (not in stub, default: false)
By default, after installation the Tool resets composer.json and composer.lock with git checkout, so the containers installed by composer require are not listed there.
If set to true, the Tool keeps composer.json and composer.lock as they are after installation.
env-create (stub: true)
Asks the Tool to create .env file. If set to false, the Tool will assume that an .env file exists.
When the Tool creates a new
.envfile, it copies from.env.examplefile.
keygen (stub: true)
If set to true, it asks the tool to generate application key in .env file.
Runs the following command:
php artisan key:generate
passport (stub: true)
If set to true, it asks the tool to install Passport keys.
Runs the following command:
php artisan passport:install
config-cache (stub: true)
If set to true, it asks the tool to re-cache config.
Runs the following command:
php artisan config:cache
route-cache (stub: true)
If set to true, it asks the tool to re-cache routes.
Runs the following command:
php artisan route:cache
storage-link (stub: true)
If set to true, it asks the tool to link storage to public.
Runs the following command:
php artisan storage:link
migrate (stub: true)
If set to true, it asks the tool to run data migration..
Runs the following command:
php artisan migrate
seed (stub: true)
If set to true, it asks the tool to seed data to database.
Runs the following command:
php artisan db:seed
npm (stub: true)
If set to true, it asks the tool to install npm packages and build assets.
Runs the following command:
npm install && npm run prod
env
The value accepts an object. The object represents env variables.
The key (property name) represents the name of the env variable.
The value represents the value of the env variable.
Example:
{
"DB_HOST": "localhost",
"DB_PORT": 3306,
"DB_DATABASE": "rocketeffect",
"DB_USERNAME": "root",
"DB_PASSWORD": "root",
}