Skip to content

Commit

Permalink
Merge pull request #1 from Chaitanyarai899/consolecicd
Browse files Browse the repository at this point in the history
JS/TS build and deploy service with workflows
  • Loading branch information
Chaitanyarai899 authored Dec 11, 2024
2 parents 5ea4b57 + 1bac3fa commit a7ab6c2
Show file tree
Hide file tree
Showing 13 changed files with 217 additions and 362 deletions.
76 changes: 76 additions & 0 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Shellcheck, Testing and GitHub Container Registry CI
on:
pull_request:
types: [opened, synchronize, reopened]
push:

env:
REGISTRY: ghcr.io
IMAGE_NAME: consoleCICD
jobs:
shellcheck:
name: Shellcheck
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Run ShellCheck
uses: ludeeus/action-shellcheck@master
with:
severity: error
scandir: './automatic-deployment-CICD-template' # Only scan your project directory

bats:
strategy:
fail-fast: false
matrix:
version: ["latest"]
runs-on: ubuntu-latest
env:
BATS_LIB_PATH: "/usr/lib"
TERM: xterm
name: Script testing
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Bats and Bats-libs
uses: bats-core/bats-action@main
- name: Execute tests
run:
bats -T -p ./automatic-deployment-CICD-template/javascript/main.bats

build:
if: github.event_name == 'push'
name: Push Docker image to GitHub Container Registry
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
attestations: write
id-token: write
steps:
- name: Check out the repo
uses: actions/checkout@v4

- name: Log in to the Container registry
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: ghcr.io/${{ github.repository }}/consoleCICD

- name: Build and push Docker images
id: push
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671
with:
context: ./automatic-deployment-CICD-template
dockerfile: ./automatic-deployment-CICD-template/Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
4 changes: 4 additions & 0 deletions automatic-deployment-CICD-template/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
bats-core
test1
logs/loki-data
.gitsubmodules
9 changes: 9 additions & 0 deletions automatic-deployment-CICD-template/.gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[submodule "test/bats"]
path = test/bats
url = https://github.com/bats-core/bats-core.git
[submodule "test/test_helper/bats-support"]
path = test/test_helper/bats-support
url = https://github.com/bats-core/bats-support.git
[submodule "test/test_helper/bats-assert"]
path = test/test_helper/bats-assert
url = https://github.com/bats-core/bats-assert.git
21 changes: 2 additions & 19 deletions automatic-deployment-CICD-template/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
FROM ubuntu as javascript-automation

# nvm requirements
RUN apt-get update
RUN echo "y" | apt-get install curl git
RUN apt-get update && apt-get install -y curl git
# nvm env vars
RUN mkdir -p /usr/local/nvm
ENV NVM_DIR /usr/local/nvm

# IMPORTANT: set the exact version
ENV DEFAULT_NODE_VERSION v20.10.0
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
RUN /bin/bash -c "source $NVM_DIR/nvm.sh && nvm install $DEFAULT_NODE_VERSION && nvm use --delete-prefix $DEFAULT_NODE_VERSION"
Expand All @@ -16,26 +14,11 @@ RUN /bin/bash -c "source $NVM_DIR/nvm.sh && nvm install $DEFAULT_NODE_VERSION &&
ENV NODE_PATH $NVM_DIR/versions/node/$DEFAULT_NODE_VERSION/bin
ENV PATH $NODE_PATH:$PATH

# Install global npm packages
RUN npm install -g serve astro http-server yarn pnpm

# RUN apt-get update && \
# apt-get install -y --no-install-recommends \
# python3 \
# python3-pip \
# python3.12-venv

