Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
354a579
add-traefik-support: Added a stack config setting to allow the revers…
gpeb2 Jan 6, 2026
4f645cb
add-traefik-support: Bumped stack version.
gpeb2 Jan 6, 2026
1124705
add-traefik-support: Added "empty" `TraefikService` class.
gpeb2 Jan 6, 2026
84a1fd5
get debugger working
Ushcode Jan 16, 2026
52332ce
traefik service config file
Ushcode Jan 16, 2026
461b7c6
addreverseproxy method in stack.java
Ushcode Jan 16, 2026
88aca33
remove snashot
Ushcode Jan 20, 2026
711978e
fix version
Ushcode Jan 20, 2026
53e725c
rm redundant import
Ushcode Jan 20, 2026
7667dd9
replace deprecated docker api call
Ushcode Jan 20, 2026
dc8dee1
add-traefik-support: Added a stack config setting to allow the revers…
gpeb2 Jan 6, 2026
d04d90d
add-traefik-support: Bumped stack version.
gpeb2 Jan 6, 2026
70871f6
add-traefik-support: Added "empty" `TraefikService` class.
gpeb2 Jan 6, 2026
e882d97
get debugger working
Ushcode Jan 16, 2026
14bb232
traefik service config file
Ushcode Jan 16, 2026
f0d7239
addreverseproxy method in stack.java
Ushcode Jan 16, 2026
8bc9305
rm redundant import
Ushcode Jan 20, 2026
e81af7a
replace deprecated docker api call
Ushcode Jan 20, 2026
9e3ddfb
Merge branch 'add-traefik-support' of https://github.com/TheWorldAvat…
Ushcode Jan 20, 2026
26f6c7d
rm duplicate docker socket mount for traefik
Ushcode Jan 21, 2026
5784de3
give traefik service clasee a type field
Ushcode Jan 21, 2026
1b4617e
rm bad traefik service starter method
Ushcode Jan 21, 2026
6b50203
fix the reverseProxy string field in StackConfig
Ushcode Jan 21, 2026
55d4d6b
rm an unused import
Ushcode Jan 21, 2026
702924e
organise imports
Ushcode Jan 21, 2026
fbaa083
add a traefik config file
Ushcode Jan 21, 2026
9224d02
implement traefik config method
Ushcode Jan 21, 2026
0c469a5
format and do imports on save for everyone
Ushcode Jan 22, 2026
a95a58a
fix the provider in traefik.yaml
Ushcode Jan 22, 2026
d817ff9
merge the labels
Ushcode Jan 26, 2026
5640561
better name for a method
Ushcode Jan 26, 2026
01fe367
loads of label stuff
Ushcode Jan 26, 2026
8e92c93
customisable stack port
Ushcode Jan 26, 2026
72e0702
rm the bad host port casting
Ushcode Jan 26, 2026
26af8d8
reproduce specific port functionality
Ushcode Jan 28, 2026
2755320
try an auth setup with keycloak env vars
Ushcode Jan 28, 2026
77329b4
stop setting traefik on for all containers
Ushcode Jan 29, 2026
200fe5f
attach request headers to forward auth not response headers
Ushcode Jan 29, 2026
aaad30c
necessary env vars for middleware proxy
Ushcode Jan 29, 2026
e0d9e8b
forwardauth config
Ushcode Feb 6, 2026
6525d18
generalise traefikservice to auth with another authprovider
Ushcode Feb 6, 2026
dcd2eed
oprional reverse proxy type
Ushcode Feb 6, 2026
17a0100
pass env vars into stack-manager app
Ushcode Feb 17, 2026
cf86bbb
format ApiClientExtension
Ushcode Feb 17, 2026
ba973fb
static and dynamic builtin config for traefik via stack
Ushcode Feb 17, 2026
94f7c2a
ignore .env
Ushcode Feb 17, 2026
5a65be9
test skeleton
Ushcode Feb 17, 2026
6134706
auth services config folder
Ushcode Feb 17, 2026
7dc618c
ignore logs and sensitive files
Ushcode Feb 17, 2026
7b29c56
tidy up alternate configs
Ushcode Feb 17, 2026
8cae2fd
deploy script
Ushcode Feb 19, 2026
a9225f5
update hostnames
Ushcode Feb 19, 2026
93227f5
fix compose file for SELinux
Ushcode Feb 19, 2026
6bfa79c
dynamic schema
Ushcode Feb 19, 2026
a25c83c
map to nginx on credo hosts
Ushcode Feb 19, 2026
093b03f
fix test scripts
Ushcode Feb 19, 2026
852996a
update deploy script and doc
Ushcode Feb 20, 2026
545eb7e
update testt script
Ushcode Feb 20, 2026
060529e
call out env var
Ushcode Feb 20, 2026
775e552
clean up auth compose
Ushcode Feb 20, 2026
ded2e22
fix middleware and simplify
Ushcode Feb 20, 2026
ccfd1f1
test scripts
Ushcode Feb 20, 2026
6a00c7c
rm unneeded crap
Ushcode Feb 20, 2026
e72fc21
add missing bits to oauth2 proxy template
Ushcode Feb 20, 2026
6401cf7
setup roles thing
Ushcode Feb 20, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,8 @@ testing_temp/
**/target/
WEB-INF/
log*.xml
port.txt
port.txt
*.env
forwardauth/.env
forwardauth/auth-app/oauth2-proxy/oauth2-proxy.cfg
*.log
50 changes: 50 additions & 0 deletions forwardauth/auth-app/compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: proxy
services:
traefik:
image: traefik:v3.6
container_name: traefik
ports:
- "2025:80" # web entrypoint
# - "443:443" # websecure entrypoint
- "8080:8080" # dashboard
volumes:
# docker
# - /var/run/docker.sock:/var/run/docker.sock:ro
# - ./traefik/traefik.yml:/etc/traefik/traefik.yml:ro
# - ./traefik/dynamic.yml:/etc/traefik/dynamic.yml:ro

