From 84d44e3a64856f8312f8a4f8379912270dec5eb7 Mon Sep 17 00:00:00 2001 From: Spencer Gibb Date: Thu, 14 Sep 2023 16:29:47 -0400 Subject: [PATCH] Antora migration (#702) * Migrate Structure * Insert explicit ids for headers * Remove unnecessary asciidoc attributes * Copy default antora files * Fix indentation for all pages * Generate a default navigation * Remove includes * Fix cross references * Enable Section Summary TOC for small pages * Additional antora migration --- .github/workflows/deploy-docs.yml | 32 ++ .gitignore | 6 + .mvn/wrapper/maven-wrapper.properties | 3 +- README.adoc | 358 ++---------------- docs/antora-playbook.yml | 39 ++ docs/antora.yml | 12 + docs/modules/ROOT/nav.adoc | 8 + .../ROOT/pages}/_attributes.adoc | 7 +- .../ROOT/pages}/appendix.adoc | 6 +- .../ROOT/pages}/authentication.adoc | 102 ++--- .../ROOT/pages}/config-data.adoc | 24 +- docs/modules/ROOT/pages/configprops.adoc | 6 + .../ROOT/pages}/index.adoc | 0 .../ROOT/pages}/intro.adoc | 0 .../ROOT/pages}/new-features.adoc | 12 +- .../ROOT/pages}/other-topics.adoc | 15 +- .../ROOT/pages}/quickstart.adoc | 25 +- .../ROOT/pages}/secret-backends.adoc | 76 +--- .../ROOT/partials}/_configprops.adoc | 0 docs/pom.xml | 48 +-- .../resources/antora-resources/antora.yml | 20 + docs/src/main/asciidoc/README.adoc | 24 +- .../src/main/asciidoc/spring-cloud-vault.adoc | 31 -- 23 files changed, 266 insertions(+), 588 deletions(-) create mode 100644 .github/workflows/deploy-docs.yml create mode 100644 docs/antora-playbook.yml create mode 100644 docs/antora.yml create mode 100644 docs/modules/ROOT/nav.adoc rename docs/{src/main/asciidoc => modules/ROOT/pages}/_attributes.adoc (53%) rename docs/{src/main/asciidoc => modules/ROOT/pages}/appendix.adoc (84%) rename docs/{src/main/asciidoc => modules/ROOT/pages}/authentication.adoc (96%) rename docs/{src/main/asciidoc => modules/ROOT/pages}/config-data.adoc (87%) create mode 100644 docs/modules/ROOT/pages/configprops.adoc rename docs/{src/main/asciidoc => modules/ROOT/pages}/index.adoc (100%) rename docs/{src/main/asciidoc => modules/ROOT/pages}/intro.adoc (100%) rename docs/{src/main/asciidoc => modules/ROOT/pages}/new-features.adoc (52%) rename docs/{src/main/asciidoc => modules/ROOT/pages}/other-topics.adoc (98%) rename docs/{src/main/asciidoc => modules/ROOT/pages}/quickstart.adoc (93%) rename docs/{src/main/asciidoc => modules/ROOT/pages}/secret-backends.adoc (97%) rename docs/{src/main/asciidoc => modules/ROOT/partials}/_configprops.adoc (100%) create mode 100644 docs/src/main/antora/resources/antora-resources/antora.yml delete mode 100644 docs/src/main/asciidoc/spring-cloud-vault.adoc diff --git a/.github/workflows/deploy-docs.yml b/.github/workflows/deploy-docs.yml new file mode 100644 index 00000000..be4b92df --- /dev/null +++ b/.github/workflows/deploy-docs.yml @@ -0,0 +1,32 @@ +name: Deploy Docs +on: + push: + branches-ignore: [ gh-pages ] + tags: '**' + repository_dispatch: + types: request-build-reference # legacy + #schedule: + #- cron: '0 10 * * *' # Once per day at 10am UTC + workflow_dispatch: +permissions: + actions: write +jobs: + build: + runs-on: ubuntu-latest + # if: github.repository_owner == 'spring-cloud' + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + ref: docs-build + fetch-depth: 1 + - name: Dispatch (partial build) + if: github.ref_type == 'branch' + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: gh workflow run deploy-docs.yml -r $(git rev-parse --abbrev-ref HEAD) -f build-refname=${{ github.ref_name }} + - name: Dispatch (full build) + if: github.ref_type == 'tag' + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: gh workflow run deploy-docs.yml -r $(git rev-parse --abbrev-ref HEAD) diff --git a/.gitignore b/.gitignore index e155f0dc..fd3c8999 100644 --- a/.gitignore +++ b/.gitignore @@ -26,3 +26,9 @@ release.properties .vscode/ plugins/ + +node +node_modules +build +package.json +package-lock.json diff --git a/.mvn/wrapper/maven-wrapper.properties b/.mvn/wrapper/maven-wrapper.properties index c3150437..b8e54d3a 100644 --- a/.mvn/wrapper/maven-wrapper.properties +++ b/.mvn/wrapper/maven-wrapper.properties @@ -1 +1,2 @@ -distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.0/apache-maven-3.5.0-bin.zip +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.0/apache-maven-3.9.0-bin.zip +wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar diff --git a/README.adoc b/README.adoc index 813174ac..c431660a 100644 --- a/README.adoc +++ b/README.adoc @@ -7,13 +7,11 @@ Edit the files in the src/main/asciidoc/ directory instead. :docs: https://cloud.spring.io/spring-cloud-vault/spring-cloud-vault.html -Spring Cloud Vault Config provides client-side support for externalized configuration in a distributed system. -With https://www.vaultproject.io[HashiCorp's Vault] you have a central place to manage external secret properties for applications across all environments. -Vault can manage static and dynamic secrets such as username/password for remote applications/resources and provide credentials for external services such as MySQL, PostgreSQL, Apache Cassandra, Couchbase, MongoDB, Consul, AWS and more. +[[features]] += Features -== Features - -=== Spring Cloud Vault Config Client +[[spring-cloud-vault-config-client]] +== Spring Cloud Vault Config Client Specifically for Spring applications: @@ -37,9 +35,8 @@ Specifically for Spring applications: * Bootstrap application context: a parent context for the main application that can be trained to do anything. -== Quick Start - -:docs: https://cloud.spring.io/spring-cloud-vault/reference/html/ +[[quick-start]] += Quick Start *Prerequisites* @@ -167,13 +164,13 @@ where the "application" is injected as the `spring.application.name` in the `SpringApplication` (i.e. what is normally "application" in a regular Spring Boot app), "profile" is an active profile (or comma-separated list of properties). Properties retrieved from Vault will be used "as-is" without further prefixing of the property names. +[[client-side-usage]] == Client Side Usage To use these features in an application, just build it as a Spring Boot application that depends on `spring-cloud-vault-config` (e.g. see the test cases). Example Maven configuration: .pom.xml -==== [source,xml,indent=0,subs="verbatim,quotes,attributes"] ---- @@ -207,11 +204,9 @@ Example Maven configuration: ---- -==== Then you can create a standard Spring Boot application, like this simple HTTP server: -==== [source,java] ---- @SpringBootApplication @@ -228,13 +223,11 @@ public class Application { } } ---- -==== When it runs it will pick up the external configuration from the default local Vault server on port `8200` if it is running. To modify the startup behavior you can change the location of the Vault server using `application.properties`, for example .application.yml -==== [source,yaml] ---- spring.cloud.vault: @@ -247,7 +240,6 @@ spring.cloud.vault: config: spring.config.import: vault:// ---- -==== * `host` sets the hostname of the Vault host. The host name will be used for SSL certificate validation @@ -261,34 +253,33 @@ Supported schemes are `http` and `https`. Enabling further integrations requires additional dependencies and configuration. Depending on how you have set up Vault you might need additional configuration like -{docs}#vault.config.ssl[SSL] and -{docs}#vault.config.authentication[authentication]. +xref:other-topics.adoc#vault.config.ssl[SSL] and +xref:authentication.adoc#vault.config.authentication[authentication]. If the application imports the `spring-boot-starter-actuator` project, the status of the vault server will be available via the `/health` endpoint. The vault health indicator can be enabled or disabled through the property `management.health.vault.enabled` (default to `true`). NOTE: With Spring Cloud Vault 3.0 and Spring Boot 2.4, the bootstrap context initialization (`bootstrap.yml`, `bootstrap.properties`) of property sources was deprecated. -Instead, Spring Cloud Vault favors Spring Boot's Config Data API which allows importing configuration from Vault. With Spring Boot Config Data approach, you need to set the `spring.config.import` property in order to bind to Vault. You can read more about it in the <>. +Instead, Spring Cloud Vault favors Spring Boot's Config Data API which allows importing configuration from Vault. With Spring Boot Config Data approach, you need to set the `spring.config.import` property in order to bind to Vault. You can read more about it in the xref:config-data.adoc#vault.configdata.locations[Config Data Locations section]. You can enable the bootstrap context either by setting the configuration property `spring.cloud.bootstrap.enabled=true` or by including the dependency `org.springframework.cloud:spring-cloud-starter-bootstrap`. -=== Authentication +[[authentication]] +== Authentication Vault requires an https://www.vaultproject.io/docs/concepts/auth.html[authentication mechanism] to https://www.vaultproject.io/docs/concepts/tokens.html[authorize client requests]. -Spring Cloud Vault supports multiple {docs}#vault.config.authentication[authentication mechanisms] to authenticate applications with Vault. +Spring Cloud Vault supports multiple xref:authentication.adoc#vault.config.authentication[authentication mechanisms] to authenticate applications with Vault. -For a quickstart, use the root token printed by the <>. +For a quickstart, use the root token printed by the xref:quickstart.adoc#quickstart.vault.start[Vault initialization]. .application.yml -==== [source,yaml] ---- spring.cloud.vault: token: 19aefa97-cccc-bbbb-aaaa-225940e63d76 spring.config.import: vault:// ---- -==== WARNING: Consider carefully your security requirements. Static token authentication is fine if you want quickly get started with Vault, but a static token is not protected any further. @@ -297,9 +288,11 @@ Any disclosure to unintended parties allows Vault use with the associated token -== Building +[[building]] += Building -=== Build requirements for Vault +[[build-requirements-for-vault]] +== Build requirements for Vault Spring Cloud Vault Config requires SSL certificates and a running Vault instance listening on `localhost:8200`. Certificates and the Vault setup are scripted, the scripts are located in `src/test/bash`. @@ -327,315 +320,12 @@ $ ./docs/src/main/ruby/generate_readme.sh > README.adoc This script requires ruby and the asciidoctor gem installed (`gem install asciidoctor`) -:jdkversion: 17 +[[building]] += Building -=== Basic Compile and Test +Unresolved directive in https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/main/docs/modules/ROOT/pages/building.adoc - include::partial$building.adoc[] -To build the source you will need to install JDK {jdkversion}. - -Spring Cloud uses Maven for most build-related activities, and you -should be able to get off the ground quite quickly by cloning the -project you are interested in and typing - ----- -$ ./mvnw install ----- - -NOTE: You can also install Maven (>=3.3.3) yourself and run the `mvn` command -in place of `./mvnw` in the examples below. If you do that you also -might need to add `-P spring` if your local Maven settings do not -contain repository declarations for spring pre-release artifacts. - -NOTE: Be aware that you might need to increase the amount of memory -available to Maven by setting a `MAVEN_OPTS` environment variable with -a value like `-Xmx512m -XX:MaxPermSize=128m`. We try to cover this in -the `.mvn` configuration, so if you find you have to do it to make a -build succeed, please raise a ticket to get the settings added to -source control. - -The projects that require middleware (i.e. Redis) for testing generally -require that a local instance of [Docker](https://www.docker.com/get-started) is installed and running. - - -=== Documentation - -The spring-cloud-build module has a "docs" profile, and if you switch -that on it will try to build asciidoc sources from -`src/main/asciidoc`. As part of that process it will look for a -`README.adoc` and process it by loading all the includes, but not -parsing or rendering it, just copying it to `${main.basedir}` -(defaults to `${basedir}`, i.e. the root of the project). If there are -any changes in the README it will then show up after a Maven build as -a modified file in the correct place. Just commit it and push the change. - -=== Working with the code -If you don't have an IDE preference we would recommend that you use -https://www.springsource.com/developer/sts[Spring Tools Suite] or -https://eclipse.org[Eclipse] when working with the code. We use the -https://eclipse.org/m2e/[m2eclipse] eclipse plugin for maven support. Other IDEs and tools -should also work without issue as long as they use Maven 3.3.3 or better. - -==== Activate the Spring Maven profile -Spring Cloud projects require the 'spring' Maven profile to be activated to resolve -the spring milestone and snapshot repositories. Use your preferred IDE to set this -profile to be active, or you may experience build errors. - -==== Importing into eclipse with m2eclipse -We recommend the https://eclipse.org/m2e/[m2eclipse] eclipse plugin when working with -eclipse. If you don't already have m2eclipse installed it is available from the "eclipse -marketplace". - -NOTE: Older versions of m2e do not support Maven 3.3, so once the -projects are imported into Eclipse you will also need to tell -m2eclipse to use the right profile for the projects. If you -see many different errors related to the POMs in the projects, check -that you have an up to date installation. If you can't upgrade m2e, -add the "spring" profile to your `settings.xml`. Alternatively you can -copy the repository settings from the "spring" profile of the parent -pom into your `settings.xml`. - -==== Importing into eclipse without m2eclipse -If you prefer not to use m2eclipse you can generate eclipse project metadata using the -following command: - -[indent=0] ----- - $ ./mvnw eclipse:eclipse ----- - -The generated eclipse projects can be imported by selecting `import existing projects` -from the `file` menu. - - -== Contributing - -:spring-cloud-build-branch: master - -Spring Cloud is released under the non-restrictive Apache 2.0 license, -and follows a very standard Github development process, using Github -tracker for issues and merging pull requests into master. If you want -to contribute even something trivial please do not hesitate, but -follow the guidelines below. - -=== Sign the Contributor License Agreement -Before we accept a non-trivial patch or pull request we will need you to sign the -https://cla.pivotal.io/sign/spring[Contributor License Agreement]. -Signing the contributor's agreement does not grant anyone commit rights to the main -repository, but it does mean that we can accept your contributions, and you will get an -author credit if we do. Active contributors might be asked to join the core team, and -given the ability to merge pull requests. - -=== Code of Conduct -This project adheres to the Contributor Covenant https://github.com/spring-cloud/spring-cloud-build/blob/master/docs/src/main/asciidoc/code-of-conduct.adoc[code of -conduct]. By participating, you are expected to uphold this code. Please report -unacceptable behavior to spring-code-of-conduct@pivotal.io. - -=== Code Conventions and Housekeeping -None of these is essential for a pull request, but they will all help. They can also be -added after the original pull request but before a merge. - -* Use the Spring Framework code format conventions. If you use Eclipse - you can import formatter settings using the - `eclipse-code-formatter.xml` file from the - https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/spring-cloud-dependencies-parent/eclipse-code-formatter.xml[Spring - Cloud Build] project. If using IntelliJ, you can use the - https://plugins.jetbrains.com/plugin/6546[Eclipse Code Formatter - Plugin] to import the same file. -* Make sure all new `.java` files to have a simple Javadoc class comment with at least an - `@author` tag identifying you, and preferably at least a paragraph on what the class is - for. -* Add the ASF license header comment to all new `.java` files (copy from existing files - in the project) -* Add yourself as an `@author` to the .java files that you modify substantially (more - than cosmetic changes). -* Add some Javadocs and, if you change the namespace, some XSD doc elements. -* A few unit tests would help a lot as well -- someone has to do it. -* If no-one else is using your branch, please rebase it against the current master (or - other target branch in the main project). -* When writing a commit message please follow https://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html[these conventions], - if you are fixing an existing issue please add `Fixes gh-XXXX` at the end of the commit - message (where XXXX is the issue number). - -=== Checkstyle - -Spring Cloud Build comes with a set of checkstyle rules. You can find them in the `spring-cloud-build-tools` module. The most notable files under the module are: - -.spring-cloud-build-tools/ ----- -└── src -    ├── checkstyle -    │   └── checkstyle-suppressions.xml <3> -    └── main -    └── resources -    ├── checkstyle-header.txt <2> -    └── checkstyle.xml <1> ----- -<1> Default Checkstyle rules -<2> File header setup -<3> Default suppression rules - -==== Checkstyle configuration - -Checkstyle rules are *disabled by default*. To add checkstyle to your project just define the following properties and plugins. - -.pom.xml ----- - -true <1> - true - <2> - true - <3> - - - - - <4> - io.spring.javaformat - spring-javaformat-maven-plugin - - <5> - org.apache.maven.plugins - maven-checkstyle-plugin - - - - - - <5> - org.apache.maven.plugins - maven-checkstyle-plugin - - - - ----- -<1> Fails the build upon Checkstyle errors -<2> Fails the build upon Checkstyle violations -<3> Checkstyle analyzes also the test sources -<4> Add the Spring Java Format plugin that will reformat your code to pass most of the Checkstyle formatting rules -<5> Add checkstyle plugin to your build and reporting phases - -If you need to suppress some rules (e.g. line length needs to be longer), then it's enough for you to define a file under `${project.root}/src/checkstyle/checkstyle-suppressions.xml` with your suppressions. Example: - -.projectRoot/src/checkstyle/checkstyle-suppresions.xml ----- - - - - - - ----- - -It's advisable to copy the `${spring-cloud-build.rootFolder}/.editorconfig` and `${spring-cloud-build.rootFolder}/.springformat` to your project. That way, some default formatting rules will be applied. You can do so by running this script: - -```bash -$ curl https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/.editorconfig -o .editorconfig -$ touch .springformat -``` - -=== IDE setup - -==== Intellij IDEA - -In order to setup Intellij you should import our coding conventions, inspection profiles and set up the checkstyle plugin. -The following files can be found in the https://github.com/spring-cloud/spring-cloud-build/tree/master/spring-cloud-build-tools[Spring Cloud Build] project. - -.spring-cloud-build-tools/ ----- -└── src -    ├── checkstyle -    │   └── checkstyle-suppressions.xml <3> -    └── main -    └── resources -    ├── checkstyle-header.txt <2> -    ├── checkstyle.xml <1> -    └── intellij -       ├── Intellij_Project_Defaults.xml <4> -       └── Intellij_Spring_Boot_Java_Conventions.xml <5> ----- -<1> Default Checkstyle rules -<2> File header setup -<3> Default suppression rules -<4> Project defaults for Intellij that apply most of Checkstyle rules -<5> Project style conventions for Intellij that apply most of Checkstyle rules - -.Code style - -image::https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/{spring-cloud-build-branch}/docs/src/main/asciidoc/images/intellij-code-style.png[Code style] - -Go to `File` -> `Settings` -> `Editor` -> `Code style`. There click on the icon next to the `Scheme` section. There, click on the `Import Scheme` value and pick the `Intellij IDEA code style XML` option. Import the `spring-cloud-build-tools/src/main/resources/intellij/Intellij_Spring_Boot_Java_Conventions.xml` file. - -.Inspection profiles - -image::https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/{spring-cloud-build-branch}/docs/src/main/asciidoc/images/intellij-inspections.png[Code style] - -Go to `File` -> `Settings` -> `Editor` -> `Inspections`. There click on the icon next to the `Profile` section. There, click on the `Import Profile` and import the `spring-cloud-build-tools/src/main/resources/intellij/Intellij_Project_Defaults.xml` file. - -.Checkstyle - -To have Intellij work with Checkstyle, you have to install the `Checkstyle` plugin. It's advisable to also install the `Assertions2Assertj` to automatically convert the JUnit assertions - -image::https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/{spring-cloud-build-branch}/docs/src/main/asciidoc/images/intellij-checkstyle.png[Checkstyle] - -Go to `File` -> `Settings` -> `Other settings` -> `Checkstyle`. There click on the `+` icon in the `Configuration file` section. There, you'll have to define where the checkstyle rules should be picked from. In the image above, we've picked the rules from the cloned Spring Cloud Build repository. However, you can point to the Spring Cloud Build's GitHub repository (e.g. for the `checkstyle.xml` : `https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/spring-cloud-build-tools/src/main/resources/checkstyle.xml`). We need to provide the following variables: - -- `checkstyle.header.file` - please point it to the Spring Cloud Build's, `spring-cloud-build-tools/src/main/resources/checkstyle-header.txt` file either in your cloned repo or via the `https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/spring-cloud-build-tools/src/main/resources/checkstyle-header.txt` URL. -- `checkstyle.suppressions.file` - default suppressions. Please point it to the Spring Cloud Build's, `spring-cloud-build-tools/src/checkstyle/checkstyle-suppressions.xml` file either in your cloned repo or via the `https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/spring-cloud-build-tools/src/checkstyle/checkstyle-suppressions.xml` URL. -- `checkstyle.additional.suppressions.file` - this variable corresponds to suppressions in your local project. E.g. you're working on `spring-cloud-contract`. Then point to the `project-root/src/checkstyle/checkstyle-suppressions.xml` folder. Example for `spring-cloud-contract` would be: `/home/username/spring-cloud-contract/src/checkstyle/checkstyle-suppressions.xml`. - -IMPORTANT: Remember to set the `Scan Scope` to `All sources` since we apply checkstyle rules for production and test sources. - -=== Duplicate Finder - -Spring Cloud Build brings along the `basepom:duplicate-finder-maven-plugin`, that enables flagging duplicate and conflicting classes and resources on the java classpath. - -==== Duplicate Finder configuration - -Duplicate finder is *enabled by default* and will run in the `verify` phase of your Maven build, but it will only take effect in your project if you add the `duplicate-finder-maven-plugin` to the `build` section of the projecst's `pom.xml`. - -.pom.xml -[source,xml] ----- - - - - org.basepom.maven - duplicate-finder-maven-plugin - - - ----- - -For other properties, we have set defaults as listed in the https://github.com/basepom/duplicate-finder-maven-plugin/wiki[plugin documentation]. - -You can easily override them but setting the value of the selected property prefixed with `duplicate-finder-maven-plugin`. For example, set `duplicate-finder-maven-plugin.skip` to `true` in order to skip duplicates check in your build. - -If you need to add `ignoredClassPatterns` or `ignoredResourcePatterns` to your setup, make sure to add them in the plugin configuration section of your project: - -[source,xml] ----- - - - - org.basepom.maven - duplicate-finder-maven-plugin - - - org.joda.time.base.BaseDateTime - .*module-info - - - changelog.txt - - - - - - - ----- +[[contributing]] += Contributing +Unresolved directive in - include::https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/docs/src/main/asciidoc/contributing.adoc[] diff --git a/docs/antora-playbook.yml b/docs/antora-playbook.yml new file mode 100644 index 00000000..3b24582a --- /dev/null +++ b/docs/antora-playbook.yml @@ -0,0 +1,39 @@ +antora: + extensions: + - '@springio/antora-extensions/partial-build-extension' + - require: '@springio/antora-extensions/latest-version-extension' + - require: '@springio/antora-extensions/inject-collector-cache-config-extension' + - '@antora/collector-extension' + - '@antora/atlas-extension' + - require: '@springio/antora-extensions/root-component-extension' + root_component_name: 'cloud-vault' + +site: + title: Spring Cloud Vault + url: https://docs.spring.io/spring-cloud-vault/reference/ +content: + sources: + - url: ./.. + branches: HEAD + start_path: docs + worktrees: true +asciidoc: + attributes: + page-stackoverflow-url: https://stackoverflow.com/tags/spring-cloud + page-pagination: '' + hide-uri-scheme: '@' + tabs-sync-option: '@' + chomp: 'all' + extensions: + - '@asciidoctor/tabs' + - '@springio/asciidoctor-extensions' + sourcemap: true +urls: + latest_version_segment: '' +runtime: + log: + failure_level: warn + format: pretty +ui: + bundle: + url: https://github.com/spring-io/antora-ui-spring/releases/download/v0.3.5/ui-bundle.zip diff --git a/docs/antora.yml b/docs/antora.yml new file mode 100644 index 00000000..5cb6f868 --- /dev/null +++ b/docs/antora.yml @@ -0,0 +1,12 @@ +name: cloud-vault +version: true +title: Spring Cloud Vault +nav: + - modules/ROOT/nav.adoc +ext: + collector: + run: + command: ./mvnw --no-transfer-progress -B process-resources -Pdocs -pl docs -Dantora-maven-plugin.phase=none -Dgenerate-docs.phase=none -Dgenerate-readme.phase=none -Dgenerate-cloud-resources.phase=none -Dmaven-dependency-plugin-for-docs.phase=none -Dmaven-dependency-plugin-for-docs-classes.phase=none -DskipTests + local: true + scan: + dir: ./target/classes/antora-resources/ diff --git a/docs/modules/ROOT/nav.adoc b/docs/modules/ROOT/nav.adoc new file mode 100644 index 00000000..cd40339d --- /dev/null +++ b/docs/modules/ROOT/nav.adoc @@ -0,0 +1,8 @@ +* xref:index.adoc[Introduction] +* xref:new-features.adoc[] +* xref:quickstart.adoc[] +* xref:config-data.adoc[] +* xref:authentication.adoc[] +* xref:secret-backends.adoc[] +* xref:other-topics.adoc[] +* xref:appendix.adoc[] diff --git a/docs/src/main/asciidoc/_attributes.adoc b/docs/modules/ROOT/pages/_attributes.adoc similarity index 53% rename from docs/src/main/asciidoc/_attributes.adoc rename to docs/modules/ROOT/pages/_attributes.adoc index 0bc84708..23877393 100644 --- a/docs/src/main/asciidoc/_attributes.adoc +++ b/docs/modules/ROOT/pages/_attributes.adoc @@ -1,8 +1,6 @@ :doctype: book :idprefix: :idseparator: - -:toc: left -:toclevels: 4 :tabsize: 4 :numbered: :sectanchors: @@ -13,3 +11,8 @@ :sc-ext: java :project-full-name: Spring Cloud Vault + +:github: https://github.com/spring-cloud/spring-cloud-vault +:githubmaster: {github}/tree/main +:revnumber: {project-version} +:docslink: {githubmaster}/docs/src/main/asciidoc \ No newline at end of file diff --git a/docs/src/main/asciidoc/appendix.adoc b/docs/modules/ROOT/pages/appendix.adoc similarity index 84% rename from docs/src/main/asciidoc/appendix.adoc rename to docs/modules/ROOT/pages/appendix.adoc index 39eb1593..24352004 100644 --- a/docs/src/main/asciidoc/appendix.adoc +++ b/docs/modules/ROOT/pages/appendix.adoc @@ -1,7 +1,9 @@ :numbered!: + [appendix] [[common-application-properties]] -== Common application properties += Common application properties +:page-section-summary-toc: 1 include::_attributes.adoc[] @@ -11,4 +13,4 @@ This appendix provides a list of common {project-full-name} properties and refer NOTE: Property contributions can come from additional jar files on your classpath, so you should not consider this an exhaustive list. Also, you can define your own properties. -include::_configprops.adoc[] +include::partial$_configprops.adoc[] \ No newline at end of file diff --git a/docs/src/main/asciidoc/authentication.adoc b/docs/modules/ROOT/pages/authentication.adoc similarity index 96% rename from docs/src/main/asciidoc/authentication.adoc rename to docs/modules/ROOT/pages/authentication.adoc index 3579e077..9e4fd3dc 100644 --- a/docs/src/main/asciidoc/authentication.adoc +++ b/docs/modules/ROOT/pages/authentication.adoc @@ -1,12 +1,12 @@ [[vault.config.authentication]] -== Authentication methods += Authentication methods Different organizations have different requirements for security and authentication. Vault reflects that need by shipping multiple authentication methods. Spring Cloud Vault supports token and AppId authentication. [[vault.config.authentication.token]] -=== Token authentication +== Token authentication Tokens are the core method for authentication within Vault. Token authentication requires a static token to be provided using the configuration. @@ -16,14 +16,12 @@ NOTE: Token authentication is the default authentication method. If a token is disclosed an unintended party gains access to Vault and can access secrets for the intended client. .application.yml -==== [source,yaml] ---- spring.cloud.vault: authentication: TOKEN token: 00000000-0000-0000-0000-000000000000 ---- -==== * `authentication` setting this value to `TOKEN` selects the Token authentication method * `token` sets the static token to use. If missing or empty, then an attempt will be made to retrieve a token from ~/.vault-token. @@ -35,7 +33,7 @@ See also: * https://www.vaultproject.io/docs/commands/token-helper[Vault Documentation: CLI default to ~/.vault-token] [[vault.config.authentication.vault-agent]] -=== Vault Agent authentication +== Vault Agent authentication Vault ships a sidecar utility with Vault Agent since version 0.11.0. Vault Agent implements the functionality of Spring Vault's `SessionManager` with its Auto-Auth feature. @@ -45,13 +43,11 @@ Spring Vault can send requests without the Disable Spring Vault's authentication infrastructure to disable client authentication and session management. .application.yml -==== [source,yaml] ---- spring.cloud.vault: authentication: NONE ---- -==== * `authentication` setting this value to `NONE` disables `ClientAuthentication` and `SessionManager`. @@ -59,7 +55,7 @@ and `SessionManager`. See also: https://www.vaultproject.io/docs/agent/index.html[Vault Documentation: Agent] [[vault.config.authentication.appid]] -=== AppId authentication +== AppId authentication Vault supports https://www.vaultproject.io/docs/auth/app-id.html[AppId] authentication that consists of two hard to guess tokens. @@ -72,7 +68,6 @@ The IP and Mac address are represented as Hex-encoded SHA256 hash. IP address-based UserId's use the local host's IP address. .application.yml using SHA256 IP-Address UserId's -==== [source,yaml] ---- spring.cloud.vault: @@ -80,7 +75,6 @@ spring.cloud.vault: app-id: user-id: IP_ADDRESS ---- -==== * `authentication` setting this value to `APPID` selects the AppId authentication method * `app-id-path` sets the path of the AppId mount to use @@ -102,7 +96,6 @@ The value of `network-interface` is optional and can be either an interface name or interface index (0-based). .application.yml using SHA256 Mac-Address UserId's -==== [source,yaml] ---- spring.cloud.vault: @@ -111,7 +104,6 @@ spring.cloud.vault: user-id: MAC_ADDRESS network-interface: eth0 ---- -==== * `network-interface` sets network interface to obtain the physical address @@ -125,7 +117,8 @@ $ echo -n 0AFEDE1234AC | sha256sum NOTE: The Mac address is specified uppercase and without colons. Including the line break of `echo` leads to a different hash value so make sure to include the `-n` flag. -==== Custom UserId +[[custom-userid]] +=== Custom UserId The UserId generation is an open mechanism. You can set @@ -136,7 +129,6 @@ This class must be on your classpath and must implement the `org.springframework Spring Cloud Vault will obtain the UserId by calling `createUserId` each time it authenticates using AppId to obtain a token. .application.yml -==== [source,yaml] ---- spring.cloud.vault: @@ -144,10 +136,8 @@ spring.cloud.vault: app-id: user-id: com.examlple.MyUserIdMechanism ---- -==== .MyUserIdMechanism.java -==== [source,yaml] ---- public class MyUserIdMechanism implements AppIdUserIdMechanism { @@ -159,13 +149,13 @@ public class MyUserIdMechanism implements AppIdUserIdMechanism { } } ---- -==== See also: https://www.vaultproject.io/docs/auth/app-id.html[Vault Documentation: Using the App ID auth backend] -=== AppRole authentication +[[approle-authentication]] +== AppRole authentication -https://www.vaultproject.io/docs/auth/app-id.html[AppRole] is intended for machine authentication, like the deprecated (since Vault 0.6.1) <>. +https://www.vaultproject.io/docs/auth/app-id.html[AppRole] is intended for machine authentication, like the deprecated (since Vault 0.6.1) xref:authentication.adoc#vault.config.authentication.appid[AppId authentication]. AppRole authentication consists of two hard to guess (secret) tokens: RoleId and SecretId. Spring Vault supports various AppRole scenarios (push/pull mode and wrapped). @@ -173,7 +163,6 @@ Spring Vault supports various AppRole scenarios (push/pull mode and wrapped). RoleId and optionally SecretId must be provided by configuration, Spring Vault will not look up these or create a custom SecretId. .application.yml with AppRole authentication properties -==== [source,yaml] ---- spring.cloud.vault: @@ -181,7 +170,6 @@ spring.cloud.vault: app-role: role-id: bde2076b-cccb-3cf0-d57e-bca7b1e83a52 ---- -==== The following scenarios are supported along the required configuration details: @@ -223,7 +211,6 @@ Full pull mode is not yet supported. Using Spring Cloud Vault with the Spring WebFlux stack enables Vault's reactive auto-configuration which can be disabled by setting `spring.cloud.vault.reactive.enabled=false`. .application.yml with all AppRole authentication properties -==== [source,yaml] ---- spring.cloud.vault: @@ -234,7 +221,6 @@ spring.cloud.vault: role: my-role app-role-path: approle ---- -==== * `role-id` sets the RoleId. * `secret-id` sets the SecretId. @@ -245,7 +231,7 @@ SecretId can be omitted if AppRole is configured without requiring SecretId (See See also: https://www.vaultproject.io/docs/auth/approle.html[Vault Documentation: Using the AppRole auth backend] [[vault.config.authentication.awsec2]] -=== AWS-EC2 authentication +== AWS-EC2 authentication The https://www.vaultproject.io/docs/auth/aws-ec2.html[aws-ec2] auth backend provides a secure introduction mechanism for AWS EC2 instances, allowing automated retrieval of a Vault token. @@ -253,13 +239,11 @@ Unlike most Vault authentication backends, this backend does not require first-d Instead, it treats AWS as a Trusted Third Party and uses the cryptographically signed dynamic metadata information that uniquely represents each EC2 instance. .application.yml using AWS-EC2 Authentication -==== [source,yaml] ---- spring.cloud.vault: authentication: AWS_EC2 ---- -==== AWS-EC2 authentication enables nonce by default to follow the Trust On First Use (TOFU) principle. Any unintended party that gains access to the PKCS#7 identity metadata can authenticate against Vault. @@ -276,7 +260,6 @@ You can configure the authentication role by setting the `spring.cloud.vault.aws-ec2.role` property. .application.yml with configured role -==== [source,yaml] ---- spring.cloud.vault: @@ -284,10 +267,8 @@ spring.cloud.vault: aws-ec2: role: application-server ---- -==== .application.yml with all AWS EC2 authentication properties -==== [source,yaml] ---- spring.cloud.vault: @@ -298,7 +279,6 @@ spring.cloud.vault: identity-document: http://... nonce: my-static-nonce ---- -==== * `authentication` setting this value to `AWS_EC2` selects the AWS EC2 authentication method * `role` sets the name of the role against which the login is being attempted. @@ -310,7 +290,7 @@ An empty nonce defaults to nonce generation See also: https://www.vaultproject.io/docs/auth/aws.html[Vault Documentation: Using the aws auth backend] [[vault.config.authentication.awsiam]] -=== AWS-IAM authentication +== AWS-IAM authentication The https://www.vaultproject.io/docs/auth/aws-ec2.html[aws] backend provides a secure authentication mechanism for AWS IAM roles, allowing the automatic authentication with vault based on the current IAM role of the running application. Unlike most Vault authentication backends, this backend does not require first-deploying, or provisioning security-sensitive credentials (tokens, username/password, client certificates, etc.). @@ -324,16 +304,13 @@ When using the AWS-IAM authentication you must create a role in Vault and assign An empty `role` defaults to the friendly name the current IAM role. .application.yml with required AWS-IAM Authentication properties -==== [source,yaml] ---- spring.cloud.vault: authentication: AWS_IAM ---- -==== .application.yml with all AWS-IAM Authentication properties -==== [source,yaml] ---- spring.cloud.vault: @@ -345,7 +322,6 @@ spring.cloud.vault: server-name: some.server.name endpoint-uri: https://sts.eu-central-1.amazonaws.com ---- -==== * `region` sets the name of the AWS region. If not supplied, the region will be determined by AWS defaults. * `role` sets the name of the role against which the login is being attempted. @@ -360,7 +336,7 @@ AWS-IAM requires the AWS Java SDK v2 dependency (`software.amazon.awssdk:auth`) See also: https://www.vaultproject.io/docs/auth/aws.html[Vault Documentation: Using the aws auth backend] [[vault.config.authentication.azuremsi]] -=== Azure MSI authentication +== Azure MSI authentication The https://www.vaultproject.io/docs/auth/azure.html[azure] auth backend provides a secure introduction mechanism for Azure VM instances, allowing automated retrieval of a Vault token. @@ -368,7 +344,6 @@ Unlike most Vault authentication backends, this backend does not require first-d Instead, it treats Azure as a Trusted Third Party and uses the managed service identity and instance metadata information that can be bound to a VM instance. .application.yml with required Azure Authentication properties -==== [source,yaml] ---- spring.cloud.vault: @@ -376,10 +351,8 @@ spring.cloud.vault: azure-msi: role: my-dev-role ---- -==== .application.yml with all Azure Authentication properties -==== [source,yaml] ---- spring.cloud.vault: @@ -390,7 +363,6 @@ spring.cloud.vault: metadata-service: http://169.254.169.254/metadata/instance… identity-token-service: http://169.254.169.254/metadata/identity… ---- -==== * `role` sets the name of the role against which the login is being attempted. * `azure-path` sets the path of the Azure mount to use @@ -407,18 +379,17 @@ See also: * https://docs.microsoft.com/en-us/azure/virtual-machines/windows/instance-metadata-service[Azure Documentation: Azure Instance Metadata Service] [[vault.config.authentication.clientcert]] -=== TLS certificate authentication +== TLS certificate authentication The `cert` auth backend allows authentication using SSL/TLS client certificates that are either signed by a CA or self-signed. To enable `cert` authentication you need to: -1. Use SSL, see <> +1. Use SSL, see xref:other-topics.adoc#vault.config.ssl[Vault Client SSL configuration] 2. Configure a Java `Keystore` that contains the client certificate and the private key 3. Set the `spring.cloud.vault.authentication` to `CERT` .application.yml -==== [source,yaml] ---- spring.cloud.vault: @@ -429,12 +400,11 @@ spring.cloud.vault: key-store-type: JKS cert-auth-path: cert ---- -==== See also: https://www.vaultproject.io/docs/auth/cert.html[Vault Documentation: Using the Cert auth backend] [[vault.config.authentication.cubbyhole]] -=== Cubbyhole authentication +== Cubbyhole authentication Cubbyhole authentication uses Vault primitives to provide a secured authentication workflow. Cubbyhole authentication uses tokens as primary login method. @@ -447,7 +417,6 @@ The login token will be retrieved from a wrapped response stored at `/cubbyhole/ NOTE: Response Wrapping for token creation requires Vault 0.6.0 or higher. .Creating and storing tokens -==== [source,shell] ---- $ vault token-create -wrap-ttl="10m" @@ -458,17 +427,14 @@ wrapping_token_ttl: 0h10m0s wrapping_token_creation_time: 2016-09-18 20:29:48.652957077 +0200 CEST wrapped_accessor: 46b6aebb-187f-932a-26d7-4f3d86a68319 ---- -==== .application.yml -==== [source,yaml] ---- spring.cloud.vault: authentication: CUBBYHOLE token: 397ccb93-ff6c-b17b-9389-380b01ca2645 ---- -==== See also: @@ -477,7 +443,7 @@ See also: * https://www.vaultproject.io/docs/concepts/response-wrapping.html[Vault Documentation: Response Wrapping] [[vault.config.authentication.gcpgce]] -=== GCP-GCE authentication +== GCP-GCE authentication The https://www.vaultproject.io/docs/auth/gcp.html[gcp] auth backend allows Vault login by using existing GCP (Google Cloud Platform) IAM and GCE credentials. @@ -490,7 +456,6 @@ Unlike most Vault authentication backends, this backend does not require first-d Instead, it treats GCP as a Trusted Third Party and uses the cryptographically signed dynamic metadata information that uniquely represents each GCP service account. .application.yml with required GCP-GCE Authentication properties -==== [source,yaml] ---- spring.cloud.vault: @@ -498,10 +463,8 @@ spring.cloud.vault: gcp-gce: role: my-dev-role ---- -==== .application.yml with all GCP-GCE Authentication properties -==== [source,yaml] ---- spring.cloud.vault: @@ -511,7 +474,6 @@ spring.cloud.vault: role: my-dev-role service-account: my-service@projectid.iam.gserviceaccount.com ---- -==== * `role` sets the name of the role against which the login is being attempted. * `gcp-path` sets the path of the GCP mount to use @@ -524,7 +486,7 @@ See also: * https://cloud.google.com/compute/docs/instances/verifying-instance-identity[GCP Documentation: Verifying the Identity of Instances] [[vault.config.authentication.gcpiam]] -=== GCP-IAM authentication +== GCP-IAM authentication The https://www.vaultproject.io/docs/auth/gcp.html[gcp] auth backend allows Vault login by using existing GCP (Google Cloud Platform) IAM and GCE credentials. @@ -538,7 +500,6 @@ environment variable, the Google Compute metadata service, or supplied externall JSON is the preferred form as it carries the project id and service account identifier required for calling ``projects.serviceAccounts.signJwt``. .application.yml with required GCP-IAM Authentication properties -==== [source,yaml] ---- spring.cloud.vault: @@ -546,10 +507,8 @@ spring.cloud.vault: gcp-iam: role: my-dev-role ---- -==== .application.yml with all GCP-IAM Authentication properties -==== [source,yaml] ---- spring.cloud.vault: @@ -564,7 +523,6 @@ spring.cloud.vault: role: my-dev-role service-account-id: my-service@projectid.iam.gserviceaccount.com ---- -==== * `role` sets the name of the role against which the login is being attempted. * `credentials.location` path to the credentials resource that contains Google credentials in JSON format. @@ -589,7 +547,7 @@ See also: [[vault.authentication.gcpiam]] [[vault.config.authentication.kubernetes]] -=== Kubernetes authentication +== Kubernetes authentication Kubernetes authentication mechanism (since Vault 0.8.3) allows to authenticate with Vault using a Kubernetes Service Account Token. The authentication is role based and the role is bound to a service account name and a namespace. @@ -597,7 +555,6 @@ The authentication is role based and the role is bound to a service account name A file containing a JWT token for a pod’s service account is automatically mounted at `/var/run/secrets/kubernetes.io/serviceaccount/token`. .application.yml with all Kubernetes authentication properties -==== [source,yaml] ---- spring.cloud.vault: @@ -607,7 +564,6 @@ spring.cloud.vault: kubernetes-path: kubernetes service-account-token-file: /var/run/secrets/kubernetes.io/serviceaccount/token ---- -==== * `role` sets the Role. * `kubernetes-path` sets the path of the Kubernetes mount to use. @@ -620,7 +576,7 @@ See also: * https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/[Kubernetes Documentation: Configure Service Accounts for Pods] [[vault.config.authentication.pcf]] -=== Pivotal CloudFoundry authentication +== Pivotal CloudFoundry authentication The https://www.vaultproject.io/docs/auth/pcf.html[pcf] auth backend provides a secure introduction mechanism for applications running within Pivotal's CloudFoundry instances allowing automated retrieval of a Vault token. @@ -628,7 +584,6 @@ Unlike most Vault authentication backends, this backend does not require first-d Instead, it treats PCF as a Trusted Third Party and uses the managed instance identity. .application.yml with required PCF Authentication properties -==== [source,yaml] ---- spring.cloud.vault: @@ -636,10 +591,8 @@ spring.cloud.vault: pcf: role: my-dev-role ---- -==== .application.yml with all PCF Authentication properties -==== [source,yaml] ---- spring.cloud.vault: @@ -650,14 +603,13 @@ spring.cloud.vault: instance-certificate: /etc/cf-instance-credentials/instance.crt instance-key: /etc/cf-instance-credentials/instance.key ---- -==== * `role` sets the name of the role against which the login is being attempted. * `pcf-path` sets the path of the PCF mount to use. * `instance-certificate` sets the path to the PCF instance identity certificate. -Defaults to `${CF_INSTANCE_CERT}` env variable. +Defaults to `$\{CF_INSTANCE_CERT}` env variable. * `instance-key` sets the path to the PCF instance identity key. -Defaults to `${CF_INSTANCE_KEY}` env variable. +Defaults to `$\{CF_INSTANCE_KEY}` env variable. NOTE: PCF authentication requires BouncyCastle (bcpkix-jdk15on) to be on the classpath for RSA PSS signing. @@ -690,15 +642,18 @@ This section explains which paths are accessed by Spring Vault so you can derive See also https://www.vaultproject.io/guides/identity/policies. -=== Authentication +[[authentication]] +== Authentication Login: `POST auth/$authMethod/login` -=== KeyValue Mount Discovery +[[keyvalue-mount-discovery]] +== KeyValue Mount Discovery `GET sys/internal/ui/mounts/$mountPath` -=== SecretLeaseContainer +[[secretleasecontainer]] +== SecretLeaseContainer `SecretLeaseContainer` uses different paths depending on the configured lease endpoint. @@ -712,7 +667,8 @@ Login: `POST auth/$authMethod/login` * Revocation: `PUT sys/leases/revoke` * Renewal: `PUT sys/leases/renew` -=== Session Management +[[session-management]] +== Session Management * Token lookup: `GET auth/token/lookup-self` * Renewal: `POST auth/token/renew-self` diff --git a/docs/src/main/asciidoc/config-data.adoc b/docs/modules/ROOT/pages/config-data.adoc similarity index 87% rename from docs/src/main/asciidoc/config-data.adoc rename to docs/modules/ROOT/pages/config-data.adoc index 4d871847..f094f9df 100644 --- a/docs/src/main/asciidoc/config-data.adoc +++ b/docs/modules/ROOT/pages/config-data.adoc @@ -1,5 +1,5 @@ [[vault.configdata]] -== ConfigData API += ConfigData API Spring Boot provides since version 2.4 a ConfigData API that allows the declaration of configuration sources and importing these as property sources. @@ -11,7 +11,7 @@ NOTE: You can enable the bootstrap context either by setting the configuration p Using the boostrap context should be only rarely required hence we recommend using the Config Data API for more flexibility regarding property source ordering. [[vault.configdata.locations]] -=== ConfigData Locations +== ConfigData Locations You can mount Vault configuration through one or more `PropertySource` that are materialized from Vault. Spring Cloud Vault supports two config locations: @@ -19,12 +19,12 @@ Spring Cloud Vault supports two config locations: * `vault://` (default location) * `vault:///` (contextual location) -Using the default location mounts property sources for all enabled <>. +Using the default location mounts property sources for all enabled xref:secret-backends.adoc[Secret Backends]. Without further configuration, Spring Cloud Vault mounts the key-value backend at `/secret/${spring.application.name}`. -Each activated profile adds another context path following the form `/secret/${spring.application.name}/${profile}`. +Each activated profile adds another context path following the form `/secret/$\{spring.application.name}/$\{profile}`. Adding further modules to the classpath, such as `spring-cloud-config-databases`, provides additional secret backend configuration options which get mounted as property sources if enabled. -If you want to control which context paths are mounted from Vault as `PropertySource`, you can either use a contextual location (`vault:///my/context/path`) or configure a <>. +If you want to control which context paths are mounted from Vault as `PropertySource`, you can either use a contextual location (`vault:///my/context/path`) or configure a xref:secret-backends.adoc#vault.config.backends.configurer[`VaultConfigurer`]. Contextual locations are specified and mounted individually. Spring Cloud Vault mounts each location as a unique `PropertySource`. @@ -32,12 +32,10 @@ You can mix the default locations with contextual locations (or other config sys This approach is useful in particular if you want to disable the default key-value path computation and mount each key-value backend yourself instead. .application.yml -==== [source,yaml] ---- spring.config.import: vault://first/context/path, vault://other/path, vault:// ---- -==== Property names within a Spring `Environment` must be unique to avoid shadowing. If you use the same secret names in different context paths and you want to expose these as individual properties you can distinguish them by adding a `prefix` query parameter to the location. @@ -56,7 +54,7 @@ NOTE: Prefixes are added as-is to all property names returned by Vault. If you w ==== [[vault.configdata.location.optional]] -=== Conditionally enable/disable Vault Configuration +== Conditionally enable/disable Vault Configuration In some cases, it can be required to launch an application without Vault. You can express whether a Vault config location should be optional or mandatory (default) through the location string: @@ -65,11 +63,11 @@ In some cases, it can be required to launch an application without Vault. You ca Optional locations are skipped during application startup if Vault support was disabled through `spring.cloud.vault.enabled=false`. -NOTE: Vault context paths that cannot be found (HTTP Status 404) are skipped regardless of whether the config location is marked optional. <> allows failing on start if a Vault context path cannot be found because of HTTP Status 404. +NOTE: Vault context paths that cannot be found (HTTP Status 404) are skipped regardless of whether the config location is marked optional. xref:other-topics.adoc#vault.config.fail-fast[Vault Client Fail Fast] allows failing on start if a Vault context path cannot be found because of HTTP Status 404. [[vault.configdata.customization]] -=== Infrastructure Customization +== Infrastructure Customization Spring Cloud Vault requires infrastructure classes to interact with Vault. When not using the ConfigData API (meaning that you haven't specified `spring.config.import=vault://` or a contextual Vault path), Spring Cloud Vault defines its beans through `VaultAutoConfiguration` and `VaultReactiveAutoConfiguration`. Spring Boot bootstraps the application before a Spring Context is available. Therefore `VaultConfigDataLoader` registers beans itself to propagate these later on into the application context. @@ -77,7 +75,6 @@ Spring Boot bootstraps the application before a Spring Context is available. The You can customize the infrastructure used by Spring Cloud Vault by registering custom instances using the `Bootstrapper` API: .Customizing `ClientHttpRequestFactory` -==== [source,java] ---- ClientOptions options = new ClientOptions(); @@ -90,10 +87,8 @@ new ClientFactoryWrapper(new HttpComponentsClientHttpRequestFactory(builder.buil SpringApplication application = new SpringApplication(MyApplication.class); application.addBootstrapRegistryInitializer(registry -> registry.register(ClientFactoryWrapper.class, supplier)); ---- -==== .Customizing `RestTemplateBuilder` -==== [source,java] ---- InstanceSupplier supplier = context -> { @@ -107,6 +102,5 @@ InstanceSupplier supplier = context -> { SpringApplication application = new SpringApplication(MyApplication.class); application.addBootstrapRegistryInitializer(registry -> registry.register(RestTemplateBuilder.class, supplier)); ---- -==== -See also <> and the source of `VaultConfigDataLoader` for customization hooks. +See also xref:secret-backends.adoc#vault.config.backends.configurer[Customize which secret backends to expose as PropertySource] and the source of `VaultConfigDataLoader` for customization hooks. diff --git a/docs/modules/ROOT/pages/configprops.adoc b/docs/modules/ROOT/pages/configprops.adoc new file mode 100644 index 00000000..32cbb8e5 --- /dev/null +++ b/docs/modules/ROOT/pages/configprops.adoc @@ -0,0 +1,6 @@ +[[configuration-properties]] += Configuration Properties + +Below you can find a list of configuration properties. + +include::partial$_configprops.adoc[] diff --git a/docs/src/main/asciidoc/index.adoc b/docs/modules/ROOT/pages/index.adoc similarity index 100% rename from docs/src/main/asciidoc/index.adoc rename to docs/modules/ROOT/pages/index.adoc diff --git a/docs/src/main/asciidoc/intro.adoc b/docs/modules/ROOT/pages/intro.adoc similarity index 100% rename from docs/src/main/asciidoc/intro.adoc rename to docs/modules/ROOT/pages/intro.adoc diff --git a/docs/src/main/asciidoc/new-features.adoc b/docs/modules/ROOT/pages/new-features.adoc similarity index 52% rename from docs/src/main/asciidoc/new-features.adoc rename to docs/modules/ROOT/pages/new-features.adoc index 0684ccc8..5865f5ef 100644 --- a/docs/src/main/asciidoc/new-features.adoc +++ b/docs/modules/ROOT/pages/new-features.adoc @@ -1,12 +1,14 @@ -== New & Noteworthy +[[new-noteworthy]] += New & Noteworthy +:page-section-summary-toc: 1 This section briefly covers items that are new and noteworthy in the latest releases. [[new-in-3.0.0]] -=== New in Spring Cloud Vault 3.0 +== New in Spring Cloud Vault 3.0 -* Migration of `PropertySource` initialization from Spring Cloud's Bootstrap Context to Spring Boot's <>. -* Support for the <> backend. +* Migration of `PropertySource` initialization from Spring Cloud's Bootstrap Context to Spring Boot's xref:config-data.adoc[ConfigData API]. +* Support for the xref:secret-backends.adoc#vault.config.backends.couchbase[Couchbase Database] backend. * Configuration of keystore/truststore types through `spring.cloud.vault.ssl.key-store-type=…`/`spring.cloud.vault.ssl.trust-store-type=…` including PEM support. * Support for `ReactiveDiscoveryClient` by configuring a `ReactiveVaultEndpointProvider`. -* Support to configure <>. +* Support to configure xref:secret-backends.adoc#vault.config.backends.databases[Multiple Databases]. diff --git a/docs/src/main/asciidoc/other-topics.adoc b/docs/modules/ROOT/pages/other-topics.adoc similarity index 98% rename from docs/src/main/asciidoc/other-topics.adoc rename to docs/modules/ROOT/pages/other-topics.adoc index 67ef84e6..840861c6 100644 --- a/docs/src/main/asciidoc/other-topics.adoc +++ b/docs/modules/ROOT/pages/other-topics.adoc @@ -1,4 +1,5 @@ -== Service Registry Configuration +[[service-registry-configuration]] += Service Registry Configuration You can use a `DiscoveryClient` (such as from Spring Cloud Consul) to locate a Vault server by setting spring.cloud.vault.discovery.enabled=true (default `false`). The net result of that is that your apps need a application.yml (or an environment variable) with the appropriate discovery configuration. @@ -11,14 +12,12 @@ Some additional properties of the service may need to be configured in its servi Service registries that do not provide details about transport layer security need to provide a `scheme` metadata entry to be set either to `https` or `http`. If no scheme is configured and the service is not exposed as secure service, then configuration defaults to `spring.cloud.vault.scheme` which is `https` when it's not set. -==== [source,yaml] ---- spring.cloud.vault.discovery: enabled: true service-id: my-vault-service ---- -==== [[vault.config.fail-fast]] == Vault Client Fail Fast @@ -27,13 +26,11 @@ In some cases, it may be desirable to fail startup of a service if it cannot con If this is the desired behavior, set the bootstrap configuration property `spring.cloud.vault.fail-fast=true` and the client will halt with an Exception. -==== [source,yaml] ---- spring.cloud.vault: fail-fast: true ---- -==== [[vault.config.namespaces]] == Vault Enterprise Namespace Support @@ -46,13 +43,11 @@ Configuring a namespace by setting Please note that this feature is not supported by Vault Community edition and has no effect on Vault operations. -==== [source,yaml] ---- spring.cloud.vault: namespace: my-namespace ---- -==== See also: https://www.vaultproject.io/docs/enterprise/namespaces/index.html[Vault Enterprise: Namespaces] @@ -63,7 +58,6 @@ SSL can be configured declaratively by setting various properties. You can set either `javax.net.ssl.trustStore` to configure JVM-wide SSL settings or `spring.cloud.vault.ssl.trust-store` to set SSL settings only for Spring Cloud Vault Config. -==== [source,yaml] ---- spring.cloud.vault: @@ -74,7 +68,6 @@ spring.cloud.vault: enabled-protocols: TLSv1.2,TLSv1.3 enabled-cipher-suites: TLS_AES_128_GCM_SHA256 ---- -==== * `trust-store` sets the resource for the trust-store. SSL-secured Vault communication will validate the Vault SSL certificate with the specified trust-store. @@ -106,7 +99,6 @@ Lease renewal and revocation is enabled by default and can be disabled by settin to `false`. This is not recommended as leases can expire and Spring Cloud Vault cannot longer access Vault or services using generated credentials and valid credentials remain active after application shutdown. -==== [source,yaml] ---- spring.cloud.vault: @@ -117,7 +109,6 @@ spring.cloud.vault: lease-endpoints: Legacy ---- -==== * `enabled` controls whether leases associated with secrets are considered to be renewed and expired secrets are rotated. Enabled by default. @@ -147,7 +138,6 @@ Session lifecycle is enabled by default and can be disabled by setting `spring.c to `false`. Disabling is not recommended as session tokens can expire and Spring Cloud Vault cannot longer access Vault. -==== [source,yaml] ---- spring.cloud.vault: @@ -156,7 +146,6 @@ spring.cloud.vault: refresh-before-expiry: 10s expiry-threshold: 20s ---- -==== * `enabled` controls whether session lifecycle management is enabled to renew session tokens. Enabled by default. diff --git a/docs/src/main/asciidoc/quickstart.adoc b/docs/modules/ROOT/pages/quickstart.adoc similarity index 93% rename from docs/src/main/asciidoc/quickstart.adoc rename to docs/modules/ROOT/pages/quickstart.adoc index 755be787..434eb34c 100644 --- a/docs/src/main/asciidoc/quickstart.adoc +++ b/docs/modules/ROOT/pages/quickstart.adoc @@ -1,4 +1,5 @@ -:docs: https://cloud.spring.io/spring-cloud-vault/reference/html/ +[[quick-start]] += Quick Start *Prerequisites* @@ -126,13 +127,13 @@ where the "application" is injected as the `spring.application.name` in the `SpringApplication` (i.e. what is normally "application" in a regular Spring Boot app), "profile" is an active profile (or comma-separated list of properties). Properties retrieved from Vault will be used "as-is" without further prefixing of the property names. +[[client-side-usage]] == Client Side Usage To use these features in an application, just build it as a Spring Boot application that depends on `spring-cloud-vault-config` (e.g. see the test cases). Example Maven configuration: .pom.xml -==== [source,xml,indent=0,subs="verbatim,quotes,attributes"] ---- @@ -166,11 +167,9 @@ Example Maven configuration: ---- -==== Then you can create a standard Spring Boot application, like this simple HTTP server: -==== [source,java] ---- @SpringBootApplication @@ -187,13 +186,11 @@ public class Application { } } ---- -==== When it runs it will pick up the external configuration from the default local Vault server on port `8200` if it is running. To modify the startup behavior you can change the location of the Vault server using `application.properties`, for example .application.yml -==== [source,yaml] ---- spring.cloud.vault: @@ -206,7 +203,6 @@ spring.cloud.vault: config: spring.config.import: vault:// ---- -==== * `host` sets the hostname of the Vault host. The host name will be used for SSL certificate validation @@ -220,34 +216,33 @@ Supported schemes are `http` and `https`. Enabling further integrations requires additional dependencies and configuration. Depending on how you have set up Vault you might need additional configuration like -{docs}#vault.config.ssl[SSL] and -{docs}#vault.config.authentication[authentication]. +xref:other-topics.adoc#vault.config.ssl[SSL] and +xref:authentication.adoc#vault.config.authentication[authentication]. If the application imports the `spring-boot-starter-actuator` project, the status of the vault server will be available via the `/health` endpoint. The vault health indicator can be enabled or disabled through the property `management.health.vault.enabled` (default to `true`). NOTE: With Spring Cloud Vault 3.0 and Spring Boot 2.4, the bootstrap context initialization (`bootstrap.yml`, `bootstrap.properties`) of property sources was deprecated. -Instead, Spring Cloud Vault favors Spring Boot's Config Data API which allows importing configuration from Vault. With Spring Boot Config Data approach, you need to set the `spring.config.import` property in order to bind to Vault. You can read more about it in the <>. +Instead, Spring Cloud Vault favors Spring Boot's Config Data API which allows importing configuration from Vault. With Spring Boot Config Data approach, you need to set the `spring.config.import` property in order to bind to Vault. You can read more about it in the xref:config-data.adoc#vault.configdata.locations[Config Data Locations section]. You can enable the bootstrap context either by setting the configuration property `spring.cloud.bootstrap.enabled=true` or by including the dependency `org.springframework.cloud:spring-cloud-starter-bootstrap`. -=== Authentication +[[authentication]] +== Authentication Vault requires an https://www.vaultproject.io/docs/concepts/auth.html[authentication mechanism] to https://www.vaultproject.io/docs/concepts/tokens.html[authorize client requests]. -Spring Cloud Vault supports multiple {docs}#vault.config.authentication[authentication mechanisms] to authenticate applications with Vault. +Spring Cloud Vault supports multiple xref:authentication.adoc#vault.config.authentication[authentication mechanisms] to authenticate applications with Vault. -For a quickstart, use the root token printed by the <>. +For a quickstart, use the root token printed by the xref:quickstart.adoc#quickstart.vault.start[Vault initialization]. .application.yml -==== [source,yaml] ---- spring.cloud.vault: token: 19aefa97-cccc-bbbb-aaaa-225940e63d76 spring.config.import: vault:// ---- -==== WARNING: Consider carefully your security requirements. Static token authentication is fine if you want quickly get started with Vault, but a static token is not protected any further. diff --git a/docs/src/main/asciidoc/secret-backends.adoc b/docs/modules/ROOT/pages/secret-backends.adoc similarity index 97% rename from docs/src/main/asciidoc/secret-backends.adoc rename to docs/modules/ROOT/pages/secret-backends.adoc index a004b6fa..a05b454c 100644 --- a/docs/src/main/asciidoc/secret-backends.adoc +++ b/docs/modules/ROOT/pages/secret-backends.adoc @@ -1,10 +1,10 @@ [[vault.config.backends]] -== Secret Backends += Secret Backends [[vault.config.backends.kv]] [[vault.config.backends.generic]] [[vault.config.backends.kv.versioned]] -=== Key-Value Backend +== Key-Value Backend Spring Cloud Vault supports both Key-Value secret backends, the versioned (v2) and unversioned (v1). The key-value backend allows storage of arbitrary values as key-value store. @@ -45,7 +45,6 @@ Properties are exposed like they are stored (i.e. without additional prefixes). NOTE: Spring Cloud Vault adds the `data/` context between the mount path and the actual context path depending on whether the mount uses the versioned key-value backend. -==== [source,yaml] ---- spring.cloud.vault: @@ -57,7 +56,6 @@ spring.cloud.vault: application-name: my-app profiles: local, cloud ---- -==== * `enabled` setting this value to `false` disables the secret backend config usage * `backend` sets the path of the secret mount to use @@ -74,14 +72,13 @@ See also: * https://www.vaultproject.io/docs/secrets/kv/kv-v2.html[Vault Documentation: Using the KV Secrets Engine - Version 2 (versioned key-value backend)] [[vault.config.backends.consul]] -=== Consul +== Consul Spring Cloud Vault can obtain credentials for HashiCorp Consul. The Consul integration requires the `spring-cloud-vault-config-consul` dependency. .pom.xml -==== [source,xml,indent=0,subs="verbatim,quotes,attributes"] ---- @@ -92,7 +89,6 @@ dependency. ---- -==== The integration can be enabled by setting `spring.cloud.vault.consul.enabled=true` (default `false`) and providing the role name with `spring.cloud.vault.consul.role=…`. @@ -101,7 +97,6 @@ The obtained token is stored in `spring.cloud.consul.token` so using Spring Cloud Consul can pick up the generated credentials without further configuration. You can configure the property name by setting `spring.cloud.vault.consul.token-property`. -==== [source,yaml] ---- spring.cloud.vault: @@ -111,7 +106,6 @@ spring.cloud.vault: backend: consul token-property: spring.cloud.consul.token ---- -==== * `enabled` setting this value to `true` enables the Consul backend config usage * `role` sets the role name of the Consul role definition @@ -121,7 +115,7 @@ spring.cloud.vault: See also: https://www.vaultproject.io/docs/secrets/consul/index.html[Vault Documentation: Setting up Consul with Vault] [[vault.config.backends.rabbitmq]] -=== RabbitMQ +== RabbitMQ Spring Cloud Vault can obtain credentials for RabbitMQ. @@ -129,7 +123,6 @@ The RabbitMQ integration requires the `spring-cloud-vault-config-rabbitmq` dependency. .pom.xml -==== [source,xml,indent=0,subs="verbatim,quotes,attributes"] ---- @@ -140,7 +133,6 @@ dependency. ---- -==== The integration can be enabled by setting `spring.cloud.vault.rabbitmq.enabled=true` (default `false`) and providing the role name with `spring.cloud.vault.rabbitmq.role=…`. @@ -150,7 +142,6 @@ and `spring.rabbitmq.password` so using Spring Boot will pick up the generated c You can configure the property names by setting `spring.cloud.vault.rabbitmq.username-property` and `spring.cloud.vault.rabbitmq.password-property`. -==== [source,yaml] ---- spring.cloud.vault: @@ -161,7 +152,6 @@ spring.cloud.vault: username-property: spring.rabbitmq.username password-property: spring.rabbitmq.password ---- -==== * `enabled` setting this value to `true` enables the RabbitMQ backend config usage * `role` sets the role name of the RabbitMQ role definition @@ -172,7 +162,7 @@ spring.cloud.vault: See also: https://www.vaultproject.io/docs/secrets/rabbitmq/index.html[Vault Documentation: Setting up RabbitMQ with Vault] [[vault.config.backends.aws]] -=== AWS +== AWS Spring Cloud Vault can obtain credentials for AWS. @@ -180,7 +170,6 @@ The AWS integration requires the `spring-cloud-vault-config-aws` dependency. .pom.xml -==== [source,xml,indent=0,subs="verbatim,quotes,attributes"] ---- @@ -191,7 +180,6 @@ dependency. ---- -==== The integration can be enabled by setting `spring.cloud.vault.aws=true` (default `false`) and providing the role name with `spring.cloud.vault.aws.role=…`. @@ -212,7 +200,6 @@ For STS security token, you can configure the property name by setting `spring.c Example: iam_user -==== [source,yaml] ---- spring.cloud.vault: @@ -223,10 +210,8 @@ spring.cloud.vault: access-key-property: cloud.aws.credentials.accessKey secret-key-property: cloud.aws.credentials.secretKey ---- -==== Example: assumed_role (STS) -==== [source,yaml] ---- spring.cloud.vault: @@ -241,7 +226,6 @@ spring.cloud.vault: ttl: 3600s role-arn: arn:aws:iam::${AWS_ACCOUNT}:role/sts-app-role ---- -==== * `enabled` setting this value to `true` enables the AWS backend config usage * `role` sets the role name of the AWS role definition @@ -263,13 +247,13 @@ This means services that need to access a database no longer need to configure c Spring Cloud Vault integrates with these backends: -* <> -* <> -* <> -* <> -* <> -* <> -* <> +* xref:secret-backends.adoc#vault.config.backends.database[Database] +* xref:secret-backends.adoc#vault.config.backends.cassandra[Apache Cassandra] +* xref:secret-backends.adoc#vault.config.backends.couchbase[Couchbase Database] +* xref:secret-backends.adoc#vault.config.backends.elasticsearch[Elasticsearch] +* xref:secret-backends.adoc#vault.config.backends.mongodb[MongoDB] +* xref:secret-backends.adoc#vault.config.backends.mysql[MySQL] +* xref:secret-backends.adoc#vault.config.backends.postgresql[PostgreSQL] Using a database secret backend requires to enable the backend in the configuration and the `spring-cloud-vault-config-databases` dependency. @@ -279,7 +263,6 @@ You can use that specific backend by using the generic database backend. Make sure to specify the appropriate backend path, e.g. `spring.cloud.vault.mysql.role.backend=database`. .pom.xml -==== [source,xml,indent=0,subs="verbatim,quotes,attributes"] ---- @@ -290,12 +273,11 @@ Make sure to specify the appropriate backend path, e.g. `spring.cloud.vault.mysq ---- -==== NOTE: Enabling multiple JDBC-compliant databases will generate credentials and store them by default in the same property keys hence property names for JDBC secrets need to be configured separately. [[vault.config.backends.database]] -=== Database +== Database Spring Cloud Vault can obtain credentials for any database listed at https://www.vaultproject.io/api/secret/databases/index.html. @@ -310,7 +292,6 @@ You can configure the property names by setting `spring.cloud.vault.database.username-property` and `spring.cloud.vault.database.password-property`. -==== [source,yaml] ---- spring.cloud.vault: @@ -321,17 +302,15 @@ spring.cloud.vault: username-property: spring.datasource.username password-property: spring.datasource.password ---- -==== [[vault.config.backends.databases]] -=== Multiple Databases +== Multiple Databases Sometimes, credentials for a single database isn't sufficient because an application might connect to two or more databases of the same kind. Beginning with version 3.0.5, Spring Vault supports the configuration of multiple database secret backends under the `spring.cloud.vault.databases.*` namespace. The configuration accepts multiple database backends to materialize credentials into the specified properties. Make sure to configure `username-property` and `password-property` appropriately. -==== [source,yaml] ---- spring.cloud.vault: @@ -349,7 +328,6 @@ spring.cloud.vault: username-property: spring.secondary-datasource.username password-property: spring.secondary-datasource.password ---- -==== * `` descriptive name of the database configuration. * `.enabled` setting this value to `true` enables the Database backend config usage @@ -364,7 +342,7 @@ WARNING: Spring Cloud Vault does not support getting new credentials and configu That is, if `max_ttl` of the Database role in Vault is set to `24h` that means that 24 hours after your application has started it can no longer authenticate with the database. [[vault.config.backends.cassandra]] -=== Apache Cassandra +== Apache Cassandra NOTE: The `cassandra` backend has been deprecated in Vault 0.7.1 and it is recommended to use the `database` backend and mount it as `cassandra`. @@ -378,7 +356,6 @@ You can configure the property names by setting `spring.cloud.vault.cassandra.username-property` and `spring.cloud.vault.cassandra.password-property`. -==== [source,yaml] ---- spring.cloud.vault: @@ -389,7 +366,6 @@ spring.cloud.vault: username-property: spring.data.cassandra.username password-property: spring.data.cassandra.password ---- -==== * `enabled` setting this value to `true` enables the Cassandra backend config usage * `role` sets the role name of the Cassandra role definition @@ -400,7 +376,7 @@ spring.cloud.vault: See also: https://www.vaultproject.io/docs/secrets/cassandra/index.html[Vault Documentation: Setting up Apache Cassandra with Vault] [[vault.config.backends.couchbase]] -=== Couchbase Database +== Couchbase Database Spring Cloud Vault can obtain credentials for Couchbase. The integration can be enabled by setting @@ -412,7 +388,6 @@ You can configure the property names by setting `spring.cloud.vault.couchbase.username-property` and `spring.cloud.vault.couchbase.password-property`. -==== [source,yaml] ---- spring.cloud.vault: @@ -423,7 +398,6 @@ spring.cloud.vault: username-property: spring.couchbase.username password-property: spring.couchbase.password ---- -==== * `enabled` setting this value to `true` enables the Couchbase backend config usage * `role` sets the role name of the Couchbase role definition @@ -434,7 +408,7 @@ spring.cloud.vault: See also: https://github.com/hashicorp/vault-plugin-database-couchbase[Couchbase Database Plugin Documentation] [[vault.config.backends.elasticsearch]] -=== Elasticsearch +== Elasticsearch Spring Cloud Vault can obtain since version 3.0 credentials for Elasticsearch. The integration can be enabled by setting @@ -446,7 +420,6 @@ You can configure the property names by setting `spring.cloud.vault.elasticsearch.username-property` and `spring.cloud.vault.elasticsearch.password-property`. -==== [source,yaml] ---- spring.cloud.vault: @@ -457,7 +430,6 @@ spring.cloud.vault: username-property: spring.elasticsearch.rest.username password-property: spring.elasticsearch.rest.password ---- -==== * `enabled` setting this value to `true` enables the Elasticsearch database backend config usage * `role` sets the role name of the Elasticsearch role definition @@ -468,7 +440,7 @@ spring.cloud.vault: See also: https://www.vaultproject.io/docs/secrets/databases/elasticdb[Vault Documentation: Setting up Elasticsearch with Vault] [[vault.config.backends.mongodb]] -=== MongoDB +== MongoDB NOTE: The `mongodb` backend has been deprecated in Vault 0.7.1 and it is recommended to use the `database` backend and mount it as `mongodb`. @@ -482,7 +454,6 @@ You can configure the property names by setting `spring.cloud.vault.mongodb.username-property` and `spring.cloud.vault.mongodb.password-property`. -==== [source,yaml] ---- spring.cloud.vault: @@ -493,7 +464,6 @@ spring.cloud.vault: username-property: spring.data.mongodb.username password-property: spring.data.mongodb.password ---- -==== * `enabled` setting this value to `true` enables the MongodB backend config usage * `role` sets the role name of the MongoDB role definition @@ -504,7 +474,7 @@ spring.cloud.vault: See also: https://www.vaultproject.io/docs/secrets/mongodb/index.html[Vault Documentation: Setting up MongoDB with Vault] [[vault.config.backends.mysql]] -=== MySQL +== MySQL NOTE: The `mysql` backend has been deprecated in Vault 0.7.1 and it is recommended to use the `database` backend and mount it as `mysql`. Configuration for `spring.cloud.vault.mysql` will be removed in a future version. @@ -519,7 +489,6 @@ You can configure the property names by setting `spring.cloud.vault.mysql.username-property` and `spring.cloud.vault.mysql.password-property`. -==== [source,yaml] ---- spring.cloud.vault: @@ -530,7 +499,6 @@ spring.cloud.vault: username-property: spring.datasource.username password-property: spring.datasource.password ---- -==== * `enabled` setting this value to `true` enables the MySQL backend config usage * `role` sets the role name of the MySQL role definition @@ -541,7 +509,7 @@ spring.cloud.vault: See also: https://www.vaultproject.io/docs/secrets/mysql/index.html[Vault Documentation: Setting up MySQL with Vault] [[vault.config.backends.postgresql]] -=== PostgreSQL +== PostgreSQL NOTE: The `postgresql` backend has been deprecated in Vault 0.7.1 and it is recommended to use the `database` backend and mount it as `postgresql`. Configuration for `spring.cloud.vault.postgresql` will be removed in a future version. @@ -556,7 +524,6 @@ You can configure the property names by setting `spring.cloud.vault.postgresql.username-property` and `spring.cloud.vault.postgresql.password-property`. -==== [source,yaml] ---- spring.cloud.vault: @@ -567,7 +534,6 @@ spring.cloud.vault: username-property: spring.datasource.username password-property: spring.datasource.password ---- -==== * `enabled` setting this value to `true` enables the PostgreSQL backend config usage * `role` sets the role name of the PostgreSQL role definition @@ -592,7 +558,6 @@ Default key-value and discovered backend registration is disabled if you provide You can however enable default registration with `SecretBackendConfigurer.registerDefaultKeyValueSecretBackends()` and `SecretBackendConfigurer.registerDefaultDiscoveredSecretBackends()`. -==== [source,java] ---- public class CustomizationBean implements VaultConfigurer { @@ -612,7 +577,6 @@ public class CustomizationBean implements VaultConfigurer { SpringApplication application = new SpringApplication(MyApplication.class); application.addBootstrapper(VaultBootstrapper.fromConfigurer(new CustomizationBean())); ---- -==== [[vault.config.backends.custom]] == Custom Secret Backend Implementations diff --git a/docs/src/main/asciidoc/_configprops.adoc b/docs/modules/ROOT/partials/_configprops.adoc similarity index 100% rename from docs/src/main/asciidoc/_configprops.adoc rename to docs/modules/ROOT/partials/_configprops.adoc diff --git a/docs/pom.xml b/docs/pom.xml index a0ea35a7..6a1cbeda 100644 --- a/docs/pom.xml +++ b/docs/pom.xml @@ -3,29 +3,24 @@ xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - + org.springframework.cloud + spring-cloud-vault-docs org.springframework.cloud spring-cloud-vault-parent 4.1.0-SNAPSHOT .. - - spring-cloud-vault-docs - 4.1.0-SNAPSHOT - jar Spring Cloud Vault Docs - Spring Cloud Docs - + Spring Cloud Vault Docs spring-cloud-vault ${basedir}/.. - spring.cloud.vault.*| - - deploy + spring.cloud.vault.* + + none - ${project.groupId} @@ -48,7 +43,6 @@ spring-cloud-vault-config-rabbitmq - src/main/asciidoc @@ -81,11 +75,16 @@ - docs + + + src/main/antora/resources/antora-resources + true + + pl.project13.maven @@ -96,17 +95,17 @@ maven-dependency-plugin - org.apache.maven.plugins - maven-resources-plugin + io.spring.maven.antora + antora-component-version-maven-plugin + + + io.spring.maven.antora + antora-maven-plugin org.codehaus.mojo exec-maven-plugin - - org.asciidoctor - asciidoctor-maven-plugin - org.apache.maven.plugins maven-antrun-plugin @@ -118,15 +117,4 @@ - - - - spring-milestones - Spring Milestones - https://repo.spring.io/milestone - - false - - - diff --git a/docs/src/main/antora/resources/antora-resources/antora.yml b/docs/src/main/antora/resources/antora-resources/antora.yml new file mode 100644 index 00000000..9148923f --- /dev/null +++ b/docs/src/main/antora/resources/antora-resources/antora.yml @@ -0,0 +1,20 @@ +version: @antora-component.version@ +prerelease: @antora-component.prerelease@ + +asciidoc: + attributes: + attribute-missing: 'warn' + chomp: 'all' + project-root: @maven.multiModuleProjectDirectory@ + github-repo: @docs.main@ + github-raw: https://raw.githubusercontent.com/spring-cloud/@docs.main@/@github-tag@ + github-code: https://github.com/spring-cloud/@docs.main@/tree/@github-tag@ + github-issues: https://github.com/spring-cloud/@docs.main@/issues/ + github-wiki: https://github.com/spring-cloud/@docs.main@/wiki + spring-cloud-version: @project.version@ + github-tag: @github-tag@ + version-type: @version-type@ + docs-url: https://docs.spring.io/@docs.main@/docs/@project.version@ + raw-docs-url: https://raw.githubusercontent.com/spring-cloud/@docs.main@/@github-tag@ + project-version: @project.version@ + project-name: @docs.main@ diff --git a/docs/src/main/asciidoc/README.adoc b/docs/src/main/asciidoc/README.adoc index 4f74e3d2..5d4a9b8a 100644 --- a/docs/src/main/asciidoc/README.adoc +++ b/docs/src/main/asciidoc/README.adoc @@ -1,13 +1,14 @@ :docs: https://cloud.spring.io/spring-cloud-vault/spring-cloud-vault.html -include::intro.adoc[] +[[features]] += Features -== Features - -=== Spring Cloud Vault Config Client +[[spring-cloud-vault-config-client]] +== Spring Cloud Vault Config Client Specifically for Spring applications: +// TODO: fix links * Retrieve secrets from Vault and initialize Spring Environment with remote property sources. * Obtain {docs}#vault.config.backends.kv[Key-Value secrets] secured with SSL. * Generate credentials for @@ -28,13 +29,13 @@ Specifically for Spring applications: * Bootstrap application context: a parent context for the main application that can be trained to do anything. -== Quick Start +include::../../../modules/ROOT/pages/quickstart.adoc[] -include::quickstart.adoc[] +[[building]] += Building -== Building - -=== Build requirements for Vault +[[build-requirements-for-vault]] +== Build requirements for Vault Spring Cloud Vault Config requires SSL certificates and a running Vault instance listening on `localhost:8200`. Certificates and the Vault setup are scripted, the scripts are located in `src/test/bash`. @@ -62,8 +63,9 @@ $ ./docs/src/main/ruby/generate_readme.sh > README.adoc This script requires ruby and the asciidoctor gem installed (`gem install asciidoctor`) -include::https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/docs/src/main/asciidoc/building.adoc[] +include::https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/main/docs/modules/ROOT/pages/building.adoc[] -== Contributing +[[contributing]] += Contributing include::https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/docs/src/main/asciidoc/contributing.adoc[] diff --git a/docs/src/main/asciidoc/spring-cloud-vault.adoc b/docs/src/main/asciidoc/spring-cloud-vault.adoc deleted file mode 100644 index 42cb1093..00000000 --- a/docs/src/main/asciidoc/spring-cloud-vault.adoc +++ /dev/null @@ -1,31 +0,0 @@ -= Spring Cloud Vault -:github: https://github.com/spring-cloud/spring-cloud-vault -:githubmaster: {github}/tree/master -:revnumber: {project-version} -:docslink: {githubmaster}/docs/src/main/asciidoc -:toc: left -:nofooter: - -(C) 2016-2021 the original authors. - -NOTE: _Copies of this document may be made for your own use and for distribution to others, provided that you do not charge any fee for such copies and further provided that each copy contains this Copyright Notice, whether distributed in print or electronically._ - -include::intro.adoc[] - -include::_attributes.adoc[] - -include::new-features.adoc[] - -== Quick Start - -include::quickstart.adoc[] - -include::config-data.adoc[] - -include::authentication.adoc[] - -include::secret-backends.adoc[] - -include::other-topics.adoc[] - -include::appendix.adoc[]