WORKDIR /app
COPY javascript/*.sh common/*.sh index.html /app/
RUN chmod +x *.sh

#CMD /bin/bash -c "/app/js.sh | logdy --ui-ip 0.0.0.0"
CMD ["/app/main.sh"]

FROM python:3.9-alpine3.19 as python-automation

RUN apk add git bash
WORKDIR /app
COPY python/*.sh common/*.sh index.html /app/
RUN chmod +x *.sh

CMD ["bash", "/app/main.sh"]
153 changes: 62 additions & 91 deletions automatic-deployment-CICD-template/README.md
Original file line number Diff line number Diff line change
@@ -1,73 +1,60 @@
# Introducing a Revolutionary Deployment Tool on the Akash Network to Deploy Applications Directly from GitHub/GitLab/BitBucket

If you’ve ever found yourself bogged down by the complexities of deployment and CI/CD, especially on Akash Network, our new tool is here to change the game. Designed to provide a Vercel-like experience, this tool automates the deployment process, allowing you to focus on what you do best—coding!

Note: This tool is currently in the MVP phase.

## Watch the Video

[![Watch the video](https://img.youtube.com/vi/bzPXWKgyEtw/maxresdefault.jpg)](https://youtu.be/bzPXWKgyEtw)

## Empowering Developers with Automation

Deploying applications can often involve a steep learning curve, particularly when dealing with containerization and CI/CD pipelines. Our tool simplifies this by automating deployments directly from your GitHub repository to the Akash Network. It supports several popular JavaScript frameworks, making it a versatile option for many developers.

### Supported Frameworks Include:

#### JavaScript Frameworks:

- **React**
- **Vite-react**
- **Vue.js**
- **Astro**
- **Angular**
- **Express.js**
- **Next.js**
- **Ember.js**
- **Gatsby.js**
- **Vite**
- **VitePress**
- **Nuxt.js**
- **Preact**
- **Ionic React**
- **Ionic Angular**
- **Stencil**
- **Gridsome**
- **Umi.js**
- **11ty.js**
- **Remix**
- **VuePress**

#### Python Frameworks:

- **Django**
- **Flask**

## Key Features That Set Our Tool Apart

This deployment tool isn't just about automating processes; it's about enhancing your workflow and productivity. Here’s what it offers:

- **Automated Builds and Deployments**: Simply link your public GitHub repository, and the tool takes care of the rest. Each commit you push triggers a build and deployment cycle, ensuring your application is always up-to-date.

- **Continuous Integration**: Never worry about out-of-sync versions or manual updates again. This tool ensures that your deployed application mirrors the latest changes in your repository.

- **Customizable Build Processes**: Tailor the deployment process to fit your project's specific needs. Whether it’s specifying a custom build directory or custom commands, you have the flexibility to configure as needed.

- **Roll back to previous good version in case of bad commits**: Incase of commits that break your application and cause error, the tool will automatically roll back to previous good version.

## Getting Started: Simple Steps for Deployment

To leverage this tool effectively, follow these straightforward steps:

1. **Configure Environment Variables**: Adjust the SDL (Service Deployment Language) file to include your project specifics. Key environment variables like `REPO_URL` and `BRANCH_NAME` need to be set to align with your repository details.

2. **Customize the Build Settings**: For projects that don’t fit the conventional build paths or commands, you can easily add custom configurations like `BUILD_DIRECTORY` and `BUILD_COMMAND`.

3. **Deploy Your Application**: With your SDL file configured, deploying your application is as simple as executing the deployment command. The system handles everything from compiling to hosting.

## Sample SDL Configuration for Quick Setup

For a practical application, here’s how you might set up your SDL file:
# Console-CI/CD for JS/TS

**Quick Start**: Access this feature directly at:
https://console.akash.network/new-deployment?step=edit-deployment&templateId=akash-network-awesome-akash-automatic-deployment-CICD-template&gitProvider=github

## Overview

A deployment automation tool for Akash Network that provides a Vercel-like experience. This tool streamlines the deployment process by automating builds and deployments directly from your GitHub repository.

## Supported Frameworks

### JavaScript Frameworks:
- React
- Vite-react
- Vue.js
- Astro
- Angular
- Express.js
- Next.js
- Ember.js
- Gatsby.js
- Vite
- VitePress
- Nuxt.js
- Preact
- Ionic React
- Ionic Angular
- Stencil
- Gridsome
- Umi.js
- 11ty.js
- Remix
- VuePress

## Key Features

- **Automated Builds and Deployments**: Automatic build and deployment cycles triggered by GitHub commits
- **Continuous Integration**: Ensures deployed applications stay synchronized with repository changes
- **Customizable Build Processes**: Configurable build directories and commands
- **Automatic Rollback**: Reverts to previous working version in case of deployment failures

## Getting Started

### 1. Configure Environment Variables
Adjust the SDL file with your project-specific variables:
- `REPO_URL`
- `BRANCH_NAME`

### 2. Customize Build Settings
Configure custom build parameters if needed:
- `BUILD_DIRECTORY`
- `BUILD_COMMAND`

### 3. Deploy
Execute deployment after SDL configuration is complete.

## Sample SDL Configuration

```yaml
---
Expand Down Expand Up @@ -106,27 +93,11 @@ deployment:
count: 1
```
This setup details how to expose your service, manage environment variables, and define resource allocations, providing a seamless deployment experience.
Awesome akash repo: [Click Here](https://github.com/akash-network/awesome-akash/blob/master/automatic-deployment-CICD-template/deploy.yml)
## Why This Tool Is a Game Changer
Our deployment tool is more than just a utility—it's a shift towards more efficient, less cumbersome development practices. By streamlining the traditional barriers associated with deployment on Akash Network, it allows you to deploy applications with the ease and agility that modern web development demands.
## What’s Next?
As we look to the future, we are excited to expand the capabilities of this tool. Our roadmap includes:
- **Support for More Languages and Frameworks**: Plans are underway to include support for additional programming languages like Python and Go, broadening the scope of our tool to cater to a more diverse range of projects.
- **Development of a User Interface**: To deliver a truly Vercel-like experience, we are in the process of creating a user-friendly interface. This will make the tool even more accessible and easier to use for all developers.
- **Email Notifications**: We will be introducing email notifications to keep you updated on the status of your deployments and other important events, enhancing the overall user experience.
For the complete SDL template, visit: [Awesome Akash Repository](https://github.com/akash-network/awesome-akash/blob/master/automatic-deployment-CICD-template/deploy.yml)
- **Direct Implementation on Console**: To deliver a truly Vercel-like experience, we will be building user-friendly GUI directly onto console. This will make the tool even more accessible and easier to use for all developers.
As we continue to enhance this tool, we invite you to join us on this journey. Try it out, give us your feedback, and help us redefine the deployment landscape on the Akash Network. Happy coding and deploying!
## Contributing
We welcome feedback and contributions to help improve this deployment tool for the Akash Network community.
Thank you
HoomanHq
## Acknowledgments
Developed by HoomanHq for the Akash Network ecosystem.
Loading

0 comments on commit a7ab6c2

Please sign in to comment.