Giter Site home page Giter Site logo

deploy-from-github's Introduction

CapRover

Docker Pulls Open Collective backers and sponsors GitHub release (latest by date)

Easiest app/database deployment platform and webserver package for your NodeJS, Python, PHP, Ruby, Go applications.

No Docker, nginx knowledge required!

Tweet

YouTube

What's this?

CapRover is an extremely easy to use app/database deployment & web server manager for your NodeJS, Python, PHP, ASP.NET, Ruby, MySQL, MongoDB, Postgres, WordPress (and etc...) applications!

It's blazingly fast and very robust as it uses Docker, nginx, LetsEncrypt and NetData under the hood behind its simple-to-use interface.

✔ CLI for automation and scripting

✔ Web GUI for ease of access and convenience

✔ No lock-in! Remove CapRover and your apps keep working!

✔ Docker Swarm under the hood for containerization and clustering

✔ Nginx (fully customizable template) under the hood for load-balancing

✔ Let's Encrypt under the hood for free SSL (HTTPS)

Seriously! Who should care about CapRover?

  • A [web] developer who does not like spending hours and days setting up a server, build tools, sending code to server, build it, get an SSL certificate, install it, update nginx over and over again.
  • A developer who uses expensive services like Heroku, Microsoft Azure and etc. And is interested in reducing their cost by 50x (Heroku charges 250USD/month for their 2gb instance, the same server is 5$ on Hetzner!!)
  • Someone who prefers to write more of showResults(getUserList()) and not much of $ apt-get install libstdc++6 > /dev/null
  • A developer who likes installing MySQL, MongoDB and etc on their server by selecting from a dropdown and clicking on install!
  • How much server/docker/linux knowledge is required to set up a CapRover server? Answer: Knowledge of Copy & Paste!! Head over to "Getting Started" for information on what to copy & paste ;-)

Learn More!

For more details and documentation, please visit https://CapRover.com/

Contributors

CapRover exists thanks to all the great people who have contributed to this project. [Contribute].

Financial Supporters

A big thank you to all our supporters! 🙏

Donate

deploy-from-github's People

Contributors

githubsaturn avatar maietta avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

deploy-from-github's Issues

You don't think this is better?

