Deploying from self-hosted

Open
#6 18 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
32/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
github-actions, typescript
Domain
ci-cd, devops

Research direction

Start with the caprover/deploy-from-github action used in the workflow and the reported ENOENT path /github/workspace/deploy.tar; compare how the working directory and archive path resolve on self-hosted and GitHub-hosted runners. Reproduce the supplied workflow, then verify deployment succeeds with the generated deploy.tar on a self-hosted runner.

Written by the indexing model from the issue text.

Description

I think there might be an issue with using self-hosted runners to deploy caprover tar files.

Here is what I have:

name: Build & deploy

on:
  workflow_dispatch:
  push:

jobs:
  build-and-deploy:
    name: Build & Deploy
    runs-on: self-hosted

    steps:
      - name: Checkout
        uses: actions/checkout@v3
        with:
          fetch-depth: 0

      - name: Install Node.js
        uses: actions/setup-node@v3
        with:
          node-version: 18

      - uses: pnpm/action-setup@v2
        name: Install pnpm
        id: pnpm-install
        with:
          version: 8.5.0
          run_install: false

      - name: Get pnpm store directory
        id: pnpm-cache
        shell: bash
        run: |
          echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT

      - uses: actions/cache@v3
        name: Setup pnpm cache
        with:
          path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
          key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
          restore-keys: |
            ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}

      - name: Install dependencies
        run: pnpm install

      - name: Build
        run: pnpm turbo run build --filter web

      - uses: a7ul/[email protected]
        with:
          command: c
          cwd: './apps/web'
          files: |
            build/
            captain-definition
            nginx.conf
            Dockerfile
          outPath: deploy.tar

      - name: Deploy App to CapRover
        uses: caprover/[email protected]
        with:
          server: '${{ secrets.CAPROVER_SERVER }}'
          app: '${{ secrets.APP_NAME }}'
          token: '${{ secrets.APP_TOKEN }}'

This workflow fails with the following message:

Preparing deployment to CapRover...

Ensuring authentication...
Deploying *** to https://captain.site.cyka.info.../


Something bad happened: cannot deploy *** at https://captain.site.cyka.info./
ENOENT: no such file or directory, stat '/github/workspace/deploy.tar' 

Meanwhile, if you try to run the same thing on a github provided runner like ubuntu-20.04, it deploys without any problems.

I think this might be a misconfiguration on my end, where caprover is looking for the deploy.tar file inside of
/github/workspace instead of github/workspace/project_name/project_name

Dominant language
TypeScript
Stars
66
Forks
21
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.