test: trigger pipeline
This commit is contained in:
20
cfg/amar/soleprint/Dockerfile.fastapi
Normal file
20
cfg/amar/soleprint/Dockerfile.fastapi
Normal file
@@ -0,0 +1,20 @@
|
||||
FROM python:3.11-slim
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Install system dependencies
|
||||
RUN apt-get update && apt-get install -y \
|
||||
gcc \
|
||||
libpq-dev \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Install Python dependencies
|
||||
COPY requirements.txt .
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
# Copy application
|
||||
COPY . .
|
||||
|
||||
EXPOSE 8000
|
||||
|
||||
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
|
||||
118
cfg/amar/soleprint/README.nginx.md
Normal file
118
cfg/amar/soleprint/README.nginx.md
Normal file
@@ -0,0 +1,118 @@
|
||||
# Nginx for Local Development
|
||||
|
||||
## Overview
|
||||
|
||||
The `docker-compose.nginx.yml` file provides an **optional** nginx container for local development. This is **NOT** used on AWS (which uses bare metal nginx).
|
||||
|
||||
## When to Use
|
||||
|
||||
Use nginx container when you want to access services via friendly domains locally:
|
||||
- `http://amarmascotas.local.com` → amar
|
||||
- `http://soleprint.local.com` → soleprint + services
|
||||
|
||||
## Setup
|
||||
|
||||
### 1. Generate Nginx Config
|
||||
|
||||
```bash
|
||||
cd ../ctrl/server
|
||||
./setup.sh --local
|
||||
```
|
||||
|
||||
This creates `/tmp/core_room.conf` with your local domain routing.
|
||||
|
||||
### 2. Ensure /etc/hosts is configured
|
||||
|
||||
```bash
|
||||
# Should already be there, but verify:
|
||||
grep "127.0.0.1.*amarmascotas.local.com" /etc/hosts
|
||||
grep "127.0.0.1.*soleprint.local.com" /etc/hosts
|
||||
```
|
||||
|
||||
### 3. Stop bare metal nginx (if running)
|
||||
|
||||
```bash
|
||||
sudo systemctl stop nginx
|
||||
# Optional: disable so it doesn't start on boot
|
||||
sudo systemctl disable nginx
|
||||
```
|
||||
|
||||
### 4. Start services WITH nginx
|
||||
|
||||
```bash
|
||||
cd ../ctrl
|
||||
./start.sh --with-nginx
|
||||
# OR manually:
|
||||
cd ../soleprint
|
||||
docker compose -f docker-compose.yml -f docker-compose.nginx.yml up -d
|
||||
```
|
||||
|
||||
## Without Nginx (Default)
|
||||
|
||||
If you don't use nginx, services are accessed via ports:
|
||||
- `http://localhost:3000` → amar frontend
|
||||
- `http://localhost:8000` → amar backend
|
||||
- `http://localhost:13000` → soleprint
|
||||
- `http://localhost:13001` → artery
|
||||
- `http://localhost:13002` → album
|
||||
- `http://localhost:13003` → ward
|
||||
|
||||
The default `docker-compose.yml` exposes these ports, so it works either way.
|
||||
|
||||
## Switching Between Nginx and Direct Access
|
||||
|
||||
**To use nginx routing:**
|
||||
```bash
|
||||
# Stop direct port access
|
||||
cd ../ctrl && ./stop.sh
|
||||
|
||||
# Start with nginx
|
||||
./start.sh --with-nginx
|
||||
```
|
||||
|
||||
**To go back to direct ports:**
|
||||
```bash
|
||||
# Stop nginx version
|
||||
cd ../soleprint
|
||||
docker compose -f docker-compose.yml -f docker-compose.nginx.yml down
|
||||
|
||||
# Start without nginx
|
||||
cd ../ctrl && ./start.sh
|
||||
```
|
||||
|
||||
## AWS Production
|
||||
|
||||
On AWS, **do NOT use** `docker-compose.nginx.yml`. The AWS setup uses bare metal nginx configured via `ctrl/server/setup.sh --production`.
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
**Port 80 already in use:**
|
||||
```bash
|
||||
# Check what's using it
|
||||
ss -tlnp | grep :80
|
||||
|
||||
# If it's nginx bare metal
|
||||
sudo systemctl stop nginx
|
||||
|
||||
# If it's another container
|
||||
docker ps | grep :80
|
||||
docker stop <container_name>
|
||||
```
|
||||
|
||||
**Config not found error:**
|
||||
```bash
|
||||
# Make sure you ran setup first
|
||||
cd ../ctrl/server && ./setup.sh --local
|
||||
|
||||
# Verify config exists
|
||||
ls -la /tmp/core_room.conf
|
||||
```
|
||||
|
||||
**DNS not resolving:**
|
||||
```bash
|
||||
# Check /etc/hosts
|
||||
cat /etc/hosts | grep local.com
|
||||
|
||||
# Test DNS
|
||||
ping -c 1 amarmascotas.local.com
|
||||
```
|
||||
45
cfg/amar/soleprint/docker-compose.nginx.yml
Normal file
45
cfg/amar/soleprint/docker-compose.nginx.yml
Normal file
@@ -0,0 +1,45 @@
|
||||
# Nginx Reverse Proxy for Local Development
|
||||
#
|
||||
# This is OPTIONAL - only for local development
|
||||
# AWS uses bare metal nginx instead
|
||||
#
|
||||
# Usage:
|
||||
# docker compose -f docker-compose.yml -f docker-compose.nginx.yml up -d
|
||||
#
|
||||
# Before using:
|
||||
# 1. Generate nginx config: cd ../ctrl/server && ./setup.sh --local
|
||||
# 2. Stop bare metal nginx: sudo systemctl stop nginx (if installed)
|
||||
#
|
||||
# This nginx container will:
|
||||
# - Listen on port 80
|
||||
# - Route amarmascotas.local.com to amar frontend/backend
|
||||
# - Route soleprint.local.com to soleprint services
|
||||
|
||||
services:
|
||||
nginx:
|
||||
image: nginx:alpine
|
||||
container_name: ${DEPLOYMENT_NAME}_nginx
|
||||
ports:
|
||||
- "80:80"
|
||||
volumes:
|
||||
# Mount template that will be processed with envsubst
|
||||
- ../ctrl/server/nginx/docker-local.conf:/etc/nginx/templates/default.conf.template:ro
|
||||
# Mount wrapper files for serving
|
||||
- ../wrapper:/app/wrapper:ro
|
||||
env_file:
|
||||
- .env
|
||||
environment:
|
||||
- DEPLOYMENT_NAME=${DEPLOYMENT_NAME}
|
||||
- ROOM_NAME=${ROOM_NAME}
|
||||
- MANAGED_DOMAIN=${MANAGED_DOMAIN}
|
||||
- SOLEPRINT_DOMAIN=${SOLEPRINT_DOMAIN}
|
||||
networks:
|
||||
- default
|
||||
depends_on:
|
||||
- soleprint
|
||||
restart: unless-stopped
|
||||
|
||||
networks:
|
||||
default:
|
||||
external: true
|
||||
name: ${NETWORK_NAME}
|
||||
Reference in New Issue
Block a user