name: Stats Backend Deploy
on: [push]
jobs:
  build-and-deploy:
    runs-on: ubuntu-latest

    strategy:
      matrix:
        node-version: [18.x]

    steps:
      - name: Check out repository code
        uses: actions/checkout@v4

      - name: Use Node.js ${{ matrix.node-version }}
        uses: actions/setup-node@v3
        with:
          node-version: ${{ matrix.node-version }}
          cache: yarn
          cache-dependency-path: ./yarn.lock

      - run: yarn global add turbo

      - run: yarn prune:back-stats

      - run: |
          cp ./captain-definition ./out
          cp ./Dockerfile ./out

      - run: |
          cd out
          tar -czvf ./deploy.tar ./*
          mv ./deploy.tar ../

      - uses: caprover/deploy-from-github@main
        with:
          server: '${{ secrets.CAP_SERVER }}'
          app: '${{ secrets.BACK_STATS_APP }}'
          token: '${{ secrets.BACK_STATS_TOKEN }}'

deploy failed error

I am trying to deploy a nextjs app and i keep getting this error in the build logs, my repo is not associated with any organization also. its just a private repo.

Build started for scrapeweb
An explicit image name was provided (ghcr.io/smyja/scrapweb:df37ec852f198237d0b214848675edf0df0f99b6-gitsha). Therefore, no build process is needed.
Pulling this image: ghcr.io/smyja/scrapweb:df37ec852f198237d0b214848675edf0df0f99b6-gitsha This process might take a few minutes.
Build has failed!
----------------------
Deploy failed!
Error: (HTTP code 500) server error - Head "https://ghcr.io/v2/smyja/scrapweb/manifests/df37ec852f198237d0b214848675edf0df0f99b6-gitsha": denied

here is my build_and_push.sh

#!/bin/bash

set -e

cd $CONTEXT_DIR
rm /tmp/build_args || echo OK
env >/tmp/build_args
echo "--build-arg \""$(cat /tmp/build_args | sed -z 's/\n/" --build-arg "/g')"IGNORE_VAR=IGNORE_VAR\"" >/tmp/build_args
BUILD_ARGS=$(cat /tmp/build_args)
docker logout ghcr.io
COMMAND="docker build -t $FULL_IMAGE_NAME -t $IMAGE_NAME_WITH_REGISTRY:latest -f $DOCKERFILE $BUILD_ARGS --no-cache ."
/bin/bash -c "$COMMAND"
docker push $IMAGE_NAME_WITH_REGISTRY:latest
docker push $FULL_IMAGE_NAME
rm /tmp/build_args

Here is my yaml file

name: Deploy to caprover

env:
    CONTEXT_DIR: './'
    IMAGE_NAME: ${{ github.repository }}
    DOCKERFILE: ./Dockerfile
    # CAPROVER_APP: myapp-staging
    DOCKER_REGISTRY: ghcr.io

on:
    push:
        branches:
            - main
        # you can specify path if you have a monorepo and you want to deploy if particular directory is changed, make sure to update `CONTEXT_DIR` too
        # paths:
        #   - "backend-app/**"

jobs:
    build-and-publish:
        runs-on: ubuntu-latest
        steps:
            - uses: actions/checkout@v1
            - run: |
                  echo "IMAGE_NAME_WITH_REGISTRY=$DOCKER_REGISTRY/$IMAGE_NAME" >> $GITHUB_ENV
                  export IMAGE_NAME_WITH_REGISTRY=$DOCKER_REGISTRY/$IMAGE_NAME
                  echo "FULL_IMAGE_NAME=$IMAGE_NAME_WITH_REGISTRY:$GITHUB_SHA-gitsha" >> $GITHUB_ENV
           
            - name: Log in to the Container registry
              uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
              with:
                  registry: ${{ env.DOCKER_REGISTRY }}
                  username: ${{ github.actor }}
                  password: ${{ secrets.GITHUB_TOKEN }}

            - name: Build and Push Release to DockerHub
              shell: bash
              run: chmod +x ./build_and_push.sh

            - name: Use Node.js ${{ matrix.node-version }}
              uses: actions/setup-node@v3
              with:
                node-version: ${{ matrix.node-version }}
                cache: "npm"
            - run: npm ci
            - run: npm run build --if-present
            - run: npm run test --if-present
            
            - name: Deploy to CapRover
              uses: caprover/deploy-from-github@d76580d79952f6841c453bb3ed37ef452b19752c
              with:
                  server: ${{ secrets.CAPROVER_SERVER }}
                  app: ${{ secrets.APP_NAME }}
                  token: '${{ secrets.APP_TOKEN }}'
                  image: '${{ env.FULL_IMAGE_NAME }}'

NEEDS ATTENTION: Setting up Github Container Package releases

Glad I could contribute with all the suggested changes. Much thanks for accepting the project.

I've been working to try and solve why the package "deploy-from-github" hasn't been showing up. I think I know why, but I am not 100% sure. It's been hell to try and track down just exactly what is going on.

It's been so long since I needed to do anything with Github Container Registry that I had completely forgotten this important step to getting this Github Action usable for the general public.

I am submitting another PR as well, with a simpler workflow to create and push docker images to the Github Registry.

How can I handle a deploy for a pull request?

Hi guys and thank you for all the goodness, I really enjoy using Caprover!

I was wondering if and how would it be possible to deploy every time there's a new pull request to a testing/staging environment that corresponds to a url like name-of-the-branch--caproverappname.myserver.com

Ideally I would need to be able to destroy the new created env once the PR gets merged or closed, but this is not a priority.

Is this something I can achieve with this action?

Issues deploying

I'm having some issues with deploying, it keeps giving me the below error:

(I do have a special path for captain-definition, it's just the hash error)

Preparing deployment to CapRover...

**** Warning ****
No captain-definition was found in main directory: unless you have specified a special path for your captain-definition, this build will fail!

Ensuring authentication...
Cannot find hash of last commit on branch "master".

This is how i've got my workflow set-up

name: API Tests
env:
  PORT: 4000
on:
  push:
    branches: [ "master" ]

jobs:
  build_and_test:
      runs-on: ubuntu-latest
      
      strategy:
        matrix:
          node-version: [18.x]

      steps:
        - uses: actions/checkout@v3
        - name: Use Node.js ${{ matrix.node-version }}
          uses: actions/setup-node@v3
          with:
            node-version: ${{ matrix.node-version }}
            cache: "npm"
            
          
        - name: Deploy Github repo to Caprover
          uses: caprover/deploy-from-github@main
          with:
            server: http://captain.domain.xxx
            token: <redacted>
            app: api-qa
            branch: master

        - name: Run API Tests
          uses: anthonyvscode/newman-action@v1
          with:
            collection: /tests/collection.json
            reporters: cli

        - name: Output summary to console
          run: echo ${{ steps.run-newman.outputs.summary }}

Deploying from self-hosted

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.