Initial commit
This commit is contained in:
27
deploy/deploy.sh
Executable file
27
deploy/deploy.sh
Executable file
@@ -0,0 +1,27 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
PROJECT_CODE="PRJ-001"
|
||||
BASE_DIR="/srv/projects/${PROJECT_CODE}"
|
||||
REPO_DIR="${BASE_DIR}/repo"
|
||||
NGINX_LOC_DIR="/etc/nginx/project_locations.d"
|
||||
NGINX_TARGET="${NGINX_LOC_DIR}/${PROJECT_CODE}.conf"
|
||||
|
||||
echo "==> Deploy ${PROJECT_CODE}"
|
||||
|
||||
mkdir -p "${BASE_DIR}"
|
||||
mkdir -p "${NGINX_LOC_DIR}"
|
||||
|
||||
cd "${REPO_DIR}"
|
||||
|
||||
echo "==> Build and start containers"
|
||||
docker compose -f deploy/docker-compose.yml up -d --build
|
||||
|
||||
echo "==> Install nginx route"
|
||||
cp deploy/nginx.location.conf "${NGINX_TARGET}"
|
||||
|
||||
echo "==> Test and reload nginx"
|
||||
nginx -t
|
||||
systemctl reload nginx
|
||||
|
||||
echo "==> Done"
|
||||
10
deploy/docker-compose.yml
Normal file
10
deploy/docker-compose.yml
Normal file
@@ -0,0 +1,10 @@
|
||||
services:
|
||||
web:
|
||||
image: prj-001-demo:latest
|
||||
build:
|
||||
context: ..
|
||||
dockerfile: Dockerfile
|
||||
container_name: prj-001-demo-web
|
||||
restart: always
|
||||
ports:
|
||||
- "21001:80"
|
||||
7
deploy/nginx.location.conf
Normal file
7
deploy/nginx.location.conf
Normal file
@@ -0,0 +1,7 @@
|
||||
location /p/PRJ-001/ {
|
||||
proxy_pass http://127.0.0.1:21001/;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
Reference in New Issue
Block a user