-
Notifications
You must be signed in to change notification settings - Fork 0
Getting started
These are some instructions on how to get set up. We will use Laradock in this case. If you just need instructions how to get Laravel and the React app running, you can skip the first part, and start from installing Laravel with composer install
.
To use Laradock, make sure you have Docker and Docker-compose installed.
We are going to follow the instructions on the Laradock site here (single new project): https://laradock.io/getting-started/#A2
From the directory where you want to install the app, clone both Laradock and the project repo:
git clone https://github.com/laradock/laradock.git
git clone https://github.com/CodeHubOrg/codehub-mentorships
After this, you will have laradock and codehub-mentorships subdirectories.
Cd into the laradock directory and copy the env-example file to .env:
cd laradock
cp env-example .env
In the .env file, you add the path to the project directory at the top:
APP_CODE_PATH_HOST=../codehub-mentorships/
Change the PHP version to 7.4 and set the MySQL version:
PHP_VERSION=7.4
...
MYSQL_VERSION=8.0.21
Still inside the laradock directory, start up the containers with
docker-compose up -d nginx mysql
Enter the workspace container (this container has access to the files from the project repo):
docker-compose exec workspace bash
Install Laravel with
composer install
Open another terminal or tab, and cd into your project directory; copy .env.example to .env:
cd ..
cd codehub-mentorships
cp .env.example .env
Once you have an .env file in place, you can generate a key for the Laravel app, which will automatically be written to that file. Go back to your workspace container and run:
php artisan key:generate
Go into the laradock directory in your terminal.
To start the containers:
docker-compose up -d nginx mysql
To stop the containers:
docker-compose down
From the root of the project, run npm install
or yarn
to install the dependencies.
To build the app, run npm run dev
and if you want to rebuild the app on save, npm run watch
(yarn dev
or yarn watch
)
Now you should be able to see the default front page of a Laravel app at http://localhost/.