- Install the repository
git clone https://github.com/Cuji12/laravel-cujaneway.git
- Ensure you have PHP 8.1+ installed on your machine with the necessary extensions enabled. You can find a list of what extensions you need by using:
composer check-platform-reqs
in the project folder. - After enabling the necessary PHP extensions, run
composer install
. - You'll need Node 16+ to use Vite with this project, I recommend installing the latest LTS.
- Run
npm install
. - Create a .env file by copying the contents of the .env-example file and populate the values needed to connect to the DB and seed it.
- Generate an app key
php artisan key:generate
. - Open Bash in the PHP container with
docker exec -it laravel-cujaneway-cujaneway-1 bash
(don't mind the stupid name). - Run the migrations and seed the DB
php artisan migrate | php artisan db:seed
. - Sail is used to build the containers & interact with Docker, run
./vendor/bin/sail up
in the root project folder. - After your containers have been built and are running, run the local development server to enable Hot Module Reloading and compile your assets
npm run dev
. - Navigate to http://localhost:80 and you're all set!
This project is deployed to Fly.io, taking the Docker image and transmogrifying them into Firecracker Micro VMs, to deploy to Fly.io you'll need to create an account with them and authorize your usage of the CLI with the given account.
Here are some helpful commands:
- Deploy from your working directory:
fly deploy
- SSH into the production server:
fly ssh console
- Print list of SSL certs:
fly certs list
- Manually scale server:
fly scale {256, 512, 1024, 2048, 4096}
- Set production secrets (fly.toml is in source control, use this to set secrets in production like DB username & password):
fly secrets set MY_SECRET=SECRET_VALUE
Running ./vendor/bin/sail up
is clearly taxing on the fingers so lets create an alias.
- Open your terminal and enter
alias sail='[ -f sail ] && sh sail || sh vendor/bin/sail'
. - Restart your terminal, and now you'll have access to
sail up
and all othersail
commands. - This project uses Laravel Backpack, navigate to http://localhost/admin and enter the details you seeded into the DB.