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
Binary file added 4ec76a9f310e0ee531.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM amazoncorretto:17-alpine-jdk
FROM cimg/openjdk:17.0.11

ENV SPRING_PROFILES_ACTIVE production
ENV ANTIVIRUS_ENABLED true
ENV ANTIVIRUS_ENABLED false

EXPOSE 9000

Expand Down
76 changes: 74 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,36 @@ This is an intentionally very simple service for storing files as there is cross
requirements with ETD. Work needs to be done to review and potentially consolidate the two
projects.

## Configuration
### Architecture diagram

Application configuration can be found in `application.yml`. Some of these properties
Partial C4 Container model diagram of the Notarial Marriage service.

```mermaid
C4Container
title Container Diagram - FCDO Marriage Service

System_Boundary(marriageService, "FCDO Marriage Service") {
System(existing, "Existing CYB Marriage Frontend", "Existing web application providing <br> journey for marriage document applications")

System(frontend, "Notarial Marriage Frontend", "Web application providing journey <br> for marriage document applications")

System(documentUpload, "Document Upload", "Handles file uploads and document")
}

Rel(applicant, frontend, "Applies for marriage document", "HTTPS")
Rel(frontend, existing, "Redirects", "HTTPS")
Rel(frontend, documentUpload, "Uploads supporting documents", "HTTPS/API")
Rel(existing, documentUpload, "Redirects", "HTTPS")
Rel(existing, documentUpload, "Uploads supporting documents", "HTTPS/API")

UpdateLayoutConfig($c4ShapeInRow="2", $c4BoundaryInRow="1")
```

## Setting up the service

### Configuration

Application configuration can be found in `src/main/resources/application.yml`. Some of these properties
can be overridden at deployment time using environment variables.

| Environment variable | Default | Description |
Expand All @@ -27,6 +54,51 @@ can be overridden at deployment time using environment variables.
| SHARPNESS_THRESHOLD | 60 | Threshold, in %, an image's sharpness must meet to pass quality check |
| SPRING_PROFILES_ACTIVE | `development` | Only needs to be set to "development" when running in docker with [localstack](https://github.com/localstack) for a mock local AWS environment |

### Installation

This repository is private, you will need access to UKForeignOffice to access it.

```bash
git clone https://github.com/UKForeignOffice/document-upload.git

cd document-upload
```

#### Local development

In `Dockerfile`, change the image to `cimg/openjdk:17.0.11`.

In `docker-compose.yml`, change the `clamav` service `image: clamav/clamav:1.4.3`.
In `docker-compose.yml`, add to the `clamav` service `platform: linux/amd64`.

```bash
./gradlew clean build
```

## Using the service

### Run

```bash
docker compose up --build
```

### Endpoints

1. `GET` `/v1/files/{id}` - Get a file by id

```bash
curl http://localhost:9000/v1/files/4ec76a9f310e0ee531.jpg
```

2. `POST` `/v1/files` - Scans and stores the files for viruses

```bash
curl -X POST -F \
"files=@/path/to/file/4ec76a9f310e0ee531.jpg" \
http://localhost:9000/v1/files
```

## AntiVirus

Scanning inbound files for viruses is supported by integration with ClamAV. An example
Expand Down
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ version: "3.4"

services:
clamav:
image: quay.io/ukhomeofficedigital/clamav:latest
image: clamav/clamav:1.4.3
platform: linux/amd64
ports:
- 3310:3310
api:
build: .
ports:
- 9000:9000

Binary file added image.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.