diff --git a/Makefile b/Makefile index 77b9395e..4478b495 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ DOCKER_PASSWORD= DOCKER_REGISTRY=thecodingmachine GOTENBERG_USER_GID=1001 GOTENBERG_USER_UID=1001 -GOLANGCI_LINT_VERSION=1.25.1 +GOLANGCI_LINT_VERSION=1.27.0 CODE_COVERAGE=0 TINI_VERSION=0.19.0 MAXIMUM_WAIT_TIMEOUT=30.0 @@ -19,6 +19,7 @@ DISABLE_UNOCONV=0 LOG_LEVEL=INFO ROOT_PATH=/ DEFAULT_GOOGLE_CHROME_RPCC_BUFFER_SIZE=1048576 +GOOGLE_CHROME_IGNORE_CERTIFICATE_ERRORS=0 # build the base Docker image. base: @@ -57,7 +58,7 @@ image: # start the API using previously built Docker image. gotenberg: - docker run -it --rm -e MAXIMUM_WAIT_TIMEOUT=$(MAXIMUM_WAIT_TIMEOUT) -e MAXIMUM_WAIT_DELAY=$(MAXIMUM_WAIT_DELAY) -e MAXIMUM_WEBHOOK_URL_TIMEOUT=$(MAXIMUM_WEBHOOK_URL_TIMEOUT) -e DEFAULT_WEBHOOK_URL_TIMEOUT=$(DEFAULT_WEBHOOK_URL_TIMEOUT) -e MAXIMUM_WEBHOOK_URL_TIMEOUT=$(MAXIMUM_WEBHOOK_URL_TIMEOUT) -e DEFAULT_LISTEN_PORT=$(DEFAULT_LISTEN_PORT) -e DISABLE_GOOGLE_CHROME=$(DISABLE_GOOGLE_CHROME) -e DISABLE_UNOCONV=$(DISABLE_UNOCONV) -e LOG_LEVEL=$(LOG_LEVEL) -e ROOT_PATH=$(ROOT_PATH) -e DEFAULT_GOOGLE_CHROME_RPCC_BUFFER_SIZE=$(DEFAULT_GOOGLE_CHROME_RPCC_BUFFER_SIZE) -p "$(DEFAULT_LISTEN_PORT):$(DEFAULT_LISTEN_PORT)" $(DOCKER_REGISTRY)/gotenberg:$(VERSION) + docker run -it --rm -e MAXIMUM_WAIT_TIMEOUT=$(MAXIMUM_WAIT_TIMEOUT) -e MAXIMUM_WAIT_DELAY=$(MAXIMUM_WAIT_DELAY) -e MAXIMUM_WEBHOOK_URL_TIMEOUT=$(MAXIMUM_WEBHOOK_URL_TIMEOUT) -e DEFAULT_WEBHOOK_URL_TIMEOUT=$(DEFAULT_WEBHOOK_URL_TIMEOUT) -e MAXIMUM_WEBHOOK_URL_TIMEOUT=$(MAXIMUM_WEBHOOK_URL_TIMEOUT) -e DEFAULT_LISTEN_PORT=$(DEFAULT_LISTEN_PORT) -e DISABLE_GOOGLE_CHROME=$(DISABLE_GOOGLE_CHROME) -e DISABLE_UNOCONV=$(DISABLE_UNOCONV) -e LOG_LEVEL=$(LOG_LEVEL) -e ROOT_PATH=$(ROOT_PATH) -e DEFAULT_GOOGLE_CHROME_RPCC_BUFFER_SIZE=$(DEFAULT_GOOGLE_CHROME_RPCC_BUFFER_SIZE) -e GOOGLE_CHROME_IGNORE_CERTIFICATE_ERRORS=$(GOOGLE_CHROME_IGNORE_CERTIFICATE_ERRORS) -p "$(DEFAULT_LISTEN_PORT):$(DEFAULT_LISTEN_PORT)" $(DOCKER_REGISTRY)/gotenberg:$(VERSION) # publish Gotenberg images according to version. publish: diff --git a/build/docs/content/01-install.md b/build/docs/content/01-install.md index c1a27401..a3758fdf 100644 --- a/build/docs/content/01-install.md +++ b/build/docs/content/01-install.md @@ -24,7 +24,7 @@ For instance: ```bash $ git clone https://github.com/thecodingmachine/gotenberg.git -$ make publish GOTENBERG_USER_GID=your_custom_gid GOTENBERG_USER_UID=your_custom_uid DOCKER_REGISTRY=your_registry DOCKER_USER=registry_user DOCKER_PASSWORD=registry_password VERSION=6.2.0 +$ make publish GOTENBERG_USER_GID=your_custom_gid GOTENBERG_USER_UID=your_custom_uid DOCKER_REGISTRY=your_registry DOCKER_USER=registry_user DOCKER_PASSWORD=registry_password VERSION=version ``` > `master` branch is always up-to-date with the latest version of the API. diff --git a/build/docs/content/03-environment-variables.md b/build/docs/content/03-environment-variables.md index b1522740..415dd020 100644 --- a/build/docs/content/03-environment-variables.md +++ b/build/docs/content/03-environment-variables.md @@ -58,6 +58,14 @@ The hard limit is 100 MB and is defined by Google Chrome itself. > The default Google Chrome rpcc buffer size may also be overridden per request thanks to the form field `googleChromeRpccBufferSize`. > See the [rpcc buffer size section](#html.rpcc_buffer_size). +## Google Chrome ignore certificate errors + +When performing a [URL](#url) conversion, Google Chrome will not accept certificate errors. + +You may allow insecure connections by setting the `GOOGLE_CHROME_IGNORE_CERTIFICATE_ERRORS` environment variable to `"1"`. + +**You should be careful with this feature and only enable it in your development environment.** + ## Disable LibreOffice (unoconv) You may also disable LibreOffice (unoconv) with `DISABLE_UNOCONV`. diff --git a/build/docs/content/05-url.md b/build/docs/content/05-url.md index fc307445..be892405 100644 --- a/build/docs/content/05-url.md +++ b/build/docs/content/05-url.md @@ -14,6 +14,9 @@ named `remoteURL` instead. Otherwise, URL conversions work the same as HTML conv > **Attention:** when converting a website to PDF, you should remove all margins. > If not, some of the content of the page might be hidden. +> **Attention:** if you try to convert a URL from a Docker Compose service named `app` (i.e. `removeURL` = `http://app/an/entrypoint`), +> the resulting PDF will be blank. Make sure to rename your service to avoid this issue. + ### cURL ```bash diff --git a/build/lint/Dockerfile b/build/lint/Dockerfile index 4b24276d..0abf3718 100644 --- a/build/lint/Dockerfile +++ b/build/lint/Dockerfile @@ -19,4 +19,4 @@ COPY . . RUN go mod download &&\ go mod verify -CMD ["golangci-lint", "run" ,"--tests=false", "--enable-all", "--disable=dupl", "--disable=funlen", "--disable=wsl", "--disable=gocognit", "--disable=gomnd" ] \ No newline at end of file +CMD ["golangci-lint", "run" ,"--tests=false", "--enable-all", "--disable=dupl", "--disable=funlen", "--disable=wsl", "--disable=gocognit", "--disable=gomnd", "--disable=goimports" ] \ No newline at end of file diff --git a/build/package/Dockerfile b/build/package/Dockerfile index 09a8f9af..67a686d2 100644 --- a/build/package/Dockerfile +++ b/build/package/Dockerfile @@ -10,7 +10,7 @@ FROM thecodingmachine/gotenberg:workspace AS workspace ARG VERSION ENV GOOS=linux \ - GOARCH=amd64 \ + GOARCH=amd64 \ CGO_ENABLED=0 # Define our workding outside of $GOPATH (we're using go modules). @@ -42,7 +42,7 @@ LABEL authors="Julien Neuhart " ARG TINI_VERSION -ADD --chown=gotenberg https://github.com/krallin/tini/releases/download/v${TINI_VERSION}/tini-static /tini +ADD https://github.com/krallin/tini/releases/download/v${TINI_VERSION}/tini-static /tini RUN chmod +x /tini ENTRYPOINT [ "/tini", "--" ] diff --git a/cmd/gotenberg/main.go b/cmd/gotenberg/main.go index 4759d7d6..f6c0d3fd 100644 --- a/cmd/gotenberg/main.go +++ b/cmd/gotenberg/main.go @@ -1,6 +1,7 @@ package main import ( + "errors" "fmt" "net/http" "os" @@ -28,7 +29,7 @@ func main() { systemLogger.DebugOpf(op, "configuration: %+v", config) if !config.DisableGoogleChrome() { // start Google Chrome headless. - if err := chrome.Start(systemLogger); err != nil { + if err := chrome.Start(systemLogger, config.GoogleChromeIgnoreCertificateErrors()); err != nil { systemLogger.FatalOp(op, err) } } @@ -38,7 +39,7 @@ func main() { go func() { systemLogger.InfoOpf(op, "http server started on port '%d'", config.DefaultListenPort()) if err := srv.Start(fmt.Sprintf(":%d", config.DefaultListenPort())); err != nil { - if err != http.ErrServerClosed { + if errors.Is(err, http.ErrServerClosed) { systemLogger.FatalOp(op, err) } } diff --git a/docs/index.html b/docs/index.html index 1ad30e01..606e9133 100755 --- a/docs/index.html +++ b/docs/index.html @@ -154,7 +154,7 @@

