- Notifications
You must be signed in to change notification settings - Fork1
nik2208/php-crud-api-quick-start
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
A customizable, ready-to-go, Docker Compose file featuring
- PHP-CRUD-API
- MySQL
- PHP-FPM
- NGINX
- ADMINER/PHPMYADMIN
- SWAGGER (OPENAPI)
Just pull the repogit clone https://github.com/nik2208/php-crud-api-quick-start.git && cd php-crud-api-quick-start, rename the file.env.sample into.env and set the environment values to suite your needs:
#rename to .env# DOCKER STACK EXPOSED PORT.PORT=8080# API SUBDOMAIN (DNS RECORD A) OR HTTP(S)://IP_ADDRESS:PORT/ IF LOCALLY DEPLOYED# IF YOU DON'T HAVE AN FQDN (FULLY QUALIFIED DOMAIN NAME) AND YOU USE AN IP ADDRESS# (WHETHER PUBLIC OR PRIVATE), THE ADDRESS MUST CONTAIN THE STACK-EXPOSED PORT AS# CONFIGURED IN THE PREVIOUS STEP.SERVER_NAME=http://127.0.0.1:8080/############################################DATABASE PARAMETERSMYSQL_ROOT_PASSWORD=samplepasswordMYSQL_DATABASE=sampledbMYSQL_USER=sampleuserMYSQL_PASSWORD=samplepassword############################################API.PHP PARAMETERS#DEBUG MODEPHP_CRUD_API_DEBUG=1############################################DB ADMIN TOOL ("adminer" OR "phpmyadmin")DB_ADMIN_TOOL=phpmyadmin############################################CONTAINERS' NAME SUFFIXCONTAINERS_NAME_SUFFIX=php-quick-start
Then runstart.sh. Enjoy!🎉🚀
To stop the stack runstop.sh.
Refer toPHP-CRUD-API for further customizations.
- Any host runnignDocker andDocker Compose.
In case your running your instance on localhost and your selected port is 8080.
Yourtests table will be available athttp://127.0.0.1:8080/records/tests (no need of explicit api.php)1
Your MYSQL ADMIN instance will be available athttp://127.0.0.1:8080/dbadmin/
Your SWAGGER instance will be available athttp://127.0.0.1:8080/swagger/
Change ip and port accordingly if host and port differ.
- Any host runningDocker andDocker Compose.
- A FQDN (Fully Qualified Domain Name), a public IP, areverse proxy to forwardYOUR A RECORD requests (e.g. api.exemple.com) to your Docker host2.
Yourtests table will be available athttps://api.example.com/records/tests (no need of explicit api.php)1
Your MYSQL ADMIN instance will be available athttps://api.example.com/dbadmin/
Your SWAGGER instance will be available athttps://api.example.com/swagger/
After starting the Docker containers usingdocker-compose up -d, the MySQL database will be created and stored in themysql folder of the cloned project. This folder is used to persist the database data between container restarts. It is important to regularly back up this folder to avoid data loss.
A.gitlab-ci.yml file is provided.3
The CI/CD flow expects to find a cloned repository on the deploying host, and the.env file properly set for that specific host/environment.The provided Gitlab pipeline encompasses three branches, related to three hosts/environments:
- develop
- staging
- prod
Merges intodevelop will update the development environment, merges intostaging will update the staging environment, a commit tag will update the production environment.
Footnotes
About
A ready to go, customizable, docker stack for PHP-CRUD-API
Resources
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Contributors2
Uh oh!
There was an error while loading.Please reload this page.