Categorygithub.com/ONSdigital/dp-static-file-publisher
modulepackage
2.27.0+incompatible
Repository: https://github.com/onsdigital/dp-static-file-publisher.git
Documentation: pkg.go.dev

# README

DP Static File Publisher

Introduction

The Static File Publisher API is part of the Static Files System.

This service is responsible for moving files that have been published.

It receives messages on two Kafka topics static-file-published (which has been deprecated, but not yet removed) and static-file-published-v2 which is the new topic that the Files API sends publication messages on.

Version 2 Functionality

Once the file has been succesfully moved the service makes a HTTP API call back to Files API to inform it that the file has been moved. once this has been done Download Service stops streaming the file and starts redirecting requests for the moved files direct to the public bucket.

Getting started

  • Run make debug

  • You can use the provided kafka producer to send kafka messages that will trigger a file publishing event, for testing proposes. You can use it by running go run cmd/producer/main.go Then you will need to introduce the source and destination paths, and the message will be sent.

Dependencies

  • No further dependencies other than those defined in go.mod

Configuration

Environment variableDefaultDescription
BIND_ADDR:24900The host and port to bind to
GRACEFUL_SHUTDOWN_TIMEOUT5sThe graceful shutdown timeout in seconds (time.Duration format)
HEALTHCHECK_INTERVAL30sTime between self-healthchecks (time.Duration format)
HEALTHCHECK_CRITICAL_TIMEOUT90sTime to wait until an unhealthy dependent propagates its state to make this app unhealthy (time.Duration format)
FILES_API_URLThe URL of the dp-files-api
IMAGE_API_URLhttp://localhost:24700The image api url
KAFKA_ADDRlocalhost:9092The list of kafka broker hosts
KAFKA_VERSION1.0.2The version of Kafka
KAFKA_CONSUMER_WORKERS1The maximum number of parallel kafka consumers
KAFKA_SEC_PROTOunset (only TLS)if set to TLS, kafka connections will use TLS
KAFKA_SEC_CLIENT_KEYunsetPEM [2] for the client key (optional, used for client auth) [1]
KAFKA_SEC_CLIENT_CERTunsetPEM [2] for the client certificate (optional, used for client auth) [1]
KAFKA_SEC_CA_CERTSunsetPEM [2] of CA cert chain if using private CA for the server cert [1]
KAFKA_SEC_SKIP_VERIFYfalseignore server certificate issues if set to true [1]
CONSUMER_GROUPdp-static-file-publisherThe kafka consumer-group to consume static-file-published messages
STATIC_FILE_PUBLISHED_TOPICstatic-file-publishedThe kafka topic that will be consumed by this service and will trigger a file publishing event [DEPRECATED]
STATIC_FILE_PUBLISHED_TOPIC_V2static-file-published-v2The kafka topic that will be consumed by this service and will trigger a file publishing event from dp-files-api
S3_LOCAL_URLS3 Configuration for integration tests
S3_LOCAL_IDS3 Configuration for integration tests
S3_LOCAL_SECRETS3 Configuration for integration tests

Notes:

  1. For more info, see the kafka TLS examples documentation

Contributing

See CONTRIBUTING for details.

License

Copyright © 2022, Office for National Statistics (https://www.ons.gov.uk)

Released under MIT license, see LICENSE for details.

# Packages

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Variables

BuildTime represents the time in which the service was built.
GitCommit represents the commit (SHA-1) hash of the service that is running.
Version represents the version of the service that is running.