diff --git a/.github/workflows/build-APIdocs-layer.yml b/.github/workflows/build-APIdocs-layer.yml new file mode 100644 index 00000000..6ffaa59f --- /dev/null +++ b/.github/workflows/build-APIdocs-layer.yml @@ -0,0 +1,55 @@ +name: build-api-docs +on: + pull_request: + branches: + - main + paths: + - .github/workflows/build-APIdocs-layer.yml + - Dockerfile-metadata + + push: + branches: + - main + paths: + - .github/workflows/build-APIdocs-layer.yml + - Dockerfile-metadata + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +env: + tagv2: 2.5.5 + tagv3: 3.2.6 + +permissions: + contents: 'read' + +jobs: + build-push: + name: Build and push API docs layer + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set Steeltoe versions to use + run: |- + echo '2:'${{ env.tagv2 }} > metadata.conf + echo '3:'${{ env.tagv3 }} >> metadata.conf + echo "STEELTOE_VERSIONS=${{ env.tagv2 }}-${{ env.tagv3 }}" >> $GITHUB_ENV + shell: bash + + - name: Login to container registry + uses: docker/login-action@v3 + with: + registry: "${{ vars.DOCKER_REGISTRY }}" + username: "${{ secrets.DOCKER_USERNAME }}" + password: "${{ secrets.DOCKER_PASSWORD }}" + + - name: Build image + run: docker build . --file "Dockerfile-metadata" -t ${{ vars.DOCKER_REGISTRY }}/documentation-metadata:${{ env.STEELTOE_VERSIONS }} + + - name: Push image + if: ${{ github.event_name != 'pull_request' }} + run: docker push ${{ vars.DOCKER_REGISTRY }}/documentation-metadata:${{ env.STEELTOE_VERSIONS }} diff --git a/.github/workflows/build-and-stage.yml b/.github/workflows/build-and-stage.yml new file mode 100644 index 00000000..08ea56f9 --- /dev/null +++ b/.github/workflows/build-and-stage.yml @@ -0,0 +1,91 @@ +name: build-website +on: + workflow_run: + workflows: [build-api-docs] + types: [completed] + pull_request: + branches: + - main + paths: + - "*" + - "!README.md" + - "!docfx/" + - "!build-metadata.sh" + - "!metadata.conf" + push: + branches: + - main + paths: + - "*" + - "!README.md" + - "!docfx/" + - "!build-metadata.sh" + - "!Dockerfile-metadata" + - "!metadata.conf" + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +permissions: + contents: 'read' + pull-requests: 'write' + +env: + IMAGE_TAG: ${{ github.event_name == 'pull_request' && format('pr-{0}', github.event.number) || github.run_id }} + +jobs: + build-push-deploy: + name: Build and push documentation image + environment: + name: ${{ github.event_name == 'pull_request' && format('pr-{0}', github.event.number) || vars.STAGING_SLOT_NAME }} + url: ${{ steps.deploy-to-webapp.outputs.webapp-url }} + env: + SLOT_NAME: ${{ github.event_name == 'pull_request' && format('pr-{0}', github.event.number) || vars.STAGING_SLOT_NAME }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Login to Azure + uses: azure/login@v1 + with: + creds: ${{ secrets.AZURE_CREDENTIALS }} + + - name: Login to container registry + uses: azure/docker-login@v1 + with: + login-server: "${{ vars.DOCKER_REGISTRY }}" + username: "${{ secrets.DOCKER_USERNAME }}" + password: "${{ secrets.DOCKER_PASSWORD }}" + + - name: Build image + run: docker build . --file "Dockerfile" -t ${{ vars.DOCKER_REGISTRY }}/documentation:${{ env.IMAGE_TAG }} + + - name: Push image + run: docker push ${{ vars.DOCKER_REGISTRY }}/documentation:${{ env.IMAGE_TAG }} + + - name: If PR, create a new staging slot + if: ${{ github.event_name == 'pull_request' }} + run: az webapp deployment slot create --resource-group ${{ vars.AZURE_RESOURCE_GROUP }} --name ${{ vars.AZURE_WEBAPP_NAME}} --slot ${{ env.SLOT_NAME }} + + - name: Deploy to staging slot + uses: azure/webapps-deploy@v3 + id: deploy-to-webapp + with: + app-name: ${{ vars.AZURE_WEBAPP_NAME }} + images: ${{ vars.DOCKER_REGISTRY }}/documentation:${{ env.IMAGE_TAG }} + slot-name: ${{ env.SLOT_NAME }} + + - name: If PR, comment with the preview link + if: ${{ github.event_name == 'pull_request' }} + uses: mshick/add-pr-comment@v2 + with: + message: | + ## Preview link: https://${{ vars.AZURE_WEBAPP_NAME }}-${{ env.SLOT_NAME }}.azurewebsites.net + + - Your changes have been deployed to the preview site. The preview site will update as you add more commits to this branch. + - The preview link is shareable, but will be deleted when the pull request is merged or closed. + + > *This is an automated message.* + repo-token: ${{ secrets.GITHUB_TOKEN }} + \ No newline at end of file diff --git a/.github/workflows/build-base-layer.yml b/.github/workflows/build-base-layer.yml new file mode 100644 index 00000000..25334147 --- /dev/null +++ b/.github/workflows/build-base-layer.yml @@ -0,0 +1,43 @@ +name: build-base-layer +on: + push: + branches: + - main + paths: + - .github/workflows/build-base-layer.yml + - docfx/ + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +env: + docfxVersion: 2.59.2 + +permissions: + contents: 'read' + +jobs: + build-push: + name: Build and push base layer + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set DocFX version to use + run: echo v${{ env.docfxVersion }} > docfx/version + shell: bash + + - name: Login to container registry + uses: docker/login-action@v3 + with: + registry: "${{ vars.DOCKER_REGISTRY }}" + username: "${{ secrets.DOCKER_USERNAME }}" + password: "${{ secrets.DOCKER_PASSWORD }}" + + - name: Build image + run: docker build docfx --file "docfx/Dockerfile" -t ${{ vars.DOCKER_REGISTRY }}/docfx:${{ env.docfxVersion }} + + - name: Push image + run: docker push ${{ vars.DOCKER_REGISTRY }}/docfx:${{ env.docfxVersion }} diff --git a/.github/workflows/pr-cleanup.yml b/.github/workflows/pr-cleanup.yml new file mode 100644 index 00000000..b55924b3 --- /dev/null +++ b/.github/workflows/pr-cleanup.yml @@ -0,0 +1,32 @@ +name: Delete a preview environment + +on: + pull_request: + types: [closed] + +env: + SLOT_NAME: pr-${{ github.event.number }} + +jobs: + delete-slot: + runs-on: ubuntu-latest + + steps: + - name: Log into Azure CLI with service principal + uses: azure/login@v1 + with: + creds: ${{ secrets.AZURE_CREDENTIALS }} + + - name: Delete slot on staging site + run: az webapp deployment slot delete --resource-group ${{ vars.AZURE_RESOURCE_GROUP }} --name ${{ vars.AZURE_WEBAPP_NAME}} --slot ${{ env.SLOT_NAME }} + + delete-deployment: + runs-on: ubuntu-latest + + steps: + - name: Delete Deployment Environment + uses: strumwolf/delete-deployment-environment@v2 + with: + environment: "pr-${{ github.event.number }}" + token: ${{ secrets.GITHUB_TOKEN }} + onlyRemoveDeployments: true \ No newline at end of file diff --git a/.github/workflows/stage-prod-swap.yml b/.github/workflows/stage-prod-swap.yml new file mode 100644 index 00000000..d917fe43 --- /dev/null +++ b/.github/workflows/stage-prod-swap.yml @@ -0,0 +1,22 @@ +name: Swap staging slot contents into production + +on: + workflow_dispatch: + +jobs: + promote-to-production: + name: Promote to production + runs-on: ubuntu-latest + environment: + name: 'Production' + url: 'https://${{ vars.AZURE_WEBAPP_NAME }}.azurewebsites.net/' + + steps: + - name: Log into Azure CLI with service principal + uses: azure/login@v1 + with: + creds: ${{ secrets.AZURE_CREDENTIALS }} + + - name: Swap slots + run: az webapp deployment slot swap -s ${{ vars.STAGING_SLOT_NAME }} -n ${{ vars.AZURE_WEBAPP_NAME }} -g ${{ vars.AZURE_RESOURCE_GROUP }} + \ No newline at end of file diff --git a/.gitignore b/.gitignore index fc0e484b..846cf60c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,8 @@ /api/browser/**/*.manifest /api/browser/**/*.yml /obj/ -/build/ /sources/ +/_site/ /tools/ /.vscode/ /.vs/ diff --git a/Dockerfile b/Dockerfile index 144b5c7e..c285924d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,11 @@ -FROM steeltoe.azurecr.io/documentation-metadata:3.2.0-2.5.5-6 AS build +FROM steeltoe.azurecr.io/documentation-metadata:2.5.5-3.2.6 AS build WORKDIR /docs COPY . . -RUN docfx build -o build --globalMetadataFiles host.json +RUN docfx build -o /built-docs --globalMetadataFiles main-site.json FROM nginx:1.19 RUN rm -rf /usr/share/nginx/html -COPY --from=build /docs/build/_site /usr/share/nginx/html +COPY --from=build /built-docs/_site /usr/share/nginx/html COPY nginx.conf /etc/nginx/conf.d/default.conf COPY docker/ / COPY *.env /etc/documentation-site/ diff --git a/Dockerfile-metadata b/Dockerfile-metadata index fe54101b..7c4ecd6b 100644 --- a/Dockerfile-metadata +++ b/Dockerfile-metadata @@ -1,4 +1,5 @@ -FROM steeltoe.azurecr.io/docfx:2.57.2-11 +FROM steeltoe.azurecr.io/docfx:2.59.2 WORKDIR /docs COPY . . +RUN ["chmod", "+x", "./build-metadata.sh"] RUN ./build-metadata.sh diff --git a/Production.env b/Production.env deleted file mode 100644 index 1571d03c..00000000 --- a/Production.env +++ /dev/null @@ -1 +0,0 @@ -mainsite_host=https://steeltoe.io diff --git a/README.md b/README.md index da4e55cb..8ed979cb 100644 --- a/README.md +++ b/README.md @@ -2,24 +2,22 @@ ## Overview -This is the home of Steeltoe documentation and blog articles. The site uses [DocFX](https://dotnet.github.io/docfx) to convert markdown to HTML, as well as site navigation. To get the DocFX CLI, visit [this](https://dotnet.github.io/docfx/tutorial/docfx_getting_started.html) page to see the different distributions. +This is the home of Steeltoe documentation and blog articles. The site uses [DocFX](https://dotnet.github.io/docfx) to convert Markdown to HTML, generate API documentation from triple-slash comments in Steeltoe and generate site navigation. -If you are using [VS Code](https://code.visualstudio.com/) as your editor, you can use *most* of the features included in Microsoft's [docs authoring pack](https://marketplace.visualstudio.com/items?itemName=docsmsft.docs-authoring-pack). +## Site Contents -## Folders +| Path | Description +| --- | --- +| `/api` | API documentation +| `/articles` | blog posts +| `/guides` | guides for getting started with Steeltoe +| `/template` | theming -- /api: holds the project documentation markdown and table of contents - - /v2: version 2 documentation - - /all: this holds generated API docs from doc-comments in source code - - /v3: version 3 documentation - - /all: this holds generated API docs from doc-comments in source code -- /articles: holds the markdown for blog posts -- /images: the images -- /template/steeltoe: odd files that overwrite the default DocFX theme +## DocFX Markdown -## Markdown parser +DocFX offers an enhanced flavor of Markdown. To see examples and learn more, view the [DocFX Flavored Markdown](https://dotnet.github.io/docfx/spec/docfx_flavored_markdown.html) documentation. -DocFX offers a custom flavor of markdown with quite a few enhanced capabilities. To see examples and learn more, view the [DocFX Flavored Markdown specification](https://dotnet.github.io/docfx/spec/docfx_flavored_markdown.html?tabs=tabid-1%2Ctabid-a). +Visual Studio Code users may find the [Docs Authoring Pack](https://marketplace.visualstudio.com/items?itemName=docsmsft.docs-authoring-pack) extension pack useful. ### Links and Cross References @@ -27,9 +25,26 @@ As you get familiar with DocFX, you'll notice the addition of a YAML header in t **Note** it should be very rare that you hardcode a link to an 'HTML' page with your markdown. Instead, use its `UID` and let the path get calculated, as well as get links validated when building the project. +### Page display options + +In the YAML header of a page's markdown, you have options to turn page elements on or off. Below are those options. + +|Yaml label |Default value |Description | +|---------|---------|---------| +|_disableToc |false|Turn off the left hand table of contents | +|_disableAffix |false|Turn off the right hand page navigation links | +|_disableContribution |false|Turn off right hand link to "edit this page" | +|_disableFooter |false|Don't show footer when guest scrolls to page bottom | +|_enableSearch |true|Show the search icon | +|_enableNewTab |true|All links on the page open in a new browser tab | +|_disableNav |false|Do not show top navigation links | +|_hideTocVersionToggle|false |Hide the version toggler in the table of contents | +|_noindex |false|Do not let search engines index the page | +|_disableNavbar|false |Do not show top bar of page | + ## Creating a new blog post -Create a new `.md` file in the `articles` folder. Name the file something authentic that is URL-safe. Then in `/articles/index.md`, include a shorthand link to the document, as well as a short description. +Create a new `.md` file in the `articles` directory. Name the file something that is URL safe. In `/articles/index.md` add a shorthand link to the document as well as a short description. If the post should also be included in Steeltoe's RSS feed, add a link entry in `articles/rss.xml`. Here is a starter blog post: @@ -53,7 +68,8 @@ Let's talk about something really cool... ## Creating a new API document -Similar to the blog post, you're going to create a new markdown file, but in the `api` folder. The name needs to be URL-safe. Notice in the api folder, there is a `v2` and `v3` subfolder. Within each of those are folders for each component. Place your content accordingly. To include the file in the table of contents, add it in `api/(version)/toc.yml`. Notice in the example below that the `topicHref` values are not absolute paths. DocFX will calculate everything at build time. +Create a new markdown file in the `api` directory. Name the file something URL safe. In the `api` directory there are `v2` and `v3` directories. Within each of those are directories for each component. Place your content accordingly. To include the document in the Table of Contents, add it to `api/(version)/toc.yml`. +An example API document: An example API doc: @@ -71,77 +87,86 @@ Or you could link to the v3 version of this doc: @api/v3/circuitbreaker/hystrix Or do the same thing by providing custom link text: [view the v3 version](xref:api/v2/circuitbreaker/hystrix) ``` -The corresponding entry in api/v2/toc.yml: +Corresponding entry in `api/v2/toc.yml`: -```yml +```yaml - name: Circuit Breakers items: - topicHref: circuitbreaker/hystrix.md name: Hystrix ``` -## Page display options +## Installing DocFX -In the YAML header of a page's markdown, you have options to turn page elements on or off. Below are those options. +Install DocFX using one of 2 options: download from DocFX or use Docker image. -|Yaml label |Default value |Description | -|---------|---------|---------| -|_disableToc |false|Turn off the left hand table of contents | -|_disableAffix |false|Turn off the right hand page navigation links | -|_disableContribution |false|Turn off right hand link to "edit this page" | -|_disableFooter |false|Don't show footer when guest scrolls to page bottom | -|_enableSearch |true|Show the search icon | -|_enableNewTab |true|All links on the page open in a new browser tab | -|_disableNav |false|Do not show top navigation links | -|_hideTocVersionToggle|false |Hide the version toggler in the table of contents | -|_noindex |false|Do not let search engines index the page | -|_disableNavbar|false |Do not show top bar of page | +### Download from DocFX + +Download DocFX [distribution](https://github.com/dotnet/docfx/releases/). +Unzip to directory of your choosing and add that directory to your `PATH`. +If running on Linux or OS X, you will need to [install Mono](https://www.mono-project.com/docs/getting-started/install/) and use `mono` to execute the DoxFX binary. +See the script in this repository at path `docfx/docfx` for an example wrapper script. + +### Docker Image -## Building the site +You can build a Docker image with the DocFX binary and use the Powershell script `docfx.ps1` to run the image. +`docfx.ps1` mounts the project directory in the Docker container and passes any arguments to the `docfx` command in the container. -Use DocFX's [user manual](https://dotnet.github.io/docfx/tutorial/docfx.exe_user_manual.html) to build and run the site in a few different ways. The simplest way is to `cd` into the root folder of this project and run the following command. The site will build in a temporary folder named `_site` and be served at . +To build the Docker image: -```powershell -docfx build --serve --port 8082 +``` +$ docker build docfx --file "docfx/Dockerfile" ``` -You can also specify where the build output should land +Sample invocation: -```powershell -docfx build -o "../publish" +``` +$ ./docfx.ps1 --version +docfx 2.59.2.0 +Copyright (C) 2022 ? Microsoft Corporation. All rights reserved. +This is open-source software under MIT License. ``` -## Base host address +## Building and running the site -By default, the navigation links will use the live site () as the base host address. You can override that by including the applicable metadata file. +For working on any non-trivial changes, there are several ways to build and run the site locally. -If running the MainSite locally on port 8080, then use the `localhost.json` metadata file. +### Basic build and run -```powershell -docfx build --serve --port 8082 --globalMetadataFiles "localhost.json" --logLevel Warning -``` +The easiest way to build and run the site is this command: `docfx build --serve --port 8082`. -If running the MainSite locally with the dev site, then use the `devhost.json` metadata file. +### Build API docs for Steeltoe 2 and 3 -```powershell -docfx build --serve --port 8082 --globalMetadataFiles "devhost.json" --logLevel Warning -``` +Building the API docs is not required for the site to run locally. -## Updating Generated API Docs +If needed, these commands will download the Steeltoe source code and generate API documentation from the triple-slash comments in the codebase. -The contents of the folder `/api/(version)/all` was generated by running `docfx metadata` against the core Steeltoe codebase. +``` +$ git clone https://github.com/SteeltoeOSS/Steeltoe sources/v2 -b release/2.5 +$ git clone https://github.com/SteeltoeOSS/Steeltoe sources/v3 -b release/3.2 +$ git clean -fX api +$ docfx metadata api-v2.json +$ docfx metadata api-v3.json +$ docfx metadata api-all.json +``` -## Running in Docker +### Build the site docs -To test the documentation locally in Docker, run the following command: +This documentation site is interconnected with Steeltoe's [main site](https://github.com/SteeltoeOSS/MainSite). In order to run the two together, the appropriate main-site.json file variant is used to identify where the main site is running. -```bash -docker-compose up ``` +# main site -> https://steeltoe.io +$ docfx build --globalMetadataFiles main-site.json + +# main site -> https://dev.steeltoe.io +$ docfx build --globalMetadataFiles main-site.dev.json -The main site will be serving at and the documentation site will be serving at . -Note you can navigate from the navigation site to the documentation site using a browser. +# main site -> http://localhost:9081 +$ docfx build --globalMetadataFiles main-site.localhost.json +``` -## Contributions +### Run local HTTP server -All project information is available on the [Steeltoe Wiki](https://github.com/SteeltoeOSS/Steeltoe/wiki) +``` +$ docfx serve _site -p 9082 +``` diff --git a/Staging.env b/Staging.env deleted file mode 100644 index 79c72987..00000000 --- a/Staging.env +++ /dev/null @@ -1 +0,0 @@ -mainsite_host=https://dev.steeltoe.io diff --git a/azure-pipelines-metadata.yaml b/azure-pipelines-metadata.yaml deleted file mode 100644 index 5a9e5de1..00000000 --- a/azure-pipelines-metadata.yaml +++ /dev/null @@ -1,42 +0,0 @@ -trigger: - branches: - include: - - main - paths: - include: - - azure-pipelines-metadata.yaml - - Dockerfile-metadata - -variables: -- name: tagv3 - value: 3.2.0 -- name: tagv2 - value: 2.5.5 - -name: $(tagv3)-$(tagv2)-$(Rev:r) - -stages: -- stage: Deploy - displayName: Deploy - condition: - not(eq(variables['build.reason'], 'PullRequest')) - jobs: - - job: push - displayName: Push - pool: - vmImage: ubuntu-latest - steps: - - bash: | - echo '2:'$(tagv2) > metadata.conf - echo '3:'$(tagv3) >> metadata.conf - displayName: Set Version - - task: Docker@2 - displayName: Build and Push - inputs: - command: buildAndPush - Dockerfile: Dockerfile-metadata - containerRegistry: SteeltoeContainerRegistry - repository: documentation-metadata - tags: | - $(Build.BuildNumber) - latest diff --git a/azure-pipelines.yaml b/azure-pipelines.yaml deleted file mode 100644 index 2626b4ed..00000000 --- a/azure-pipelines.yaml +++ /dev/null @@ -1,59 +0,0 @@ -trigger: - branches: - include: - - main - paths: - exclude: - - README.md - - docfx/ - - azure-pipelines-metadata.yaml - - build-metadata.sh - - Dockerfile-metadata - - metadata.conf - -stages: -- stage: deploy - displayName: Deploy - condition: - not(eq(variables['build.reason'], 'PullRequest')) - jobs: - - job: deploy - displayName: Deploy - pool: - vmImage: ubuntu-latest - steps: - - task: Docker@2 - displayName: Build and Push Docker Image - inputs: - command: buildAndPush - containerRegistry: SteeltoeContainerRegistry - repository: documentation - tags: | - $(Build.BuildId) - latest - - task: ShellScript@2 - displayName: Generate Staging Manifest - inputs: - scriptPath: ./yttw.sh - args: > - -f kubernetes - -v image_tag=$(Build.BuildId) - -v hostname=docs-dev.steeltoe.io - -v doc_environment=Staging - --output-files manifests/staging - - task: ShellScript@2 - displayName: Generate Production Manifest - inputs: - scriptPath: ./yttw.sh - args: > - -f kubernetes - -v image_tag=$(Build.BuildId) - -v replica_count=2 - -v hostname=docs.steeltoe.io - -v doc_environment=Production - --output-files manifests/production - - task: PublishPipelineArtifact@1 - displayName: Publish Manifests - inputs: - targetPath: manifests - artifactName: manifests diff --git a/build-metadata.sh b/build-metadata.sh old mode 100755 new mode 100644 index 4337329f..d39b56a8 --- a/build-metadata.sh +++ b/build-metadata.sh @@ -20,11 +20,12 @@ get_sources() { } get_sources sources/v2 $v2_sources -get_sources sources/v3 $v3_sources - echo "building v2 metadata" docfx metadata api-v2.json + +get_sources sources/v3 $v3_sources echo "building v3 metadata" docfx metadata api-v3.json + echo "building all metadata" docfx metadata api-all.json diff --git a/docfx.json b/docfx.json index 065d59ba..5208d150 100644 --- a/docfx.json +++ b/docfx.json @@ -69,7 +69,7 @@ } ], "xref": [ - "build/_site/xrefmap.yml" + "_site/xrefmap.yml" ], "dest": "_site", "globalMetadataFiles": ["metadata.json"], diff --git a/docfx.ps1 b/docfx.ps1 new file mode 100755 index 00000000..0d249fad --- /dev/null +++ b/docfx.ps1 @@ -0,0 +1,3 @@ +#!/usr/bin/env pwsh + +Invoke-Expression "docker run -it --rm --volume ${pwd}:/work docfx:local $args" diff --git a/docfx/Dockerfile b/docfx/Dockerfile index 41fad485..bdd051a8 100644 --- a/docfx/Dockerfile +++ b/docfx/Dockerfile @@ -1,11 +1,24 @@ FROM mono:6.12 +WORKDIR /scratch RUN \ apt-get update && \ apt-get install -y \ git \ unzip \ + vim \ wget -COPY . /work RUN \ - /work/install.sh && \ - rm -rf /work + wget https://packages.microsoft.com/config/debian/$(cat /etc/issue | awk '{print $3}')/packages-microsoft-prod.deb -O packages-microsoft-prod.deb && \ + dpkg -i packages-microsoft-prod.deb && \ + rm packages-microsoft-prod.deb && \ + apt-get update && \ + apt install -y dotnet-sdk-8.0 +COPY . . +RUN \ + wget https://github.com/dotnet/docfx/releases/download/$(cat docfx_version)/docfx.zip && \ + mkdir -p /usr/local/libexec && \ + unzip docfx.zip -d /usr/local/libexec/docfx && \ + install docfx /usr/local/bin && \ + rm -rf /scratch +WORKDIR /work +ENTRYPOINT ["docfx"] diff --git a/docfx/azure-pipelines.yaml b/docfx/azure-pipelines.yaml deleted file mode 100644 index 4a47dfbd..00000000 --- a/docfx/azure-pipelines.yaml +++ /dev/null @@ -1,41 +0,0 @@ -trigger: - branches: - include: - - main - paths: - include: - - docfx/ - -variables: -- name: major - value: 2 -- name: minor - value: 57 -- name: patch - value: 2 - -name: $(major).$(minor).$(patch)-$(Rev:r) - -stages: -- stage: Deploy - displayName: Deploy - condition: - not(eq(variables['build.reason'], 'PullRequest')) - jobs: - - job: push - displayName: Push - pool: - vmImage: ubuntu-latest - steps: - - bash: echo v$(major).$(minor).$(patch) > docfx/version - displayName: Set Version - - task: Docker@2 - displayName: Build and Push - inputs: - command: buildAndPush - Dockerfile: docfx/Dockerfile - containerRegistry: SteeltoeContainerRegistry - repository: docfx - tags: | - $(Build.BuildNumber) - latest diff --git a/docfx/docfx b/docfx/docfx new file mode 100644 index 00000000..e59cae6a --- /dev/null +++ b/docfx/docfx @@ -0,0 +1,3 @@ +#!/bin/sh + +mono /usr/local/libexec/docfx/docfx.exe $* diff --git a/docfx/docfx_version b/docfx/docfx_version new file mode 100644 index 00000000..90d58ce4 --- /dev/null +++ b/docfx/docfx_version @@ -0,0 +1 @@ +v2.59.2 diff --git a/docfx/install.sh b/docfx/install.sh deleted file mode 100755 index 0d3ad96d..00000000 --- a/docfx/install.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/env bash - -set -e - -cd "$(dirname "${BASH_SOURCE[0]}")" - -version=$(cat version) -wget https://github.com/dotnet/docfx/releases/download/${version}/docfx.zip -mkdir -p /usr/local/libexec -unzip docfx.zip -d /usr/local/libexec/docfx -rm docfx.zip - -cat </usr/local/bin/docfx -#!/bin/sh -mono /usr/local/libexec/docfx/docfx.exe \$* -EOF - -chmod +x /usr/local/bin/docfx diff --git a/docfx/version b/docfx/version deleted file mode 100644 index d7fbfb69..00000000 --- a/docfx/version +++ /dev/null @@ -1 +0,0 @@ -v2.57.2 diff --git a/docker-compose.yaml b/docker-compose.yaml index 8927dd25..459f25bc 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,7 +1,7 @@ version: "3" services: - mainsite: - image: steeltoe.azurecr.io/mainsite + main-site: + image: steeltoe.azurecr.io/main-site ports: - "9081:80" environment: diff --git a/kubernetes/defaults.yaml b/kubernetes/defaults.yaml deleted file mode 100644 index 5e487112..00000000 --- a/kubernetes/defaults.yaml +++ /dev/null @@ -1,15 +0,0 @@ -#@data/values-schema -#@schema/type any=True ---- -name: documentation -namespace: website -image_name: steeltoe.azurecr.io/documentation -image_tag: latest -container_port: 80 -container_memory: 128Mi -container_cpu: 500m -service_port: 80 -replica_count: 1 -doc_environment: "" -hostname: "" -tls_secret: documentation-tls diff --git a/kubernetes/documentation.yaml b/kubernetes/documentation.yaml deleted file mode 100644 index 0e90d75c..00000000 --- a/kubernetes/documentation.yaml +++ /dev/null @@ -1,66 +0,0 @@ -#@ load("@ytt:data", "data") - ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: #@ data.values.name - namespace: #@ data.values.namespace -spec: - replicas: #@ int(data.values.replica_count) - selector: - matchLabels: - app: #@ data.values.name - template: - metadata: - labels: - app: #@ data.values.name - spec: - nodeSelector: - "beta.kubernetes.io/os": linux - containers: - - name: #@ data.values.name - image: #@ "{}:{}".format(data.values.image_name, data.values.image_tag) - ports: - - containerPort: #@ int(data.values.container_port) - env: - - name: DOC_ENVIRONMENT - value: #@ data.values.doc_environment - resources: - limits: - memory: #@ data.values.container_memory - cpu: #@ data.values.container_cpu - ---- -apiVersion: v1 -kind: Service -metadata: - name: #@ data.values.name - namespace: #@ data.values.namespace -spec: - type: ClusterIP - ports: - - protocol: TCP - port: #@ int(data.values.service_port) - targetPort: #@ int(data.values.container_port) - selector: - app: #@ data.values.name - -#@ if/end data.values.hostname: ---- -apiVersion: projectcontour.io/v1 -kind: HTTPProxy -metadata: - name: #@ data.values.name - namespace: #@ data.values.namespace -spec: - virtualhost: - fqdn: #@ data.values.hostname - tls: - secretName: #@ data.values.tls_secret - routes: - - conditions: - - prefix: / - services: - - name: #@ data.values.name - port: #@ int(data.values.service_port) diff --git a/main-site.dev.json b/main-site.dev.json new file mode 100644 index 00000000..16bbcf3c --- /dev/null +++ b/main-site.dev.json @@ -0,0 +1,3 @@ +{ + "_rootHost": "https://dev.steeltoe.io" +} diff --git a/host.json b/main-site.json similarity index 100% rename from host.json rename to main-site.json diff --git a/main-site.localhost.json b/main-site.localhost.json new file mode 100644 index 00000000..0bdc7fa2 --- /dev/null +++ b/main-site.localhost.json @@ -0,0 +1,3 @@ +{ + "_rootHost": "http://localhost:9081" +} diff --git a/metadata.json b/metadata.json index 27e5a5cf..2cc2483d 100644 --- a/metadata.json +++ b/metadata.json @@ -10,7 +10,7 @@ "_gitContribute": { "repo": "https://github.com/steeltoeoss/Documentation", - "branch": "dev", + "branch": "main", "apiSpecFolder": "docs-ref-overwrite" }, "_enableSearch": true, diff --git a/tool.properties b/tool.properties deleted file mode 100644 index 19e80deb..00000000 --- a/tool.properties +++ /dev/null @@ -1,2 +0,0 @@ -ytt_version=v0.36.0 -ytt_mirror=https://github.com/vmware-tanzu/carvel-ytt/releases/download diff --git a/yttw.sh b/yttw.sh deleted file mode 100755 index 669ec302..00000000 --- a/yttw.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env bash - -set -e - -# =========================================================================== # -# wrapper for ytt # -# =========================================================================== # - -base_dir=$(dirname $0) -ytt=$base_dir/tools/ytt - -if [ ! -x $ytt ]; then - ytt_version=$(grep '^ytt_version=' $base_dir/tool.properties | cut -d= -f2) - ytt_mirror=$(grep '^ytt_mirror=' $base_dir/tool.properties | cut -d= -f2) - case $(uname -s) in - Darwin) platform=darwin ;; - Linux) platform=linux ;; - *) - echo "unsupported platform: $(uname -s)" - exit 1 - ;; - esac - ytt_url=$ytt_mirror/$ytt_version/ytt-$platform-amd64 - mkdir -p $(dirname $ytt) - wget $ytt_url -O $ytt - chmod +x $ytt -fi - -exec $ytt $*