Giter Site home page Giter Site logo

github-actions's Introduction

TypeScript NodeJS Docker AWS Ubuntu GitHub Actions

GitHub Actions ๐Ÿช

Description โœ

This is a Express Rest API. I'm trying here to run a CI/CD pipeline starting from building the docker image till deploying the container to AWS EC2 Ubuntu instance every time I push updates to the Main branch. Here are the steps:

Continuous Integration (CI) โœ…

  • Checkout code.
  • Login to dockerhub.
  • Build docker image that contains the Express Rest API and tag it with the commit sha.
  • Push the docker image to dockerhub.

Continuous Deployment (CD) ๐Ÿš€

  • Stop running docker containers.
  • Delete existing docker images.
  • Pull docker image that contains the Express Rest API.
  • Run docker container and expose port 3000.

Getting Started โ–ถ๏ธ

Setup AWS EC2 Ubuntu Runner โš™๏ธ

visit https://github.com/<username>/<repo-name>/settings/actions/runners
click "New self-hosted runner"
choose runner image & architecture from the options macOS, Linux and Windows.
follow the commands (with the normal user **"ubuntu"** and not the root user)

Setup AWS EC2 Ubuntu Runner Service โš™๏ธ

# do the following (with the normal user **"ubuntu"** and not the root user) to enable the ec2 instance to listen to the jobs triggered by the workflow.
# micro is a terminal-text-editor, to install it, run this command "sudo apt install micro"
sudo micro /etc/systemd/system/github-runner.service

# Content of the file
[Unit]
Description=GitHub Actions Self-hosted Runner
After=network.target

[Service]
WorkingDirectory=/home/ubuntu/actions-runner
ExecStart=/home/ubuntu/actions-runner/run.sh
Restart=always
Environment="RUNNER_ALLOW_RUNASROOT=1"  # Add this line if required

[Install]
WantedBy=multi-user.target
# End of file's content

# then run
sudo systemctl enable github-runner
sudo systemctl start github-runner
sudo systemctl status github-runner.service

Contribution ๐Ÿค

If you're interested in contributing to this project, please follow these guidelines:

  1. Fork the repository
  2. Make your changes
  3. Submit a Pull Request

github-actions's People

Contributors

iahmedelbayaa avatar

Watchers

 avatar

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.