Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ and this project adheres to

## [Unreleased]

### Fixed

- 📝(doc) drop the removed main workspace from the resource server example

## [v0.20.0] - 2026-07-15

### Added
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ create-env-local-files:
@touch env.d/development/kc_postgresql.local
.PHONY: create-env-local-files

create-docker-network: ## create the docker network if it doesn't exist
create-docker-network: ## create the shared lasuite-network if it doesn't exist
@docker network create lasuite-network || true
.PHONY: create-docker-network

Expand Down
89 changes: 27 additions & 62 deletions compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,7 @@ services:
redis:
image: redis:5
ports:
- "6379:6379"

mailcatcher:
image: sj26/mailcatcher:latest
ports:
- "1081:1080"
- "6479:6379"

minio:
user: ${DOCKER_USER:-1000}
Expand All @@ -33,8 +28,8 @@ services:
- MINIO_ROOT_USER=drive
- MINIO_ROOT_PASSWORD=password
ports:
- "9000:9000"
- "9001:9001"
- "9100:9000"
- "9101:9001"
healthcheck:
test: ["CMD", "mc", "ready", "local"]
interval: 1s
Expand All @@ -44,6 +39,13 @@ services:
command: minio server --console-address :9001 /data
volumes:
- ./data/media:/data
networks:
default: {}
# Reachable from the meet stack, which uploads recordings to the presigned
# URLs Drive hands out.
lasuite:
aliases:
- drive-minio

createbuckets:
image: minio/mc
Expand Down Expand Up @@ -75,30 +77,33 @@ services:
- env.d/development/postgresql
- env.d/development/postgresql.${ENV_OVERRIDE:-local}
ports:
- "8071:8000"
- "8171:8000"
volumes:
- ./src/backend:/app
- ./data/static:/data/static
- /app/.venv
networks:
- lasuite
- default
default: {}
# Not "app-dev": the meet stack has a backend of its own, and its
# containers use on this network too. This is the external API endpoint
# meet pushes recordings to.
lasuite:
aliases:
- drive-app-dev
depends_on:
postgresql:
condition: service_healthy
restart: true
mailcatcher:
condition: service_started
redis:
condition: service_started
createbuckets:
condition: service_started
celery-dev:
condition: service_started
collabora:
condition: service_healthy
condition: service_started
onlyoffice:
condition: service_healthy
condition: service_started

ds-proxy:
image: demarchenumerique/ds-proxy:v2.0.0-alpha.4
Expand Down Expand Up @@ -154,16 +159,17 @@ services:
nginx:
image: nginx:1.25
ports:
- "8083:8083"
- "8085:8083"
networks:
default: {}
lasuite:
# Not "nginx": the meet stack has an nginx of its own, and its backend
# containers use this network too.
aliases:
- nginx
- drive-nginx
volumes:
- ./docker/files/development/etc/nginx/conf.d:/etc/nginx/conf.d:ro
depends_on:
- keycloak
- app-dev

frontend-dev:
Expand All @@ -173,14 +179,14 @@ services:
dockerfile: ./src/frontend/Dockerfile
target: drive-dev
args:
API_ORIGIN: "http://localhost:8071"
API_ORIGIN: "http://localhost:8171"
image: drive:frontend-development
volumes:
- ./src/frontend/:/home/frontend/
- /home/frontend/node_modules
- /home/frontend/apps/drive/node_modules
ports:
- "3000:3000"
- "3100:3000"

crowdin:
image: crowdin/cli:3.16.0
Expand All @@ -200,54 +206,13 @@ services:
volumes:
- ".:/app"

kc_postgresql:
image: postgres:14.3
healthcheck:
test: ["CMD-SHELL", "pg_isready"]
interval: 1s
timeout: 2s
retries: 300
ports:
- "6433:5432"
env_file:
- env.d/development/kc_postgresql
- env.d/development/kc_postgresql.local

