This example docker-compose setup is explicitly for handsup corporate backend project. However, you might find it useful to setup your own local environment for whatever you are building.
This stack is composed of [email protected], nginx, MySQL and Redis.
As I came across setting up local dev environment, installing PHP on macos is really a pain in the ass. It took me 3 days to complete the environment setup. Thought it would be useful to have a consistent environment setup guide for future new comers on handsup-api project.
git clone [email protected]:huangc28/handsup-docker-example.git
Move docker-compose.example.yml
to your handsup-api
root project directory.
Create a local SSL certificate using mkcert. you will get two files
{{ YOUR_DOMAIN }}.key.pem
{{ YOUR_DOMAIN }}.pem
Rename {{ YOUR_DOMAIN }}.key.pem
to {{ YOUR_DOMAIN }}.key
and place it in docker/php
.
Rename {{ YOUR_DOMAIN }}.pem
to {{ YOUR_DOMAIN }}.crt
and place it in docker/php
.
Move your ~/.ssh/id_rsa
and ~/.ssh/id_rsa.pub
to docker/php
. The reason being that we need ssh key to pull dependencies from handsup private registry.
Copy and paste the content in .env.example
file to your handsup-api
project root .env
file. The following env variables are needed to spin up docker-compose
properly.
APP_PORT=8888
APP_TSL_PORT=443
SYSTEM_ENV=DOCKER
PROJECT_PATH=/var/www
MYSQL_SERVER=127.0.0.1
MYSQL_PORT=3306
MYSQL_ROOT_PASSWORD=
REDIS_SERVER=127.0.0.1
REDIS_PORT=6379
prompt docker-compose up
to spin up the stack. prompt http://localhost:8888
in the browser, you should see laravel index page. you are ready to go!