Skip to content

Commit 8f18235

Browse files
committed
feat: Update SSL configuration in environment files and documentation
- Modified `.env.example` to clarify SSL certificate paths for Docker and non-Docker deployments. - Updated `docker-compose.ghcr.yml` and `docker-compose.yml` to use a dynamic path for SSL certificates, enhancing flexibility. - Revised `CONFIGURATION.md` to provide detailed instructions for SSL setup in both Docker and non-Docker environments.
1 parent 4822649 commit 8f18235

4 files changed

Lines changed: 52 additions & 19 deletions

File tree

.env.example

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,17 @@ API_RELOAD=false
99
# SSL/HTTPS Configuration
1010
ENABLE_HTTPS=false
1111
HTTPS_PORT=443
12-
SSL_CERT_FILE=/app/ssl/cert.pem
13-
SSL_KEY_FILE=/app/ssl/key.pem
1412
SSL_REDIRECT=false
15-
# SSL_CA_CERTS=/app/ssl/ca.pem # Optional CA certificates
13+
14+
# Docker: Path to directory containing cert.pem and key.pem on the host
15+
# The directory is mounted to /app/ssl/ inside the container automatically.
16+
# Default is ./ssl (relative to docker-compose.yml)
17+
# SSL_CERTS_PATH=/path/to/your/ssl/certs
18+
19+
# Non-Docker only: Absolute paths to certificate files (not needed for Docker)
20+
# SSL_CERT_FILE=/path/to/cert.pem
21+
# SSL_KEY_FILE=/path/to/key.pem
22+
# SSL_CA_CERTS=/path/to/ca.pem
1623

1724
# Authentication Configuration
1825
API_KEY=your-secure-api-key-here-change-this-in-production

docker-compose.ghcr.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
services:
22
# Code Interpreter API
33
api:
4-
image: ghcr.io/usnavy13/librecodeinterpreter:dev
4+
image: ghcr.io/usnavy13/librecodeinterpreter:latest
55
container_name: code-interpreter-api
66
user: "1000:988" # Run as user with docker group access
77
cap_add:
@@ -16,7 +16,7 @@ services:
1616
- API_HOST=0.0.0.0
1717
- API_PORT=8000
1818
- DOCKER_IMAGE_REGISTRY=ghcr.io/usnavy13/librecodeinterpreter
19-
- DOCKER_IMAGE_TAG=${DOCKER_IMAGE_TAG:-dev}
19+
- DOCKER_IMAGE_TAG=${DOCKER_IMAGE_TAG:-latest}
2020

2121
# Service discovery (container names)
2222
- REDIS_HOST=redis
@@ -33,7 +33,7 @@ services:
3333
- /var/run/docker.sock:/var/run/docker.sock
3434
- ./logs:/app/logs
3535
- ./data:/app/data
36-
- ./ssl:/app/ssl
36+
- ${SSL_CERTS_PATH:-./ssl}:/app/ssl
3737
depends_on:
3838
- redis
3939
- minio

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ services:
3737
- /var/run/docker.sock:/var/run/docker.sock
3838
- ./logs:/app/logs
3939
- ./data:/app/data
40-
- ./ssl:/app/ssl
40+
- ${SSL_CERTS_PATH:-./ssl}:/app/ssl
4141
- ./dashboard:/app/dashboard
4242
- ./src:/app/src
4343
depends_on:

docs/CONFIGURATION.md

Lines changed: 38 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -43,16 +43,29 @@ Controls the basic API server settings.
4343

4444
Configures SSL/TLS support for secure HTTPS connections.
4545

46-
| Variable | Default | Description |
47-
| --------------- | ------- | ------------------------------------------- |
48-
| `ENABLE_HTTPS` | `false` | Enable HTTPS/SSL support |
49-
| `HTTPS_PORT` | `443` | HTTPS server port |
50-
| `SSL_CERT_FILE` | - | Path to SSL certificate file (.crt or .pem) |
51-
| `SSL_KEY_FILE` | - | Path to SSL private key file (.key) |
52-
| `SSL_REDIRECT` | `false` | Redirect HTTP traffic to HTTPS |
53-
| `SSL_CA_CERTS` | - | Path to CA certificates file (optional) |
46+
#### Docker Deployments
5447

55-
**HTTPS Setup:**
48+
| Variable | Default | Description |
49+
| ---------------- | -------- | -------------------------------------------------------- |
50+
| `ENABLE_HTTPS` | `false` | Enable HTTPS/SSL support |
51+
| `HTTPS_PORT` | `443` | HTTPS server port |
52+
| `SSL_CERTS_PATH` | `./ssl` | Host path to directory containing `cert.pem` and `key.pem` |
53+
| `SSL_REDIRECT` | `false` | Redirect HTTP traffic to HTTPS |
54+
55+
> **Note:** When using Docker, the certificate files are automatically mapped to `/app/ssl/` inside the container. You only need to set `SSL_CERTS_PATH` to point to your certificates directory on the host.
56+
57+
#### Non-Docker Deployments
58+
59+
| Variable | Default | Description |
60+
| ---------------- | -------- | -------------------------------------------------------- |
61+
| `ENABLE_HTTPS` | `false` | Enable HTTPS/SSL support |
62+
| `HTTPS_PORT` | `443` | HTTPS server port |
63+
| `SSL_CERT_FILE` | - | Absolute path to SSL certificate file (.pem) |
64+
| `SSL_KEY_FILE` | - | Absolute path to SSL private key file (.pem) |
65+
| `SSL_CA_CERTS` | - | Path to CA certificates file (optional) |
66+
| `SSL_REDIRECT` | `false` | Redirect HTTP traffic to HTTPS |
67+
68+
**HTTPS Setup (Docker):**
5669

5770
1. **Generate or obtain SSL certificates**:
5871

@@ -69,17 +82,30 @@ Configures SSL/TLS support for secure HTTPS connections.
6982
```bash
7083
ENABLE_HTTPS=true
7184
HTTPS_PORT=443
72-
SSL_CERT_FILE=/app/ssl/cert.pem
73-
SSL_KEY_FILE=/app/ssl/key.pem
7485
SSL_REDIRECT=true # Optional: redirect HTTP to HTTPS
86+
87+
# If using the default ./ssl directory, no additional config needed.
88+
# If your certs are elsewhere, set the path:
89+
# SSL_CERTS_PATH=/path/to/your/ssl/certs
7590
```
7691

92+
The directory must contain files named `cert.pem` and `key.pem`.
93+
7794
3. **Deploy with Docker Compose**:
7895
```bash
79-
# Make sure SSL certificates are in ./ssl/ directory
8096
docker-compose up -d
8197
```
8298

99+
**HTTPS Setup (Non-Docker):**
100+
101+
```bash
102+
ENABLE_HTTPS=true
103+
HTTPS_PORT=443
104+
SSL_CERT_FILE=/absolute/path/to/cert.pem
105+
SSL_KEY_FILE=/absolute/path/to/key.pem
106+
SSL_REDIRECT=true
107+
```
108+
83109
**Security Notes:**
84110

85111
- Use certificates from trusted Certificate Authorities in production

0 commit comments

Comments
 (0)