keycloak:
image: quay.io/keycloak/keycloak:26.3.2
volumes:
- ./docker/auth/realm.json:/opt/keycloak/data/import/realm.json
command:
- start-dev
- --features=preview
- --import-realm
- --proxy=edge
- --hostname=http://localhost:8083
- --hostname-strict=false
environment:
KEYCLOAK_ADMIN: admin
KEYCLOAK_ADMIN_PASSWORD: admin
KC_DB: postgres
KC_DB_URL_HOST: kc_postgresql
KC_DB_URL_DATABASE: keycloak
KC_DB_PASSWORD: pass
KC_DB_USERNAME: drive
KC_DB_SCHEMA: public
PROXY_ADDRESS_FORWARDING: "true"
ports:
- "8080:8080"
depends_on:
- kc_postgresql
networks:
- lasuite
- default

collabora:
image: collabora/code:latest
healthcheck:
test: ["CMD-SHELL", "bash -c 'echo -e \"GET /hosting/discovery HTTP/1.0\\r\\nHost: localhost\\r\\n\\r\\n\" > /dev/tcp/localhost/9980'"]
interval: 30s
retries: 5
start_interval: 2s
start_period: 60s
timeout: 10s
ports:
Expand Down
47 changes: 22 additions & 25 deletions docs/resource_server.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Default configuration:
EXTERNAL_API = {
"items": {
"enabled": True,
"actions": ["list", "retrieve", "children", "upload_ended"],
"actions": ["create", "list", "retrieve", "children", "upload_ended"],
},
"item_access": {
"enabled": False,
Expand Down Expand Up @@ -63,38 +63,21 @@ Then you can requests some routes that are available at `/external_api/v1.0/*`,

#### Upload a file

Here is an example of a view that create a file on the main workspace in Drive.
Here is an example of a view that creates a file at the root of the user's Drive.

```python
@method_decorator(refresh_oidc_access_token)
def upload_file(self, request):
"""
Create a new file in the main workspace.
Create a new file at the root of the user's Drive.
"""

# Get the access token from the session
access_token = request.session.get('oidc_access_token')

# Get the main workspace
response = requests.get(
f"{settings.DRIVE_API}/items/",
headers={"Authorization": f"Bearer {access_token}", "Content-Type": "application/json"},
)
response.raise_for_status()
data = response.json()
items = data['results']
main_workspace = None
for item in items:
if item['main_workspace']:
main_workspace = item
break

if not main_workspace:
return drf.response.Response(status=404, data={"error": "No main workspace found"})

# Create a new file in the main workspace
# Create a new file at the root
response = requests.post(
f"{settings.DRIVE_API}/items/{main_workspace['id']}/children/",
f"{settings.DRIVE_API}/items/",
json={
"type": "file",
"filename": "test.txt",
Expand Down Expand Up @@ -127,16 +110,17 @@ Here is an example of a view that create a file on the main workspace in Drive.
)
response.raise_for_status()

return drf.response.Response(data)
return drf.response.Response(item)
```


#### Create a new folder

Using the same logic as the previous example, you can create a folder in the main workspace.
Using the same logic as the previous example, you can create a folder at the root.

```python
response = requests.post(
f"{settings.DRIVE_API}/items/{main_workspace['id']}/children/",
f"{settings.DRIVE_API}/items/",
json={
"type": "folder",
"title": "My folder",
Expand All @@ -145,6 +129,19 @@ response = requests.post(
)
```

To create an item inside an existing folder, post to its `children/` route.

```python
response = requests.post(
f"{settings.DRIVE_API}/items/{parent_id}/children/",
json={
"type": "folder",
"title": "My subfolder",
},
headers={"Authorization": f"Bearer {access_token}", "Content-Type": "application/json"},
)
```

#### Get user information

The same way, you can use the /me endpoint to get user information.
Expand Down
2 changes: 1 addition & 1 deletion docs/setup-local-network.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ In `src/frontend/apps/drive/.env.development`, override the environment variable

```env
NEXT_PUBLIC_S3_DOMAIN_REPLACE=http://<YOUR_IP>:9000
NEXT_PUBLIC_API_ORIGIN=http://<YOUR_IP>:8071
NEXT_PUBLIC_API_ORIGIN=http://<YOUR_IP>:8171
```

## 5. Update the backend OIDC settings
Expand Down
Loading