- Docker version
26.0.0
or higher - Docker Compose version
2.25.0
or higher (It is most likely that the way you installed Docker already came with Docker Compose, so on most systems you probably need not install this) - NVM (Node Version Manager) (Optional, but recommended)
- Spin CLI
- Spin MacOS
- Spin Linux
NVM is used in this project to ensure that the correct version of Node is being used. This is not a requirement, but it is highly recommended. If you do not wish to use NVM, you can simply install the correct version of Node on your host machine and skip the NVM setup.
To install NVM, follow the instructions on the NVM GitHub page | Installing and Updating
After installing NVM, you can install the correct version of Node by running the following command in the root of the project:
nvm install
This will install the version of Node specified in the .nvmrc
file. You can then use this version of Node by running the following command:
nvm use
Details on how to automatically use the correct version of Node when entering the project directory can be found on the NVM GitHub page | Deeper Shell Integration
In order to access the application in a web browser either in local or remote development you will need to place the following in your local /etc/hosts
(or equivalent) file:
127.0.0.1 aidingapp.local
127.0.0.1 mail.tools.aidingapp.local
127.0.0.1 redis.tools.aidingapp.local
127.0.0.1 storage.tools.aidingapp.local
127.0.0.1 media.tools.aidingapp.local
127.0.0.1 aidingapp-minio
127.0.0.1 test.aidingapp.local
Note: If you want any other tenant domains other than
test.aidingapp.local
you will need to add them to youretc/hosts
file in the same way as well.
First, create an .env
file based on .env.example
cp .env.example .env
npm ci
npm run build
docker run --rm \
-u "$(id -u):$(id -g)" \
-v "$(pwd):/var/www/html" \
-w /var/www/html \
laravelsail/php82-composer:latest \
composer install --ignore-platform-reqs
Run the following command to start the containers:
spin up -d
Once the containers are started you can now start a shell into the main PHP container by running the following command:
spin exec -it -u webuser aidingapp.local bash
All following commands will and should be run from within the PHP container.
We will set up the application by running the following commands:
php artisan migrate:landlord:fresh
php artisan key:generate
php artisan queue:restart
php artisan schedule:interrupt
npm run build
The above commands will set up the application for the "landlord" database. The landlord database is in charge of holding all information on tenants. Next we will set up a tenant.
php artisan tenants:create [A Name for the Tenant] [A domain for the tenant]
These commands will create a new tenant with the name and domain you supplied and then refresh and seed the tenant's database.
After this the application should be accessible at the domain you supplied.
Spin can be stopped by running spin stop
and turning back on by running spin up -d
Setup is now complete.
Within the .env.example
(and within the .env
after you copy it) should exist the following variables:
FORWARD_DB_PORT=5434
FORWARD_REDIS_PORT=63793
Those variable will allow you to edit particular settings and forwarding ports for your local containers. A great example of this usage is within the database section below.
Within the containers, Postgres lives on port 5432. And by default it can be accessed outside of the containers on the port set with FORWARD_DB_PORT
.
If the port set with FORWARD_DB_PORT is already in use on your system or you prefer to use another port,
you can set the FORWARD_DB_PORT
in your .env
file to whatever available port you want.
Minio is a S3 compatible storage solution that is used for storing files locally.
When first setting up you will need to create a bucket. This can be done by going to storage.tools.aidingapp.local
in your browser and logging in with aidingapp
as the username and password
as the password. Once logged in, you can create a bucket.
By default, the application is set up in the .env.example
to reference a bucket named local
. Create a bucket with this name in Minio. Then change its access policy to "Custom" with the following policy configuration:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "AllowPublicRead",
"Effect": "Allow",
"Principal": {
"AWS": [
"*"
]
},
"Action": [
"s3:GetObject"
],
"Resource": [
"arn:aws:s3:::local/PUBLIC/*"
]
}
]
}
The application should automatically start a queue worker and scheduler when you run spin up -d
. If you preferred to not have these running. You can see the corresponding env
variables to false like so:
LARAVEL_SCHEDULER_ENABLED=false
LARAVEL_QUEUE_ENABLED=false