An open API service indexing awesome lists of open source software.

https://github.com/s2009-dev/servup

Upload an artifact from Github Actions to a server using SSH
https://github.com/s2009-dev/servup

actions artifacts continuous-integration curl deployment english publishing s2009 shell ssh

Last synced: about 1 month ago
JSON representation

Upload an artifact from Github Actions to a server using SSH

Awesome Lists containing this project

README

          

# [![ServUp Banner](./src/logo.png)](https://github.com/marketplace/actions/servup-deployment)

![GitHub Release](https://img.shields.io/github/v/release/S2009-dev/ServUP)
![GitHub last commit](https://img.shields.io/github/last-commit/S2009-dev/ServUP)
![GitHub Downloads (all assets, all releases)](https://img.shields.io/github/downloads/S2009-dev/ServUP/total)
![GitHub forks](https://img.shields.io/github/forks/S2009-dev/ServUP)
![GitHub Repo stars](https://img.shields.io/github/stars/S2009-dev/ServUP)

## :information_source: About

ServUP is a lightweight, open-source, and easy-to-use deployment tool designed to simplify the process of deploying artifact from GitHub Actions to remote servers. It provides a simple and efficient way to manage your deployments, ensuring that your applications are always up-to-date and running.

### :bookmark_tabs: Index

- [About](#information_source-about)
- [Index](#bookmark_tabs-index)
- [Features](#sparkles-features)
- [Installation](#gear-installation)
- [Server Configuration](#cloud-server-configuration)
- [Repository Configuration](#file_folder-repository-configuration)
- [Annexes](#wrench-annexes)
- [Iptables Support](#fire-iptables-support)

### :sparkles: Features

ServUP uses SSH to securely transfer files from your GitHub Actions workflow to your remote server.

## :gear: Installation

In order to work with ServUP, you need to do some configuration on your server and your GitHub repository.

### :cloud: Server Configuration

Install ServUP on your server via the command-line with curl:

```sh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/S2009-dev/ServUP/main/tools/install.sh)"
```

This will create a `servup` user on your server and open a specific port for SSH connections (`1424` by default).
Ensure that you've copied the ServUP SSH Key given at the end of installation.

If you have a firewall, make sure to open the port given at the end of installation.
You can trust only GitHub Actions IPs, they are listed in the `actions` section of the [GitHub meta API](https://api.github.com/meta).
We provide a script to help you configure your firewall if you are using `iptables`. See [Iptables Support](#fire-iptables-support) for more information.

### :file_folder: Repository Configuration

**1. Add the following secrets to your GitHub repository:**

- `SSH_HOST`: The IP address or domain name of your server.
- `SSH_PORT`: The port used by ServUP for SSH connections (default: `1424`).
- `SSH_PRIVATE_KEY`: The private key of the `servup` user on your server.

**2. Implement the ServUP Deployment workflow:**
Add the following step to your workflow:

```yml
- name: ServUP Deployment
uses: S2009-dev/ServUP@latest
with:
artifact:
run-id: ${{ github.run_id }}
remote: /var/lib/servup/
deploy-cmd:
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SSH_HOST: ${{ secrets.SSH_HOST }}
SSH_PORT: ${{ secrets.SSH_PORT }}
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
```

Or if you want to use the development version:

```yml
- name: ServUP Deployment
uses: S2009-dev/ServUP@latest
with:
artifact:
run-id: ${{ github.run_id }}
remote: /var/lib/servup/
deploy-cmd:
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SSH_HOST: ${{ secrets.SSH_HOST }}
SSH_PORT: ${{ secrets.SSH_PORT }}
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
```

Replace ``, `` and `` with your own values.

- `` is the name of the artifact generated by your workflow (ex: `my-artifact`).
- :warning: **Warning:** Ensure that your workflow generates an artifact containing a zip file.
- `` is the remote directory where the artifact will be uploaded (ex: `my-remote`).
- :warning: **Warning:** The remote directory must be accessible by the `servup` user.
- `` is the directory where the artifact will be deployed (ex: `my-deploy`).
- :warning: **Warning:** The deploy command must be a valid command that can be executed by the `servup` user.
- You can allow the `servup` user to execute the deploy command by creating and editing the `/etc/sudoers.d/servup` file.

## :wrench: Annexes

Here you will find additional tools and resources to help you use ServUP effectively.

### :fire: Iptables Support

If you are using `iptables` as your firewall, you can use the following command to open the ServUP SSH port:

```sh
servup-firewall
```

Or if it's not working:

```sh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/S2009-dev/ServUP/main/tools/firewall.sh)"
```