Skip to content

Latest commit

 

History

History
188 lines (121 loc) · 7.11 KB

3.deployment.md

File metadata and controls

188 lines (121 loc) · 7.11 KB

Deployment

Deploy your documentation with Docus to any static hosting 🪶

To generate the documentation for production, run the following command:

::code-group

yarn build
npm run build

::

This command will run nuxt generate with fast static deployments.

A dist/ directory will be generated, ready to be deployed on any static hosting or CDN.

Cloudflare

Cloudflare Pages is a JAMstack platform for collaborating on and deploying websites. With an effortless Git integration, it will deploy your Docus site within minutes.

Visit the Cloudflare Pages section in your account dashboard and import your project.

Deploy with Cloudflare Pages

After selecting your git repository, choose Nuxt for "Framework preset". Cloudflare will automatically select the correct settings for your Docus project. Once your project has been imported, all subsequent pushes to the main branch will trigger a deployment.

DigitalOcean

DigitalOcean Apps provides an easy way to deploy static websites.

Start by clicking on the below link.

Deploy with DigitalOcean Apps

Once you logged in, you should connect your project repository with DigitalOcean. Connect your project and select your main branch, DigitalOcean will build and deploy this branch.

In the next step, you should:

  • Change project type to Static Site
  • Edit build command and set yarn nuxt generate
  • Change output directory to dist

Finally, choose a name for your website and wait for the deployment to complete.

GitHub

The best way to deploy Docus on GitHub Pages is using GitHub Actions. GitHub Actions will build, generate and publish your documentation on GitHub Pages.

If you have a workflow you need to append a new step to your existing workflow.

- name: Deploy
  uses: JamesIves/github-pages-deploy-action@4.1.0
  with:
    branch: gh-pages
    folder: ./dist

Note: You must insert this step after generate. This step uses the Deploy to GitHub Pages Action to push the generated files from the dist folder to your default GitHub Pages branch gh-pages.

If you don't have a workflow you will need to create a new one. Create a new file called gh-pages.yml in .github/workflows directory and paste the following content into the file.

name: gh-pages
on: [push, pull_request]
jobs:
  deploy:
    runs-on: ${{ matrix.os }}

    strategy:
      matrix:
        os: [ubuntu-latest]
        node: [14]

    steps:
      - name: Checkout
        uses: actions/checkout@v2

      - name: Setup node env
        uses: actions/setup-node@v2.1.2
        with:
          node-version: ${{ matrix.node }}

      - name: Install dependencies
        run: yarn

      - name: Generate
        run: yarn run nuxt generate

      - name: Deploy
        uses: JamesIves/github-pages-deploy-action@4.1.0
        with:
          branch: gh-pages
          folder: ./dist

Save the file and push it to the repository. Check out the Actions tab in your GitHub repository and you'll see the running job. Once the job has finished, your site should be live.

GitLab

To deploy Docus to GitLab Pages to can use GitLab CI. GitLab uses specific artifact to detect the public content of your projects and deploy it as static pages.

Create .gitlab-ci.yml in the root directory of your project and paste the following content into the file. If you already have gitlab-ci.yml, edit the file and add pages section into it.

image: node:14

pages:
  script:
    - yarn
    - yarn run nuxt generate
    - mv dist public
  # specify `public` directory for artifacts.
  artifacts:
    paths:
      - public

Save the file and push it to the repository. Check out running pipeline in CI / CD > Pipelines section. When it succeeds, go to Settings > Pages to view the URL where your site is now available.

Netlify

Netlify has Git-based Deployment that will continuously deploy every time you push to main (or whatever branch you choose).
Just click on the below button and import your project into Netlify. Netlify will detect that you are using Docus and will enable the correct settings for your deployment.

Deploy with Netlify

After your project has been imported, all subsequent pushes to main branch will generates a deployment.

Surge

Surge is a static web publishing platform. It provides powerful CLI utils to deploy static websites.

  1. Install surge package globally:

    ::code-group

    yarn global add surge
    npm install --global surge

    ::

  2. Generate the documentation. Generating Docus project will create dist directory that contains all contents of your documentation.

    ::code-group

    yarn build
    npm run build

    ::

  3. Use surge CLI to publish the dist directory

    surge dist/

Surge automatically uploads static contents. When it succeeds, you can view the URL where your site is now available. You may also want to use a custom domain for your documentation.

Vercel

Deploying Docus on Vercel is really easy.

Vercel will detect that you are using Docus (aka Nuxt) and will enable the correct settings for your deployment.
Just click on the below button to start.

Deploy with Vercel

After your project has been imported, all subsequent pushes to branches will generate Preview Deployments, and all changes made to the Production Branch (commonly "main") will result in a Production Deployment.