init
This commit is contained in:
Executable
+3
@@ -0,0 +1,3 @@
|
||||
511.kendeji.fun:443 {
|
||||
reverse_proxy 127.0.0.1:8511
|
||||
}
|
||||
Executable
+22
@@ -0,0 +1,22 @@
|
||||
FROM python:3.12-slim-bookworm
|
||||
|
||||
ENV PYTHONDONTWRITEBYTECODE=1 \
|
||||
PYTHONUNBUFFERED=1 \
|
||||
PIP_DISABLE_PIP_VERSION_CHECK=1 \
|
||||
PYTHONPATH=/app/src:/app/domains/seat/src
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY pyproject.toml ./
|
||||
COPY src ./src
|
||||
COPY apps ./apps
|
||||
COPY config ./config
|
||||
COPY contracts ./contracts
|
||||
COPY domains ./domains
|
||||
COPY platforms ./platforms
|
||||
|
||||
RUN python -m pip install --no-cache-dir ".[llm]"
|
||||
|
||||
EXPOSE 8000
|
||||
|
||||
CMD ["python", "-m", "cognitive_agent.server", "--host", "0.0.0.0", "--port", "8000"]
|
||||
Executable
+51
@@ -0,0 +1,51 @@
|
||||
# Fixed public deployment
|
||||
|
||||
The public demo is hosted directly on the server at
|
||||
`https://511.kendeji.fun`. Caddy terminates HTTPS and proxies only to the
|
||||
container port bound on `127.0.0.1:8511`; the application port is not exposed
|
||||
to the public network.
|
||||
|
||||
The server layout is:
|
||||
|
||||
```text
|
||||
/opt/511-project/
|
||||
├── .env # OpenAI connection settings, mode 0600
|
||||
├── .env.auth # Web authentication settings, mode 0600
|
||||
├── deploy/server/
|
||||
├── artifacts/runs/ # Persistent request artifacts
|
||||
└── artifacts/user-presets/
|
||||
```
|
||||
|
||||
Build and start the service:
|
||||
|
||||
```bash
|
||||
cd /opt/511-project
|
||||
chown -R root:root artifacts/runs artifacts/user-presets
|
||||
chmod 0700 artifacts/runs artifacts/user-presets
|
||||
docker compose -f deploy/server/compose.yaml up -d --build
|
||||
docker compose -f deploy/server/compose.yaml ps
|
||||
```
|
||||
|
||||
Add `deploy/server/Caddyfile.example` to the host Caddyfile, validate, and
|
||||
reload Caddy:
|
||||
|
||||
```bash
|
||||
caddy validate --config /etc/caddy/Caddyfile
|
||||
systemctl restart caddy
|
||||
```
|
||||
|
||||
This host disables Caddy's admin endpoint, so `caddy reload` and
|
||||
`systemctl reload caddy` cannot apply configuration. Validate first, then use a
|
||||
service restart.
|
||||
|
||||
Operational checks:
|
||||
|
||||
```bash
|
||||
curl -I https://511.kendeji.fun/
|
||||
docker compose -f /opt/511-project/deploy/server/compose.yaml logs --tail=100
|
||||
systemctl status caddy
|
||||
```
|
||||
|
||||
Never place `.env`, `.env.auth`, API keys, login passwords, or SSH credentials
|
||||
inside the image or source control. Updating the application uses the same
|
||||
source synchronization followed by `docker compose ... up -d --build`.
|
||||
Executable
+50
@@ -0,0 +1,50 @@
|
||||
name: cognitive-agent-511
|
||||
|
||||
services:
|
||||
web:
|
||||
build:
|
||||
context: ../..
|
||||
dockerfile: deploy/server/Dockerfile
|
||||
image: cognitive-agent-511:latest
|
||||
container_name: cognitive-agent-511
|
||||
restart: unless-stopped
|
||||
init: true
|
||||
env_file:
|
||||
- path: ../../.env
|
||||
format: raw
|
||||
- path: ../../.env.auth
|
||||
format: raw
|
||||
environment:
|
||||
HOST: 0.0.0.0
|
||||
PORT: "8000"
|
||||
PYTHONDONTWRITEBYTECODE: "1"
|
||||
PYTHONUNBUFFERED: "1"
|
||||
PYTHONPATH: /app/src:/app/domains/seat/src
|
||||
ports:
|
||||
- "127.0.0.1:8511:8000"
|
||||
volumes:
|
||||
- ../../artifacts/runs:/app/artifacts/runs
|
||||
- ../../artifacts/user-presets:/app/artifacts/user-presets
|
||||
read_only: true
|
||||
tmpfs:
|
||||
- /tmp:size=64m,mode=1777
|
||||
cap_drop:
|
||||
- ALL
|
||||
security_opt:
|
||||
- no-new-privileges:true
|
||||
pids_limit: 256
|
||||
healthcheck:
|
||||
test:
|
||||
- CMD
|
||||
- python
|
||||
- -c
|
||||
- import urllib.request; urllib.request.urlopen("http://127.0.0.1:8000/login", timeout=3)
|
||||
interval: 30s
|
||||
timeout: 5s
|
||||
retries: 3
|
||||
start_period: 20s
|
||||
logging:
|
||||
driver: json-file
|
||||
options:
|
||||
max-size: 10m
|
||||
max-file: "3"
|
||||
Reference in New Issue
Block a user