# podman and SELinux
- ${XDG_RUNTIME_DIR}/podman/podman.sock:/var/run/docker.sock:ro
- ./traefik/traefik.yml:/etc/traefik/traefik.yml:ro,Z
- ./traefik/dynamic.yml:/etc/traefik/dynamic.yml:ro,Z
networks:
- auth
environment:
- STACK_NAME=auth
# podman
security_opt:
- label=disable
restart: unless-stopped
oauth2-proxy:
container_name: oauth2-proxy
image: quay.io/oauth2-proxy/oauth2-proxy:v7.14.2
command: --config /oauth2-proxy.cfg
hostname: oauth2-proxy
env_file:
- .env
volumes:
- "./oauth2-proxy/oauth2-proxy.cfg:/oauth2-proxy.cfg:ro,Z"
restart: unless-stopped
networks:
- auth

# Test service with authentication
whoami:
image: traefik/whoami
container_name: whoami
networks:
- auth

networks:
auth:
name: auth
141 changes: 141 additions & 0 deletions forwardauth/auth-app/deploy/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
# Traefik/OAuth2-Proxy Deployment on credo hosts

This script automates the deployment of the Traefik reverse proxy with OAuth2-Proxy authentication across multiple CReDO hosts.

## Supported Hosts

| Host | User | Traefik Port | Nginx Port | Short hostname |
|------|------|--------------|------------|------|
| credo-integration-01.dafni.rl.ac.uk | shared | 9050 | 8050 | ci01.credo |
| credo-datahost-01.dafni.rl.ac.uk | cadent | 9051 | 8051 | cd01.credo |
| credo-datahost-02.dafni.rl.ac.uk | ngt | 9051 | 8051 | cd02.credo |
| credo-datahost-03.dafni.rl.ac.uk | shared | 9050 | 8050 | cd03.credo |

The script automatically detects the hostname and maps:
- `credo-integration-01` → `ci01.credo`
- `credo-datahost-01` → `cd01.credo`
- `credo-datahost-02` → `cd02.credo`
- `credo-datahost-03` → `cd03.credo`

## Prerequisites

- Podman and podman-compose installed
- Access to the Keycloak admin console to retrieve/configure client secrets
- Appropriate user permissions on the target host

## Usage

### 1. Basic Deployment

Run the script without arguments to auto-detect the host, or specify a short hostname:

```bash
# Auto-detect current host from $(hostname)
./deploy.sh

```

