This is for all LNPPers.
A Docker Compose setup for the environment of LNPP.
- Linux
- Nginx
- PostgreSQL
- PHP
- Docker
- Docker Compose
Setup the environment variables:
cp .env.example .env
Run the Docker Compose:
docker-compose up
Or run it in background:
docker-compose up -d
Open the browser and visit the localhost, you will see your app running happily.
You can access the postgreSQL at 127.0.0.1:5432
(default).
Notice that docker/postgres/*
will be created.
Those files are Database archives for PostgreSQL.
Feel free to edit the docker/postgres/.gitignore
if you need.
# Run containers in foreground
docker-compose up
# Or run in background and see the logs (recommended)
docker-compose up -d
docker-compose logs --tail=1000 -f
# --tail: for limit the output logs
# -f: keep following the logs updated
# If you need to build and then run
docker-compose up -d --build
docker-compose down
docker ps
# If your want to check the stopped containers
docker ps -a
The environment variables defined in .env
files:
APP_NAME
: The app namePOSTGRES_USER
: The username to be created for postgresPOSTGRES_PASSWORD
: The password to be created for the user of postgresPOSTGRES_DB
: The database name to be created for the postgresPGDATA_PATH
: The directory for storing the localdata of postgresWEB_SERVER_PORT
: The public port for your web application
In docker/
, there are some initial configuration files for the PHP and Nginx.
php/Dockerfile
: For config the docker image of phpphp/php.ini
: For config the php to use
nginx/nginx.conf
: For config the nginx web server
To run more server at one time, copy the docker/nginx/nginx.conf
and edit the config for creating multiple web server, and then restart the docker compose.
See on Stackoverflow.
In the src/
, create your Laravel application.
Optional: You can change the setting index public/index.php;
in docker/nginx/nginx.conf
if you need.
Restart the docker compose and you will see the application of Laravel.
I hope these contents can help you guys.
Thanks and happy hacking.