You can download the repo as a zip, or clone on your workspace if you have the proper git setup:
git clone [email protected]:pitylee/restApi.git
If you are not already in laradock
directory, first change the current dir where you have the project:
cd /path/to/project/dir/
And then pull the laradock submodule, in some cases with older version of git this is needed:
git submodule update --init --recursive
While a stable internet connection is needed, you may have to install Docker (Desktop) and Docker Compose if you don't have already installed. If you still have to install, please follow the official docs to do so here and here.
To give executive permission, run the following command:
chmod +x ./start
You have to copy the nginx default.conf file from the root, to the laradock submodule's nginx sites directory:
cp default.conf ./laradock/nginx/sites/default.conf
You have to copy the corresponding .env file from the root, to the laradock submodule's directory:
cp .env.laradock ./laradock/.env
You have to copy the corresponding .env file from the root, to the server directory for Laravel:
cp .env.laravel ./server/.env
At this point, if you have already ran Laradock, you have to restart your Docker Desktop, and re-build the images, more specifically the nginx one, in order to force load the nginx configuration.
For short usage on Mac and Linux, you can run via the file which contains the commands:
./start
This will run the docker-compose
commands, or you can rule them manually, via running in the terminal of your
preference:
cd ./laradock
docker-compose up -d --build nginx mysql redis php-worker
docker-compose exec --user=laradock workspace bash
When you see the that the Docker containers are up and running, and entered the workspace with one of the two solutions from above, you want to do a few small things:
cd server/
composer install
php artisan key:generate
By default, the username and password for Laradock Mysql will be root:root. This is included in the .env, but you may want to double check with DBeaver, your Database editor of your <3's choice.
The migration:
php artisan migrate
The seeds:
php artisan db:seed SeedApiKeysTable
php artisan db:seed SeedEmployeePositionsTable
php artisan db:seed SeedEmployeesTable
The tests:
php artisan test
-
It can come in handy, that we have logs about the incoming requests + the generated MAC can be seen there as well. GUI for this: http://localhost/log-viewer/
-
The Postman collection can be found in the root of the repo: restApi.postman_collection.json
It can be imported, and used, MAC may need to be copied from above, and some data altered accordingly.
- If you have a 500 error, in the laradock/ folder:
docker-compose logs nginx
- For when Docker fails to run LLB:
export DOCKER_BUILDKIT=0
export COMPOSE_DOCKER_CLI_BUILD=0