The script will automatically map full hostnames to short names:
- On `credo-integration-01`: auto-detects as `ci01.credo`
- On `credo-datahost-01`: auto-detects as `cd01.credo`
- On `credo-datahost-02`: auto-detects as `cd02.credo`
- On `credo-datahost-03`: auto-detects as `cd03.credo`

Run as the appropriate user for the host:

```bash
# Auto-detect current host
sudo -u <user> ./deploy.sh
```


```bash
# ci01.credo (auto-detected from credo-integration-01)
sudo -u shared bash -c 'cd ~ && rm -rf stack && git clone https://github.com/TheWorldAvatar/stack.git && cd stack && git checkout add-traefik-support && cd forwardauth/auth-app && ./deploy/deploy.sh'

# cd01.credo (auto-detected from credo-datahost-01)
sudo -u cadent bash -c 'cd ~ && rm -rf stack && git clone https://github.com/TheWorldAvatar/stack.git && cd stack && git checkout add-traefik-support && cd forwardauth/auth-app && ./deploy/deploy.sh'

# cd02.credo (auto-detected from credo-datahost-02)
sudo -u ngt bash -c 'cd ~ && rm -rf stack && git clone https://github.com/TheWorldAvatar/stack.git && cd stack && git checkout add-traefik-support && cd forwardauth/auth-app && ./deploy/deploy.sh'

# cd03.credo (auto-detected from credo-datahost-03)
sudo -u shared bash -c 'cd ~ && rm -rf stack && git clone https://github.com/TheWorldAvatar/stack.git && cd stack && git checkout add-traefik-support && cd forwardauth/auth-app && ./deploy/deploy.sh'
```


Examples for each host:
```bash
# ci01.credo (auto-detected from credo-integration-01)
sudo -u shared ./deploy.sh

# cd01.credo (auto-detected from credo-datahost-01)
sudo -u cadent ./deploy.sh

# cd02.credo (auto-detected from credo-datahost-02)
sudo -u ngt ./deploy.sh

# cd03.credo (auto-detected from credo-datahost-03)
sudo -u shared ./deploy.sh
```

### 2. First-Time Setup

On first deployment, you'll be prompted for the Keycloak client secret:

```
Enter Keycloak client secret for the 'traefik' client :
```

### 3. What the Script Does

1. **Detects/validates** the current host
2. **Reads secrets** for OAuth2 configuration
3. **Creates `.env` file** with:
- Keycloak client credentials
- Generated security secrets
- Host-specific configuration
4. **Generates `oauth2-proxy.cfg`** from template with:
- Correct hostname/FQDN
- Keycloak connection details
- Cookie and JWT settings
5. **Updates `compose.yml`** to expose correct Traefik port
6. **Updates `traefik/dynamic.yml`** to proxy to correct Nginx port
7. **Stops any existing containers**
8. **Starts the stack** using podman-compose

## Configuration Files

After running the script, the following files will be created/updated:

- **`.env`** - Environment variables with secrets and configuration
- **`oauth2-proxy/oauth2-proxy.cfg`** - OAuth2-Proxy configuration
- **`compose.yml`** - Updated with correct Traefik port
- **`traefik/dynamic.yml`** - Updated with correct Nginx port

## Accessing the Services

After deployment:

- **Traefik Dashboard:** http://localhost:8080
- **Traefik Entry Point:** http://localhost:[TRAEFIK_PORT]
- **Protected Test Service:** http://localhost:[TRAEFIK_PORT]/whoami
- **Public Test Service:** http://localhost:[TRAEFIK_PORT]/whoami-public
- **External Access:** https://[FQDN]

## Keycloak Configuration

Ensure the following settings in Keycloak for the `traefik` client:

- **Client ID:** traefik
- **Access Type:** confidential
- **Valid Redirect URIs:**
- https://ci01.credo/*
- https://cd01.credo/*
- https://cd02.credo/*
- https://cd03.credo/*
- http://localhost:[TRAEFIK_PORT]/*
- **Web Origins:** +
- **Client Protocol:** openid-connect

Note: The FQDNs now use the short hostnames from `/etc/hosts` (e.g., `ci01.credo`) rather than the full DAFNI domain names.
Loading
Loading