https://github.com/berquerant/docker-nginx-sandbox
https://github.com/berquerant/docker-nginx-sandbox
docker nginx
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/berquerant/docker-nginx-sandbox
- Owner: berquerant
- Created: 2023-10-25T12:13:52.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-09-14T01:48:33.000Z (almost 2 years ago)
- Last Synced: 2024-09-15T08:02:52.758Z (almost 2 years ago)
- Topics: docker, nginx
- Language: Makefile
- Homepage:
- Size: 144 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# docker-nginx-sandbox
Sandbox for nginx.
# Usage
## Prepare environment
``` shell
pipenv install
pipenv shell
```
## Run nginx and FastAPI application containers
Launch 3 nginx and 3 apps:
``` shell
bin/run.sh 3
```
`docker-compose.yml` is generated, within which nginx0, nginx1, nginx2, api0, api1, api2, httpbin are defined.
Application settings are located in `dist/NUMBER/files/api/`, main.py will be hot-reloaded.
nginx settings are locaied in `dist/NUMBER/nginx/etc/nginx/`.
Run `bin/restart_nginx.sh` to restart nginx containers.
Here are some examples of curl:
```
# nginx0
curl localhost:18000/
# api1
curl localhost:19001/
# api1 via nginx0
curl localhost:18000/api1/
# api2 via nginx1 via nginx0
curl localhost:18000/nginx1/api2/
```
## Regenerate settings files
Do not overwrite existing setting files:
``` shell
bin/run.sh INSTANCE_NUM
```
Overwrite:
``` shell
CLEAN=1 bin/run.sh INSTANCE_NUM
```
Change ports:
``` shell
NGINX_PORT=xxx API_PORT=yyy bin/run.sh INSTANCE_NUM
```
Enable nginx debug log:
``` shell
DEBUG=1 bin/run.sh INSTANCE_NUM
```