diff --git a/4ec76a9f310e0ee531.jpg b/4ec76a9f310e0ee531.jpg new file mode 100644 index 0000000..96949e9 Binary files /dev/null and b/4ec76a9f310e0ee531.jpg differ diff --git a/Dockerfile b/Dockerfile index 6cd4e35..f6a71a7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 diff --git a/README.md b/README.md index 5e72320..98d9c92 100644 --- a/README.md +++ b/README.md @@ -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
journey for marriage document applications") + + System(frontend, "Notarial Marriage Frontend", "Web application providing journey
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 | @@ -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 diff --git a/docker-compose.yml b/docker-compose.yml index 1cb9a9e..8438d28 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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 - diff --git a/image.jpg b/image.jpg new file mode 100644 index 0000000..96949e9 Binary files /dev/null and b/image.jpg differ