For instance:

$ git clone https://github.com/thecodingmachine/gotenberg.git
-$ make publish GOTENBERG_USER_GID=your_custom_gid GOTENBERG_USER_UID=your_custom_uid DOCKER_REGISTRY=your_registry DOCKER_USER=registry_user DOCKER_PASSWORD=registry_password VERSION=6.2.0
+$ make publish GOTENBERG_USER_GID=your_custom_gid GOTENBERG_USER_UID=your_custom_uid DOCKER_REGISTRY=your_registry DOCKER_USER=registry_user DOCKER_PASSWORD=registry_password VERSION=version
 
@@ -332,6 +332,16 @@ The hard limit is 100 MB and is defined by Google Chrome itself.

See the rpcc buffer size section.

+

Google Chrome ignore certificate errors

+ +

When performing a URL conversion, Google Chrome will not accept certificate errors.

+ +

You may allow insecure connections by setting the GOOGLE_CHROME_IGNORE_CERTIFICATE_ERRORS environment variable to "1".

+ +

You should be careful with this feature and only enable it in your development environment.

+

Disable LibreOffice (unoconv)

@@ -929,6 +939,9 @@ named remoteURL instead. Otherwise, URL conversions work the same a

Attention: when converting a website to PDF, you should remove all margins. If not, some of the content of the page might be hidden.

+ +

Attention: if you try to convert a URL from a Docker Compose service named app (i.e. removeURL = http://app/an/entrypoint), +the resulting PDF will be blank. Make sure to rename your service to avoid this issue.